hostdev: add an address element for USB host devs if necessary

This issue was fixed for few years but only in virt-manager,
virt-install has the same bug.  If you have two USB devices with same
vendor and product ID, you need to use also address element to create
a valid XML to define that device into a guest.

This patch moves the logic from vmmAddHardware into VirtualHostDevice in
order to not duplicate that code for virt-manager and virt-install.

Also update the tests files to properly check this functionality.  I've
changed the USB device according the 'tests/testdriver.xml' and picked
one of the USB HUBs, because they have the same vendor and product ID.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1230611

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina
2015-07-23 13:15:26 +02:00
committed by Giuseppe Scrivano
parent a51eea16f8
commit b06c91d2fc
4 changed files with 26 additions and 27 deletions

View File

@@ -1,8 +1,8 @@
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x0781"/>
<product id="0x5151"/>
<address bus="1" device="4"/>
<vendor id="0x1d6b"/>
<product id="0x0002"/>
<address bus="2" device="1"/>
</source>
</hostdev>