virt-manager/0008-vmm-connection-Handle-missing-storage-volumes-bz-107.patch

40 lines
1.6 KiB
Diff
Raw Normal View History

From 84c1bd12297b366a7187592ca29cc03cb1daf3c5 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 27 Feb 2014 13:16:21 -0500
Subject: [PATCH] vmm connection: Handle missing storage volumes (bz 1070883)
Similar to what was done in a808bd669293ac66047a716b2e84a5a64c99667b
for the virtinst connection wrapper.
(cherry picked from commit f67df117017e6de855a8c0e900e47fe920dfaa48)
---
virtManager/connection.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/virtManager/connection.py b/virtManager/connection.py
index 6f6c838..96dfa1c 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -172,10 +172,17 @@ class vmmConnection(vmmGObject):
self._backend.cb_fetch_all_pools = (
lambda: [obj.get_xmlobj(refresh_if_nec=False)
for obj in self.pools.values()])
- self._backend.cb_fetch_all_vols = (
- lambda: [obj.get_xmlobj(refresh_if_nec=False)
- for pool in self.pools.values()
- for obj in pool.get_volumes(refresh=False).values()])
+
+ def fetch_all_vols():
+ ret = []
+ for pool in self.pools.values():
+ for vol in pool.get_volumes(refresh=False).values():
+ try:
+ ret.append(vol.get_xmlobj(refresh_if_nec=False))
+ except libvirt.libvirtError, e:
+ logging.debug("Fetching volume XML failed: %s", e)
+ return ret
+ self._backend.cb_fetch_all_vols = fetch_all_vols
def clear_cache(pools=False):
if not pools: