virt-manager/virtinst-refresh_before_fetch_pool.patch

40 lines
1.5 KiB
Diff

Reference: bnc#887868
Refresh pools status before fetch_pools.
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@suse.com>
Index: virt-manager-3.0.0/virtinst/pollhelpers.py
===================================================================
--- virt-manager-3.0.0.orig/virtinst/pollhelpers.py
+++ virt-manager-3.0.0/virtinst/pollhelpers.py
@@ -48,6 +48,19 @@ def fetch_pools(backend, origmap, build_
typename = "pool"
list_cb = backend.listAllStoragePools
support_cb = backend.support.conn_storage
+
+ # 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 as e: # pragma: no cover
+ pass
+
return _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb)