Re: [virt-manager PATCH] virt-manager, delete: fix path for disk type='volume'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cole Robinson <crobinso@xxxxxxxxxx> writes:

> 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

the same problem is present in details.py, I'll send another patch to
fix this too.

Thanks,
Giuseppe

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux