Bug 798838

Summary: Some problems of USB hostplug/passthrough with product and vendor.
Product: Red Hat Enterprise Linux 6 Reporter: yuping zhang <yupzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, ajia, dallan, dyuan, mprivozn, mzhan, rwu, weizhan, zhpeng
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-30 14:44:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yuping zhang 2012-03-01 03:31:31 UTC
Description of problem:
Hostplug USB to a guest,then shutdown guest -> start guest,fail to hostplug USB to guest.
Shutdown guest,passthrough USB to guest,then start guest -> shutdown guest,after that,fail to start guest again.

Version-Release number of selected component (if applicable):
libvirt-0.9.10-3.el6.x86_64
virt-manager-0.9.0-10.el6.x86_64

How reproducible:
always

Steps to Reproduce:

# virsh nodedev-dumpxml usb_2_1
<device>
  <name>usb_2_1</name>
  <parent>usb_usb2</parent>
  <driver>
    <name>usb</name>
  </driver>
  <capability type='usb_device'>
    <bus>2</bus>
    <device>8</device>
    <product id='0x1625'>DT 101 II</product>
    <vendor id='0x0951'>Kingston</vendor>
  </capability>
</device>

Hotplug:
1.Start a guest.
2.Prepare a USB xml with product + vendor.
#cat hostdev-usb-product.xml 
<hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
              <product id='0x1625'/>
              <vendor id='0x0951'/>
       </source>
</hostdev>

3.#virsh attach-device rhel6.2-new hostdev-usb-product.xml
Device attached successfully
4.Shutdown guest,then start it.

5.Attach the USB device to gust again
# virsh attach-device rhel6.2-new hostdev-usb-product.xml 
error: Failed to attach device from hostdev-usb-product.xml
error: Requested operation is not valid: USB device 002:010 is in use by domain ;�m

Passthrough:
1.Shutdown a guest.
2.Add the USB xml(product+vendor) to guest.
#virsh edit rhel6.2-new
...
<hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
              <product id='0x1625'/>
              <vendor id='0x0951'/>
       </source>
</hostdev>
...
3.Start the guest.Wait for the guest boot successfully,then shutdown it.
4.Start the guest again.
# virsh start rhel6.2-new
error: Failed to start domain rhel6.2-new
error: Requested operation is not valid: USB device 002:010 is in use by domain 

Actual results:
As above

Expected results:
1.The usb can be hotplugged and the guest can be started successfully.
2.Restart libvirtd,the usb can works well.

Additional info:
The USB works well when hotplug/passthrough with bus and device.

Comment 2 dyuan 2012-04-28 07:10:26 UTC
It should be regression caused by patch of bug 743671.

Comment 5 Michal Privoznik 2012-04-30 08:00:05 UTC
dyuan,

You're right. The first round of patch that tried to fix bug 743671 turned out to be incomplete. Therefore I've posted the second round. However, the have missed upstream freeze phase, so they will be picked up by next release (0.9.12);

So I think we can close this one as a dup of bug 743671.
Laine?

Comment 6 Laine Stump 2012-04-30 14:42:45 UTC
Yes, this bug is fixed by the patches listed in https://bugzilla.redhat.com/show_bug.cgi?id=743671#c9 . They had been delayed because the full impact of *not* having them wasn't realized. So, completely fixing that bug will cause this bug to go away.