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.
This commit is contained in:
Marek Marczykowski-Górecki 2015-10-27 21:31:59 +01:00
parent e475e291a9
commit 1c0ade6166
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

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