https://bugzilla.redhat.com/show_bug.cgi?id=815755
The set of patch tries to fix the issue when multiple usb devices with
same idVendor, idProduct are availible on host, the usb device with
lowest bus:device will be attached to guest if usb xml file is given like
this:
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x15e1'/>
<product id='0x2007'/>
</source>
</hostdev>
The reason is that the usb hotplug function searchs usb device in system files
to match vendor and product id, the file with lowest number is always found
first.
After fix, in this case, libvirt will report an error as follows:
At the same time, the usb part of domain initilization is also update in patch 2/3
# virsh attach-device rhel6u1 /tmp/usb.xml
error: Failed to attach device from /tmp/usb.xml
error: XML error: multiple USB deivces 15e1:2007, use <address> to specify one.
The patch also fix the problem when using the following xml, the usb device could
be hotplugged in two domains without raising errors.
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<address bus='6' device='4'/>
</source>
</hostdev>