[virt-tools-list] [PATCH v2 2/2] addhardware: use bus, device to distingush usb products

Guan Nan Ren gren at redhat.com
Mon Apr 29 13:07:46 UTC 2013


 I realized this patch only tries to solve one aspect of the whole duplicate usb devices issue.
 If there is a usb device which has been attached to guest with vendor/product, then I plug a new
 duplicate usb device into host, the new device will use vendor/product/bus/addr to be attached
 to the same guest. If so, we have to update the first usb device with bus/addr info too, otherwise,
 the guest will throw an error at next boot. Reverse the process when removing the duplicate. 

 One way of doing this is before adding the duplicate usb device into guest, we update the persistent
 guest XML with corresponding bus/addr of first usb device. The hard part is its bus/addr info is lost
 already at this time.

 The other way is updating first device in tick(), when new duplicate node device is added, the
 signal handler of 'nodedev-added' can help update the first device which has been attached to
 a guest by redefining guest persistent XML. The downside is there too, we have to go through all of
 guest to update every time when new node device is plugged into host.

 And currently, one usb device only use vendor/product after attached into a guest, that means I can
 can change it to any usb device as long as they own the same vendorId/productId after vm reboot. If we
 use vendor/product/bus/addr, there is no such problem.

 Any idea to fix the issue is welcome :)
 About above words, please feel free to correct me.

 Guannan



----- Original Message -----
From: "Cole Robinson" <crobinso at redhat.com>
To: "Guannan Ren" <gren at redhat.com>
Cc: virt-tools-list at redhat.com
Sent: Saturday, April 27, 2013 3:56:00 AM
Subject: Re: [virt-tools-list] [PATCH v2 2/2] addhardware: use bus, device to distingush usb products


Doing this bit unconditionally in virtinst, then undoing the bus/addr bits in
virt-manager is not a good idea, since now virt-install is still 'broken' in
this way. We want to avoid setting bus/addr unless it's the only option to
make things work (duplicate devices).

You could do the duplicate check before creating the HostDevice, then passdown
an option like is_dup to device_from_node

- Cole




More information about the virt-tools-list mailing list