From 8ee909f08c94b5513bc2d41670cc24ff6b6993e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 6 Feb 2016 05:34:22 +0100 Subject: [PATCH] Caught unknown libvirt errors on getting runtime VM info In some cases libvirt doesn't report error code at all. This probably happens in some stage of domain startup/shutdown. Threat this the same as domain not running. Fixes QubesOS/qubes-issues#1537 --- core-modules/000QubesVm.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 35f30d6b..12fce513 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -779,6 +779,8 @@ class QubesVm(object): # libxl_domain_info failed - domain no longer exists elif e.get_error_code() == libvirt.VIR_ERR_INTERNAL_ERROR: return 0 + elif e.get_error_code() is None: # unknown... + return 0 else: print >>sys.stderr, "libvirt error code: {!r}".format( e.get_error_code()) @@ -798,6 +800,8 @@ class QubesVm(object): # libxl_domain_info failed - domain no longer exists elif e.get_error_code() == libvirt.VIR_INTERNAL_ERROR: return 0 + elif e.get_error_code() is None: # unknown... + return 0 else: print >>sys.stderr, "libvirt error code: {!r}".format( e.get_error_code()) @@ -918,6 +922,11 @@ class QubesVm(object): except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: return False + # libxl_domain_info failed - domain no longer exists + elif e.get_error_code() == libvirt.VIR_INTERNAL_ERROR: + return False + elif e.get_error_code() is None: # unknown... + return False else: print >>sys.stderr, "libvirt error code: {!r}".format( e.get_error_code()) @@ -932,6 +941,11 @@ class QubesVm(object): except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: return False + # libxl_domain_info failed - domain no longer exists + elif e.get_error_code() == libvirt.VIR_INTERNAL_ERROR: + return False + elif e.get_error_code() is None: # unknown... + return False else: print >>sys.stderr, "libvirt error code: {!r}".format( e.get_error_code())