[virt-tools-list] [PATCH] virtinst: refresh pools status before fetch_pools

Chunyan Liu cyliu at suse.com
Fri Dec 5 08:40:05 UTC 2014


Currently, when connecting to hypervisor, if there are pools active
but in fact target path already deleted (or for other reasons the
pool is not working), libvirtd not refresh status yet, fetch_pools
will fail, that will cause "connecting to hypervisor" process
reporting error and exit. The whole connection work failed.

With the patch, always refresh pool status before fetch pools. Let
the libvirtd pool status reflect the reality, avoid the non-synced
status affects the hypervisor connection.

Signed-off-by: Chunyan Liu <cyliu at suse.com>
---
 virtinst/pollhelpers.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index a9b1527..e8702f0 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -133,6 +133,19 @@ def fetch_pools(backend, origmap, build_func):
 
     if backend.check_support(
         backend.SUPPORT_CONN_LISTALLSTORAGEPOOLS) and not _force_old_poll:
+
+        # Refresh pools before poll_helper. For those
+        # 'active' but target path not exist (or other reasons
+        # causing the pool not working), but libvirtd not
+        # refresh the status, this will make it refreshed
+        # and mark that pool as 'inactive'.
+        objs = backend.listAllStoragePools()
+        for obj in objs:
+            try:
+                obj.refresh(0)
+            except Exception, e:
+                pass
+
         return _new_poll_helper(origmap, name,
                                 backend.listAllStoragePools, build_func)
     else:
-- 
1.8.4.5




More information about the virt-tools-list mailing list