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

Re: [virt-tools-list] [PATCH] VMM - Show host device information bits



On 10/26/2009 10:59 AM, Michal Novotny wrote:
> Hi,
> this is new version of host device information bits, tested with PCI 
> devices as well.
> 
> Thanks,
> Michal
> 

I think we should support USB devices by bus/addr and PCI devices before
pushing.

The libvirt test driver now supports host device routines as of 0.7.2,
so if you pull that version and install, you should be able to use my
updated test driver to emulate PCI and USB device passthrough:

http://fedorapeople.org/~crobinso/virt-manager/testdriver.xml

Another thing, after looking at the UI changes, we are exposing a lot of
redundant info. If the device info lookup succeeds, we should just set
'Source Device' to use dev.pretty_name(), which gives all the info they
might want. This saves us having to add a bunch of UI fields that may
not be populated anyways.

> diff -r e363de9ac549 src/virtManager/details.py
> --- a/src/virtManager/details.py	Wed Oct 21 12:01:53 2009 -0400
> +++ b/src/virtManager/details.py	Mon Oct 26 15:58:02 2009 +0100
> @@ -1173,12 +1173,35 @@
>          if not hostdevinfo:
>              return
>  
> +        try:
> +            typ = hostdevinfo[1]['type']
> +            if typ == 'usb':
> +                typ = 'usb_device'
> +            vendor_id = hostdevinfo[1]['vendor']['id']
> +            product_id = hostdevinfo[1]['product']['id']
> +        except Exception, e:
> +            vendor_id = -1
> +            product_id = -1
> +
> +        dev_pretty_name = None
> +        dev_vendor_name = None
> +        dev_product_name = None
> +        devs = self.vm.get_connection().get_devices( typ, None )
> +        for dev in devs:
> +            if dev.product_id == product_id and dev.vendor_id == vendor_id:
> +                dev_pretty_name = dev.pretty_name()
> +                dev_vendor_name = dev.vendor_name
> +                dev_product_name = dev.product_name
> +

When you go to support PCI devices, I'd just break this logic out into a
helper function in domain.py.

Thanks,
Cole


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