Fix race condition in QubesVm.get_cputime/get_mem

When domain is destroyed after isActive check, but before getting
actuall info, it would fail. So handle this situation.
Tento commit je obsažen v:
Marek Marczykowski-Górecki 2015-10-27 21:31:59 +01:00
rodič e475e291a9
revize 1c0ade6166
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: 063938BA42CFA724

Zobrazit soubor

@ -760,6 +760,9 @@ class QubesVm(object):
except libvirt.libvirtError as e: except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
return 0 return 0
# libxl_domain_info failed - domain no longer exists
elif e.get_error_code() == libvirt.VIR_INTERNAL_ERROR:
return 0
else: else:
raise raise
@ -774,6 +777,9 @@ class QubesVm(object):
except libvirt.libvirtError as e: except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
return 0 return 0
# libxl_domain_info failed - domain no longer exists
elif e.get_error_code() == libvirt.VIR_INTERNAL_ERROR:
return 0
else: else:
raise raise