[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH] virt-manager: ignore another VIR_ERR_NO_DOMAIN error



It fixes this exception while removing a VM:

Traceback (most recent call last):
  File "virt-manager/virtManager/details.py", line 1438, in refresh_vm_state
    self.change_run_text(vm.hasSavedImage())
  File "virt-manager/virtManager/domain.py", line 1238, in hasSavedImage
    return self._backend.hasManagedSaveImage(0)
  File "/usr/local/lib/python2.7/site-packages/libvirt.py", line 852, in hasManagedSaveImage
    if ret == -1: raise libvirtError ('virDomainHasManagedSaveImage() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid
  '7c3eebec-9b22-48ea-b9a2-3341840d0476' (test)

Traceback (most recent call last):
  File "virt-manager/virtManager/manager.py", line 885, in vm_status_changed
    self.vm_selected()
  File "virt-manager/virtManager/manager.py", line 1009, in vm_selected
    self.change_run_text(vm.hasSavedImage())
  File "virt-manager/virtManager/domain.py", line 1238, in hasSavedImage
    return self._backend.hasManagedSaveImage(0)
  File "/usr/local/lib/python2.7/site-packages/libvirt.py", line 852, in hasManagedSaveImage
    if ret == -1: raise libvirtError ('virDomainHasManagedSaveImage() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid
   '7c3eebec-9b22-48ea-b9a2-3341840d0476' (test)

Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
---
 virtManager/domain.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index a2ae5c5..4ce6328 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1234,7 +1234,12 @@ class vmmDomain(vmmLibvirtObject):
     def hasSavedImage(self):
         if not self.managedsave_supported:
             return False
-        return self._backend.hasManagedSaveImage(0)
+        try:
+            return self._backend.hasManagedSaveImage(0)
+        except libvirt.libvirtError, e:
+            if not uihelpers.exception_is_libvirt_error(e, "VIR_ERR_NO_DOMAIN"):
+                raise
+            return False
 
     def removeSavedImage(self):
         if not self.hasSavedImage():
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]