On 10/09/2014 05:17 AM, Giuseppe Scrivano wrote: > Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1146869 > > Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx> > --- > virtManager/delete.py | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/virtManager/delete.py b/virtManager/delete.py > index 248392f..b865d18 100644 > --- a/virtManager/delete.py > +++ b/virtManager/delete.py > @@ -232,8 +232,17 @@ def populate_storage_list(storage_list, vm, conn): > model = storage_list.get_model() > model.clear() > > - diskdata = [(disk.target, disk.path, disk.read_only, disk.shareable) for > - disk in vm.get_disk_devices()] > + def get_path(disk): > + if disk.sourcePool: > + pool = conn.get_pool(disk.sourcePool) > + if pool: > + vol = pool.get_volume(disk.path) get_pool and get_volume should never return None, only throw a KeyError when the pool doesn't exist. So drop the if: checks, and wrap the whole thing in try: except: KeyError, and if that fails just return path = None I think - Cole > + if vol: > + return vol.get_target_path() > + return disk.path > + > + diskdata = [(d.target, get_path(d), d.read_only, d.shareable) for > + d in vm.get_disk_devices()] > > diskdata.append(("kernel", vm.get_xmlobj().os.kernel, True, False)) > diskdata.append(("initrd", vm.get_xmlobj().os.initrd, True, False)) > _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list