[virt-tools-list] [virt-manager PATCH 6/9] inspection: filter libguestfs VMs earlier

Pino Toscano ptoscano at redhat.com
Wed Feb 22 15:42:42 UTC 2017


No need to do any job for them, so skip processing them altogether when
a new one is added.
---
 virtManager/inspection.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/virtManager/inspection.py b/virtManager/inspection.py
index c86abd5..b98c718 100644
--- a/virtManager/inspection.py
+++ b/virtManager/inspection.py
@@ -20,7 +20,6 @@
 from Queue import Queue
 from threading import Thread
 import logging
-import re
 
 from guestfs import GuestFS  # pylint: disable=import-error
 
@@ -64,6 +63,11 @@ class vmmInspection(vmmGObject):
 
     # Called by the main thread whenever a VM is added to vmlist.
     def vm_added(self, conn, connkey):
+        if connkey.startswith("guestfs-"):
+            logging.debug("ignore libvirt/guestfs temporary VM %s",
+                          connkey)
+            return
+
         obj = ("vm_added", conn.get_uri(), connkey)
         self._q.put(obj)
 
@@ -154,11 +158,6 @@ class vmmInspection(vmmGObject):
             logging.exception("%s: exception while processing", prettyvm)
 
     def _inspect_vm(self, conn, vm):
-        if re.search(r"^guestfs-", vm.get_name()):
-            logging.debug("ignore libvirt/guestfs temporary VM %s",
-                          vm.get_name())
-            return None
-
         g = GuestFS(close_on_exit=False)
         prettyvm = conn.get_uri() + ":" + vm.get_name()
 
-- 
2.9.3




More information about the virt-tools-list mailing list