connection: Handle volume XMLDesc errors (bz 1064275)

This commonly happens when a file is deleted from a storage pool
behind libvirt's back.
This commit is contained in:
Cole Robinson 2014-02-12 13:57:44 -05:00
parent d680539b46
commit a808bd6692

View File

@ -225,8 +225,13 @@ class VirtualConnection(object):
pool = self._libvirtconn.storagePoolLookupByName(xmlobj.name)
ignore, ignore, vols = pollhelpers.fetch_volumes(
self, pool, {}, lambda obj, ignore: obj)
ret += [StorageVolume(weakref.ref(self), parsexml=obj.XMLDesc(0))
for obj in vols.values()]
for vol in vols.values():
try:
xml = vol.XMLDesc(0)
ret.append(StorageVolume(weakref.ref(self), parsexml=xml))
except libvirt.libvirtError, e:
logging.debug("Fetching volume XML failed: %s", e)
if self.cache_object_fetch:
self._fetch_cache[key] = ret