storage: do not throw exception if the volume or the pool don't exist
commit 5357b91402
changed the semantic of
conn.get_(vm|pool|interface|nodedev|net), to return None instead of
raising KeyError. Leave the exception handling code in case the
semantic is going to be reverted.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1219427
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
c4d26d16a6
commit
ac2be79658
|
@ -236,7 +236,11 @@ def populate_storage_list(storage_list, vm, conn):
|
|||
if disk.source_pool:
|
||||
try:
|
||||
pool = conn.get_pool(disk.source_pool)
|
||||
if pool is None:
|
||||
return disk.path
|
||||
vol = pool.get_volume(disk.path)
|
||||
if vol is None:
|
||||
return disk.path
|
||||
return vol.get_target_path()
|
||||
except KeyError:
|
||||
return disk.path
|
||||
|
|
|
@ -2700,12 +2700,14 @@ class vmmDetails(vmmGObjectUI):
|
|||
if not path:
|
||||
size = "-"
|
||||
else:
|
||||
vol = None
|
||||
if source_pool:
|
||||
try:
|
||||
pool = self.conn.get_pool(source_pool)
|
||||
vol = pool.get_volume(path)
|
||||
if pool is not None:
|
||||
vol = pool.get_volume(path)
|
||||
except KeyError:
|
||||
vol = None
|
||||
pass
|
||||
else:
|
||||
vol = self.conn.get_vol_by_path(path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue