Bug 1230611

Summary: Install a guest failed with --hostdev bus.device when two usb device have same product and vendor id
Product: Red Hat Enterprise Linux 7 Reporter: Xiaodai Wang <xiaodwan>
Component: virt-managerAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: juzhou, mzhan, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.2.1-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:26:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
debug log info none

Description Xiaodai Wang 2015-06-11 08:57:22 UTC
Created attachment 1037558 [details]
debug log info

Description of problem:
Install a guest failed with --hostdev bus.device when two usb device have same product and vendor id.

Version-Release number:
virt-manager-1.2.0-4.el7.noarch
virt-manager-common-1.2.0-4.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Plug two usb devices which have same product and vendor id.
# lsusb
Bus 002 Device 023: ID 15e1:2007 RSA RSA SecurID (R) Authenticator
Bus 002 Device 019: ID 15e1:2007 RSA RSA SecurID (R) Authenticator
2. Run virt-install command with --hostdev bus.device.
# virt-install -n new -r 1024 -f /var/lib/libvirt/images/demo.img  -s 6 --host-device 002.019 --vnc --import --force

Actual results:
# virt-install -n new -r 1024 -f /var/lib/libvirt/images/demo.img  -s 6 --host-device 002.019 --vnc --import --force
WARNING  Unable to connect to graphical console: virt-viewer not installed. Please install the 'virt-viewer' package.
WARNING  No console to launch for the guest, defaulting to --wait -1

Starting install...
ERROR    operation failed: Multiple USB devices for 15e1:2007, use <address> to specify one
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start new
otherwise, please restart your installation.

Expected results:
The guest should be installed successfully.

Comment 2 Pavel Hrdina 2015-07-23 11:15:26 UTC
Upstream patch proposed:

https://www.redhat.com/archives/virt-tools-list/2015-July/msg00118.html

Comment 3 Pavel Hrdina 2015-08-05 11:40:12 UTC
Upstream commit:

commit b06c91d2fc23644bfb13e174c7441f8a00c17477
Author: Pavel Hrdina <phrdina>
Date:   Thu Jul 23 13:15:26 2015 +0200

    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>

Comment 7 fwu 2015-08-12 03:18:23 UTC
I can reproduce this bug with package:
virt-manager-1.2.1-4.el7.noarch
virt-manager-common-1.2.1-4.el7.noarch

Steps are the same as description above.

Then try to verify with new build:
virt-manager-1.2.1-5.el7.noarch

Steps:
1. Plug two usb devices which have same product and vendor id.
# lsusb
Bus 004 Device 003: ID 15e1:2007 RSA RSA SecurID (R) Authenticator
Bus 004 Device 002: ID 15e1:2007 RSA RSA SecurID (R) Authenticator
2. Run virt-install command with --hostdev bus.device.
virt-install -n new -r 1024 -f /var/lib/libvirt/images/test.img --host-device 004.003--vnc --import

Results:
After step 2, message appears:
Starting install...
Creating domain...                                       |    0 B     00:00     

The guest was installed successfully.

According to the result above in the latest version of virt-manager, move this bug from ON_QA to VERIFIED.

Comment 9 errata-xmlrpc 2015-11-19 05:26:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2206.html