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):
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",
USB_DEVFS "%03o/%03o", dev->bus, dev->dev);
Changing those %.3o to %.3d ought to make it work correctly.
Patch available upstream
libvirt-0.7.1-16.fc12 has been submitted as an update for Fedora 12.
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
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.