[virt-tools-list] [virt-manager PATCH] virtManager/addhardware: get supported disk bus types from libvirt
Chen Hanxiao
chen_han_xiao at 126.com
Tue Feb 7 08:44:01 UTC 2017
At 2017-02-06 16:17:05, "Pavel Hrdina" <phrdina at redhat.com> wrote:
>On Sun, Feb 05, 2017 at 04:51:57PM -0500, Cole Robinson wrote:
>> On 01/20/2017 10:21 AM, Pavel Hrdina wrote:
>> > Libvirt provides domain capabilities where supported disk bus types are
>> > listed. Virt-manager should try to get those bus types. The old code
>> > remains as fallback if domain capabilities doesn't contain the disk
>> > bus types.
>> >
>> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1387218
>> >
>> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
>> > ---
>> > virtManager/addhardware.py | 49 +++++++++++++++++++++++++++++-----------------
>> > 1 file changed, 31 insertions(+), 18 deletions(-)
>> >
>> > diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
>> > index aab90957..e63ad3d0 100644
>> > --- a/virtManager/addhardware.py
>> > +++ b/virtManager/addhardware.py
>> > @@ -690,25 +690,38 @@ class vmmAddHardware(vmmGObjectUI):
>> >
>> > @staticmethod
>> > def populate_disk_bus_combo(vm, devtype, model):
>> > + # try to get supported disk bus types from domain capabilities
>> > + domcaps = vm.get_domain_capabilities()
>> > + disk_bus_types = None
>> > + if "bus" in domcaps.devices.disk.enum_names():
>> > + disk_bus_types = domcaps.devices.disk.get_enum("bus").get_values()
>> > +
>>
>> Unfortunately libvirt's domcaps don't seem to be exhaustive. For example,
>> bus=sd isn't listed, which virt-manager supports in the existing code. So in
>> order to enable this we would need to 1) fix libvirt, 2) only use the domcaps
>> code from known good versions. That's kind of the general difficulty in
>> switching to these types of capabilities reporting APIs unfortunately...
>
>Yes, I've noticed that, but unfortunately after I've pushed the patch. I would
>say that this makes things better than worst even though virt-manager will not
>display all available buses for disks. I agree that Libvirt should be fixed
>to provide correct data if it already provides these data.
>
I send a libvirt patch for fixing this issue:
http://www.redhat.com/archives/libvir-list/2017-February/msg00191.html
I tested virt-manager 798a2e508011512e0fe5671f222a9e49049059e3
with this libvirt patch.
It works.
Regards,
- Chen
More information about the virt-tools-list
mailing list