[PATCH 2/3] virt-manager: ignore VIR_ERR_NO_DOMAIN when a domain was just deleted

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

 



Some callbacks registered by `idle_add' could try to access a domain that
was just deleted.  Detect these cases and don't propagate the exception.

Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
---
NOTE:

The race situation appears quite seldom, for my tests I have created and
deleted a bunch of LXC application containers.  I have noticed this issue
while I was debugging 985291.

 virtManager/details.py | 11 +++++++++--
 virtManager/domain.py  |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/virtManager/details.py b/virtManager/details.py
index 2f7e7d4..cb9ea7a 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -2635,8 +2635,15 @@ class vmmDetails(vmmGObjectUI):
 
         # If the dialog is visible, we want to make sure the XML is always
         # up to date
-        if self.is_visible():
-            self.vm.refresh_xml()
+        try:
+            if self.is_visible():
+                self.vm.refresh_xml()
+        except libvirt.libvirtError, e:
+            if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and
+                e.get_error_code() == getattr(libvirt, "VIR_ERR_NO_DOMAIN")):
+                self.close()
+                return
+            raise
 
         # Stats page needs to be refreshed every tick
         if (page == PAGE_DETAILS and
diff --git a/virtManager/domain.py b/virtManager/domain.py
index de0df8a..bd04452 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1560,6 +1560,7 @@ class vmmDomain(vmmLibvirtObject):
         """
         try:
             info = self._backend.info()
+            self._update_status(info[0])
         except libvirt.libvirtError, e:
             if (hasattr(libvirt, "VIR_ERR_NO_DOMAIN") and
                 e.get_error_code() == getattr(libvirt, "VIR_ERR_NO_DOMAIN")):
@@ -1567,7 +1568,6 @@ class vmmDomain(vmmLibvirtObject):
                 return
             raise
 
-        self._update_status(info[0])
 
     def _update_status(self, status):
         """
-- 
1.8.3.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux