Commit 6bbe4988 authored by Antoine Millet's avatar Antoine Millet

Handle non-updatable storages (offline, stopped...)

parent 6e3194a9
......@@ -437,18 +437,21 @@ class Storage(object):
return True if self.type in Storage.SHARED_TYPES else False
def update(self):
self.lv_storage.refresh()
self.update_attr()
# update volumes
for vol_name in self.lv_storage.listVolumes():
if vol_name in self.volumes:
# update volume
self.volumes[vol_name].update()
else:
# add volume
v = Volume(self, self.lv_storage.storageVolLookupByName(vol_name))
self.volumes[v.name] = v
try:
self.lv_storage.refresh()
self.update_attr()
# update volumes
for vol_name in self.lv_storage.listVolumes():
if vol_name in self.volumes:
# update volume
self.volumes[vol_name].update()
else:
# add volume
v = Volume(self, self.lv_storage.storageVolLookupByName(vol_name))
self.volumes[v.name] = v
except libvirt.libvirtError as err:
logger.warning('Unable to update storage %s: %s', self.name, err)
def update_attr(self):
self.state, self.capacity, self.allocation, self.available = self.lv_storage.info()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment