Bug 730930

Summary: RFE: The real "managed" support for host usb device
Product: Red Hat Enterprise Linux 6 Reporter: WANG Chao <chaowang>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.2CC: acathrow, ajia, chaowang, czhang, dallan, juzhang, jyang, mzhan, qcai, ruyang, rwu, weizhan
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-23 03:08:26 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 WANG Chao 2011-08-16 09:34:19 UTC
Description of problem:
After attaching a usb storage device from host to a guest, host /dev/sdX (assume this is the USB storage device), /dev/sdX disappeared correctly, and then detach it from guest, /dev/sdX should appear, but actually /dev/sdX didn't show up.

Version-Release number of selected component (if applicable):
2.6.32-189.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.attach a USB storage device from host to a guest
host# lsusb | grep
host# ls /dev/sd*
/dev/sda /dev/sdb1 /dev/sdb2      ---/dev/sdb is the USB device will be attached
guest# ls /dev/sd*
No such file or directory
host# virsh attach-device 1 usb.xml
Device attached successfully
host# ls /dev/sd*
/dev/sda
guest# ls /dev/sd*
/dev/sda /dev/sda1       ---/dev/sda is the attached USB device---
(USB device successfully attached to guest)
2.detach it
host# virsh detach-device 1 usb.xml
Device detached successfully
guest# ls /dev/sd*
No such file or directory    ---/dev/sda is not here because we just detached it
host#ls /dev/sd*
/dev/sda                     ---/dev/sdb is missing which shouled be here
  
Actual results:
/dev/sdb missing

Expected results:
/dev/sdb appear after detach

Additional info:
Try with 3 combinations USB3 device on USB2 port, USB2 device on USB3 port, USB2 device on USB2 port.All of them have this issue.
host# cat usb.xml
<hostdev mode='subsystem' type='usb' managed='yes'>
	<source>
		<vendor id='0x0bc2' />
		<product id='0x50a1' />
	</source>
</hostdev>
vendor id and product id can be found by running lsusb

Comment 2 Qian Cai 2011-09-28 02:45:23 UTC
Looks like an userspace issue.

Comment 3 Alex Jia 2011-09-28 03:22:02 UTC
Libvirt hasn't well support USB2.0 now, and we have a bug to trace similar issues:
https://bugzilla.redhat.com/show_bug.cgi?id=715590

Comment 4 Alex Jia 2011-09-28 03:23:46 UTC
In addition, please provide your libvirt version.

Comment 5 Osier Yang 2011-09-28 04:13:03 UTC
I take this as a similiar bug in hand (#BZ 736214).

Comment 6 Alex Jia 2011-09-28 06:06:05 UTC
(In reply to comment #4)
> In addition, please provide your libvirt version.

And your qemu-kvm version is also important, the following is a qemu-kvm known bug about usb:
https://bugzilla.redhat.com/show_bug.cgi?id=733272

So you had better give libvirt and qemu-kvm version in here.

Alex

Comment 7 WANG Chao 2011-09-28 06:47:57 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > In addition, please provide your libvirt version.
> 
> And your qemu-kvm version is also important, the following is a qemu-kvm known
> bug about usb:
> https://bugzilla.redhat.com/show_bug.cgi?id=733272
> 
> So you had better give libvirt and qemu-kvm version in here.
> 
> Alex

Hi, Alex,
Sorry,I didn't record the original test environment.
But I just test with
libvirt-0.9.4-12.el6.x86_64
qemu-kvm-0.12.1.2-2.192.el6.x86_64
and this issue is still there.

Comment 8 Osier Yang 2011-10-14 02:37:57 UTC
This is a RFE for libvirt, we don't reattach the managed USB device to host if attaching fails/detaching succeeded/starting fails/destroy succeeded, just like what for PCI device.

Comment 9 Dave Allan 2011-11-23 03:08:26 UTC
This should be done as part of the USB work to support USB > 1.0.  Closing as WONTFIX and this work will be rolled into that RFE.