[PATCH] virtinst: refresh pools status before fetch_pools

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

 



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@xxxxxxxx>
---
 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

_______________________________________________
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