[virt-tools-list] [PATCH] Allow watching for USB devices hotplug and attaching them to VMs

Michal Novotny minovotn at redhat.com
Mon Aug 17 14:54:48 UTC 2009


Daniel P. Berrange wrote:
> On Thu, Aug 13, 2009 at 09:43:53AM -0400, Michal Novotny wrote:
>   
>> Hi all,
>>
>> this is the patch to check for the USB device hotplugging, it currently
>> allows 2 types of watching for USB device hotplug - using HAL and udev
>> itself. There is a plan for DeviceKit support but I am not currently
>> having option to make it for DeviceKit so this option will be added in
>> time. Nevertheless the HAL and udev implementations are working now
>> but you may have to choose the desired type in the Preferences menu.
>> UDev type is working by watching for /dev tree changes using pyinotify
>> and querying udevadm so if you want to use udev type, you need to have
>> pyinotify module installed.
>>     
>
> Talking directly to HAL, DeviceKit or sysfs from virt-manager is not
> really that nice. virt-manager has done this in the past, but we've
> wanted to move all this functionality into libvirt itself, since that's
> the only way it will be able to work for remove hypervisors. libvirt
> already exposes information about all host USB devices. All that's
> missing is an API that notifies you when one is created/deleted, so
> you can avoid polling on libvirt all the time. 
>
> Regards,
> Daniel
>   
Hi Daniel,
if you would like to add notification support for libvirt you should 
talk with HAL/DeviceKit directly and you can also use INotify for 
catching the directory changes in the /dev tree if no connection is 
available to HAL/DeviceKit at all but udev is available. Also, one more 
thing is that if you would like to use DeviceKit you need to link 
libvirt with gnome-disk-utility (gdu) - I've been talking with a guy 
working in Desktop Team in our office and this is what I've been told. 
GDU libraries are not available in Fedora 10 installation if you don't 
YUM the DeviceKit* packages, also the API have changed much since that 
time (based on what I've been told) so if you would like to add this to 
libvirt, older versions of Fedora (like Fedora 10) won't work because 
there is no gdu library (which can be yummed with some deprecated API to 
Fedora 10) so if you want to add this to libvirt directly, you should 
add option --without-gdu to configure script. According to what I've 
been told GDU have dependencies to glib-2.0 and DeviceKit packages but I 
think only linking with -lgdu is OK.

So would you like to add this support to libvirt itself which would 
obsolete my patch?

Thanks,
Michal




More information about the virt-tools-list mailing list