Skip to content
Snippets Groups Projects
Commit 6bbe4988 authored by Antoine Millet's avatar Antoine Millet
Browse files

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

parent 6e3194a9
No related branches found
No related tags found
No related merge requests found
...@@ -437,18 +437,21 @@ class Storage(object): ...@@ -437,18 +437,21 @@ class Storage(object):
return True if self.type in Storage.SHARED_TYPES else False return True if self.type in Storage.SHARED_TYPES else False
def update(self): def update(self):
self.lv_storage.refresh() try:
self.update_attr() self.lv_storage.refresh()
self.update_attr()
# update volumes
for vol_name in self.lv_storage.listVolumes(): # update volumes
if vol_name in self.volumes: for vol_name in self.lv_storage.listVolumes():
# update volume if vol_name in self.volumes:
self.volumes[vol_name].update() # update volume
else: self.volumes[vol_name].update()
# add volume else:
v = Volume(self, self.lv_storage.storageVolLookupByName(vol_name)) # add volume
self.volumes[v.name] = v 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): def update_attr(self):
self.state, self.capacity, self.allocation, self.available = self.lv_storage.info() self.state, self.capacity, self.allocation, self.available = self.lv_storage.info()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment