Bug 542639 - Uses wrong (octal) device number for attaching USB devices
Summary: Uses wrong (octal) device number for attaching USB devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F13VirtTarget
TreeView+ depends on / blocked
 
Reported: 2009-11-30 12:47 UTC by Enrico Scholz
Modified: 2010-05-28 17:56 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.7.1-16.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 549840 (view as bug list)
Environment:
Last Closed: 2010-05-28 17:56:29 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Enrico Scholz 2009-11-30 12:47:50 UTC
Description of problem:

libvirtd seems to convert the USB device number into octal mode. This creates problems for numbers >=9

# echo "<hostdev mode='subsystem' type='usb'><source><address bus='6' device='18'/></source></hostdev>" | \
  virsh attach-device winxp /dev/stdin
error: Failed to attach device from /dev/stdin
error: cannot set ownership on /dev/bus/usb/006/022: No such file or directory


This device is reported by the kernel as

| usb 6-2: new full speed USB device using uhci_hcd and address 18

and can be found at /dev/bus/usb/006/018 (which can not be addressed by octal numbers).


Btw, it would be nice when the 'device=...' and 'bus=...' attributes would be always interpreted with a radix of 10.  These numbers are exported by kernel hotplug events as zero-padded values (e.g. BUSNUM=006 or DEVNUM=018).  Having a fixed radix of 10 would allow udev rules with an one-liner as above which auto-attach USB devices.


Version-Release number of selected component (if applicable):

libvirt-0.7.1-15.fc12.x86_64
qemu-0.11.0-11.fc12.x86_64

Comment 1 Daniel Berrangé 2009-11-30 12:56:23 UTC
The problem isn't in the XML parser, but rather in src/util/hostusb.c, in its usbGetDevice() function

    snprintf(dev->name, sizeof(dev->name), "%.3o:%.3o",
             dev->bus, dev->dev);
    snprintf(dev->path, sizeof(dev->path),
             USB_DEVFS "%03o/%03o", dev->bus, dev->dev);



Changing those %.3o  to %.3d  ought to make it work correctly.

Comment 2 Daniel Berrangé 2010-02-11 14:43:01 UTC
Patch available upstream

http://www.redhat.com/archives/libvir-list/2010-February/msg00377.html

Comment 3 Fedora Update System 2010-05-18 16:55:40 UTC
libvirt-0.7.1-16.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/libvirt-0.7.1-16.fc12

Comment 4 Fedora Update System 2010-05-19 19:13:39 UTC
libvirt-0.7.1-16.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libvirt'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/libvirt-0.7.1-16.fc12

Comment 5 Fedora Update System 2010-05-28 17:55:53 UTC
libvirt-0.7.1-16.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.