Bug 542639 - Uses wrong (octal) device number for attaching USB devices
Uses wrong (octal) device number for attaching USB devices
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: libvirt (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Veillard
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks: F13VirtTarget
  Show dependency treegraph
 
Reported: 2009-11-30 07:47 EST by Enrico Scholz
Modified: 2010-05-28 13:56 EDT (History)
7 users (show)

See Also:
Fixed In Version: libvirt-0.7.1-16.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 549840 (view as bug list)
Environment:
Last Closed: 2010-05-28 13:56:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2009-11-30 07:47:50 EST
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 Berrange 2009-11-30 07:56:23 EST
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 Berrange 2010-02-11 09:43:01 EST
Patch available upstream

http://www.redhat.com/archives/libvir-list/2010-February/msg00377.html
Comment 3 Fedora Update System 2010-05-18 12:55:40 EDT
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 15:13:39 EDT
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 13:55:53 EDT
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.