Bug 743671
Summary: | USB device can be reassigned to another VM without error | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Miroslav Vadkerti <mvadkert> | ||||||
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | ||||||
Severity: | high | Docs Contact: | |||||||
Priority: | high | ||||||||
Version: | 6.2 | CC: | acathrow, ajia, dallan, juzhang, laine, mzhan, rwu, smueller, syeghiay, tdavis, veillard, weizhan, yupzhang, zhpeng | ||||||
Target Milestone: | rc | ||||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | libvirt-0.9.10-21.el6 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2012-06-20 06:32:04 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: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 826592 | ||||||||
Attachments: |
|
Description
Miroslav Vadkerti
2011-10-05 17:20:18 UTC
I can reproduce this issue on rhel6 beta(2.6.32-193.el6.x86_64) with libvirt-0.9.4-19.el6.x86_64 and qemu-kvm-0.12.1.2-2.200.el6.x86_64: # lsusb | grep Kingston Bus 001 Device 004: ID 0951:1625 Kingston Technology DataTraveler 101 I # ll /dev/bus/usb/001/ -Z crw-rw-r--. root root system_u:object_r:usb_device_t:s0 001 crw-rw-r--. root root system_u:object_r:usb_device_t:s0 004 # virsh edit guest1 and guest2, and add the following <hostdev...> element block into guest XML configuration: <hostdev mode='subsystem' type='usb' managed='no'> <source> <vendor id='0x0951'/> <product id='0x1625'/> </source> </hostdev> # virsh start guest1 Domain guest1 started # ll /dev/bus/usb/001/ -Z crw-rw-r--. root root system_u:object_r:usb_device_t:s0 001 crw-rw-r--. qemu qemu system_u:object_r:svirt_image_t:s0:c213,c954 004 # virsh start guest2 Domain guest2 started # ll /dev/bus/usb/001/ -Z crw-rw-r--. root root system_u:object_r:usb_device_t:s0 001 crw-rw-r--. qemu qemu system_u:object_r:svirt_image_t:s0:c319,c628 004 Patch sent upstream: https://www.redhat.com/archives/libvir-list/2011-December/msg00982.html Moving to POST: commit 8a34f822e6a618a3ad80c81d5f2c76d62faf2f29 Author: Michal Privoznik <mprivozn> AuthorDate: Wed Dec 21 18:58:29 2011 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Sat Dec 24 18:12:04 2011 +0100 qemu: Keep list of USB devices attached to domains In order to avoid situation where a USB device is in use by two domains, we must keep a list of already attached devices like we do for PCI. v0.9.8-102-g8a34f82 test on libvirt-0.9.9-1.el6.x86_64 kernel-2.6.32-225.el6.x86_64 qemu-kvm-0.12.1.2-2.213.el6.x86_64 The bug still exists, both guests can start successfully, so change the bug status to assign (In reply to comment #5) > test on > libvirt-0.9.9-1.el6.x86_64 > kernel-2.6.32-225.el6.x86_64 > qemu-kvm-0.12.1.2-2.213.el6.x86_64 > > > The bug still exists, both guests can start successfully, so change the bug > status to assign Can you please provide full debug logs then? As it works on my machine. Created attachment 572614 [details]
start 2 guest with assign the same usb
Patches committed upstream: commit ea3bc548aca7b4c448b48863120ad35a7337c127 Author: Michal Privoznik <mprivozn> AuthorDate: Mon Mar 26 16:44:19 2012 +0200 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Apr 4 15:09:41 2012 +0200 qemu: Build activeUsbHostdevs list on process reconnect If the daemon is restarted it will lose list of active USB devices assigned to active domains. Therefore we need to rebuild this list on qemuProcessReconnect(). commit e2f5dd6134ebeb6846450c7d7782273d3d274859 Author: Michal Privoznik <mprivozn> AuthorDate: Mon Mar 26 16:40:01 2012 +0200 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Apr 4 15:09:41 2012 +0200 qemu: Delete USB devices used by domain on stop To prevent assigning one USB device to two domains, we keep a list of assigned USB devices. On domain startup - qemuProcessStart() - we insert devices used by domain into the list but remove them only on detach-device. Devices are, however, released on qemuProcessStop() as well. v0.9.11-12-gea3bc54 v0.9.11-11-ge2f5dd6 Therefore moving to POST. I just found this; see: https://bugzilla.redhat.com/show_bug.cgi?id=814866 https://bugzilla.redhat.com/show_bug.cgi?id=798838 for problem(s) caused by this set of patches. (In reply to comment #10) > I just found this; see: > > https://bugzilla.redhat.com/show_bug.cgi?id=814866 > https://bugzilla.redhat.com/show_bug.cgi?id=798838 > > for problem(s) caused by this set of patches. My understanding of your comments in Bug 814866 was that the patches detailed in this bug *fixed* the problem, not that they caused it. I haven't investigated the other report. *** Bug 798838 has been marked as a duplicate of this bug. *** Actually, even though it is solved by the two patches listed in Comment 9, Bug 798838 is a DUP of Bug 808459 (which tracks pushing those two patches to RHEL). The patches detailed in Comment 9, have already been pushed to 6.3 to resolve Bug 808459. So should this be moved back to 6.3 by virtue of all the patches already being pushed? What about the failure detailed in Comment8? Is that addressed by those two patches? (sounds like it is, but would be good to verify before going to the trouble of requesting blocker, etc). If we do move it to 6.3, can it go straight to ON_QA? The patches have been present in the RHEL builds since 0.9.10-10. Test on kernel-2.6.32-269.el6.x86_64 qemu-kvm-0.12.1.2-2.292.el6.x86_64 libvirt-0.9.10-20.el6.x86_64 When first time do # virsh start kvm-rhel6u3-i386 error: Failed to start domain kvm-rhel6u3-i386 error: Requested operation is not valid: USB device 002:002 is in use by domain kvm-rhel6u3-x86_64 it report error but second time do # virsh start kvm-rhel6u3-i386 Domain kvm-rhel6u3-i386 started it will succeed I found that after first start, the label changed to crw-rw-r--. root root system_u:object_r:usb_device_t:s0 002 so reassign it. Created attachment 584917 [details]
second guest can start on second time
weizhang, I think it's a regression introduced by fix for Bug 815755. Can you please re-test with -10 build? From the logs I see you've used -20 which contains patches for the bug I am referring to. Thanks! Anyway, I'll post patches soon. (In reply to comment #19) > weizhang, > > I think it's a regression introduced by fix for Bug 815755. Can you please > re-test with -10 build? From the logs I see you've used -20 which contains > patches for the bug I am referring to. > > Thanks! > > Anyway, I'll post patches soon. Hi Michal, I test with libvirt-0.9.10-10 and can not reproduce this problem, so I think it is a regression. Yeah. I've proposed a patch: http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-May/msg00305.html Therefore moving to POST. Oh, and this one is needed too: http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-May/msg00309.html The new build libvirt-0.9.10-21.el6 contains the two patches, Daniel Test on kernel-2.6.32-269.el6.x86_64 qemu-kvm-0.12.1.2-2.292.el6.x86_64 libvirt-0.9.10-21.el6.x86_64 After start second guest with usb, it report error #virsh start kvm-rhel6u3-i386 error: Failed to start domain kvm-rhel6u3-i386 error: Requested operation is not valid: USB device 002:007 is in use by domain kvm-rhel6u3-x86_64 The error will still report when do several times, but after start second guest first, the label of usb device changed back to crw-rw-r--. root root system_u:object_r:usb_device_t:s0 007 but not as the label when start first guest crw-rw-r--. qemu qemu system_u:object_r:svirt_image_t:s0:c441,c858 007 Is that ok? No, but I'd say in this phase of release please split that into a different bug, please. I've taken a look and it's not only USB devices what's affected but PCI as well. Thanks Michal, then verify this bug as comment 28 shows, file a new bug https://bugzilla.redhat.com/show_bug.cgi?id=825068 *** Bug 796059 has been marked as a duplicate of this bug. *** 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. http://rhn.redhat.com/errata/RHSA-2012-0748.html |