Ubuntu

failure when detaching a usb device

Reported by Nils Naumann on 2013-09-01
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Fedora)
Unknown
Unknown
libvirt (Ubuntu)
Medium
Unassigned
Raring
Medium
Unassigned

Bug Description

===================================
SRU Justification:
1. Impact: usb device autoremoval is broken
2. Development fix: fix a typo in a matching function
3. Stable fix: backport of stable fix
4. Test case: virsh detach-device (see below)
5. Regression potential: this is a trivial cherrypick of upstream patch, so there should be little risk of regression
===================================

Ubuntu 13.04

libvirt0: 1.0.2-0ubuntu11.13.04.2

The automatic unplugging of usb devices (in this case a Lego NXT) doesn't work any more. The following udev rule is used;

ACTION=="remove", \
    SUBSYSTEMS=="usb", \
    ATTRS{idVendor}=="0694", \
    ATTRS{idProduct}=="0002", \
    RUN+="/usr/bin/virsh detach-device WinXP-clone /var/lib/libvirt/images/hostdev-0694:0002.xml"
ACTION=="add", \
    SUBSYSTEMS=="usb", \
    ATTRS{idVendor}=="0694", \
    ATTRS{idProduct}=="0002", \
    RUN+="/usr/bin/virsh attach-device WinXP-clone /var/lib/libvirt/images/hostdev-0694:0002.xml"

the reason is apparently a bug in 'virsh detach-device':

$ /usr/bin/virsh attach-device WinXP-clone /var/lib/libvirt/images/hostdev-0694:0002.xml
Device attached successfully

$ /usr/bin/virsh detach-device WinXP-clone /var/lib/libvirt/images/hostdev-0694:0002.xml
Fehler: Fehler beim Lösen des Geräts von /var/lib/libvirt/images/hostdev-0694:0002.xml
Fehler: operation failed: host usb device vendor=0x0694 product=0x0002 not found

$ cat /var/lib/libvirt/images/hostdev-0694:0002.xml
<!--NXT -->
<hostdev mode='subsystem' type='usb' managed='yes'>
  <source>
    <vendor id='0x0694'/>
    <product id='0x0002'/>
  </source>
</hostdev>

A fix might be described in RH bug# 916837:
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4cae0d3..2b2f35c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8541,7 +8541,7 @@ static int
 virDomainHostdevMatchSubsysUSB(virDomainHostdevDefPtr a,
                                virDomainHostdevDefPtr b)
 {
- if (b->source.subsys.u.usb.bus && b->source.subsys.u.usb.device) {
+ if (a->source.subsys.u.usb.bus && a->source.subsys.u.usb.device) {
         /* specified by bus location on host */
         if (a->source.subsys.u.usb.bus == b->source.subsys.u.usb.bus &&
             a->source.subsys.u.usb.device == b->source.subsys.u.usb.device)
--
1.7.11.2

Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug. Marking confirmed for raring based on the rh bug. Marking fix released for saucy as that patch is included in 1.1.0.

Changed in libvirt (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in libvirt (Ubuntu Raring):
importance: Undecided → Medium
status: New → Confirmed
Changed in libvirt (Ubuntu):
status: Confirmed → Fix Released
description: updated

Hello Nils, or anyone else affected,

Accepted libvirt into raring-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/libvirt/1.0.2-0ubuntu11.13.04.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libvirt (Ubuntu Raring):
status: Confirmed → Fix Committed
tags: added: verification-needed

The fix for this bug has been awaiting testing feedback in the -proposed repository for raring for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Serge Hallyn (serge-hallyn) wrote :

As raring is ending in 17 days I think dropping this sru is the best path, thanks.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.