]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: don't use %.3d format for bus/addr of USB devices
authorDiego Elio Pettenò <flameeyes@gmail.com>
Tue, 26 Oct 2010 12:45:03 +0000 (14:45 +0200)
committerEric Blake <eblake@redhat.com>
Tue, 26 Oct 2010 16:19:07 +0000 (10:19 -0600)
When using 0-prefixed numbers, QEmu will interpret them as octal numbers
(as C convention says); this means that if you attach a device that has
addr > 10 (decimal) you're going to attach a different device.

src/qemu/qemu_conf.c
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args

index 00e89a1ac4f664b7725ccd1cba43306d2453c8d3..5bd3d4c7b7ca9b999e1a68d2b5917b0ae242c398 100644 (file)
@@ -3266,7 +3266,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&ret, "usb-host,hostbus=%.3d,hostaddr=%.3d,id=%s",
+    if (virAsprintf(&ret, "usb-host,hostbus=%d,hostaddr=%d,id=%s",
                     dev->source.subsys.u.usb.bus,
                     dev->source.subsys.u.usb.device,
                     dev->info.alias) < 0)
@@ -3288,7 +3288,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&ret, "host:%.3d.%.3d",
+    if (virAsprintf(&ret, "host:%d.%d",
                     dev->source.subsys.u.usb.bus,
                     dev->source.subsys.u.usb.device) < 0)
         virReportOOMError();
index 6900fd3637530a38c7e74d0269a077a584feea80..7e425420eefd231d012039758f52aa2472777432 100644 (file)
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=014,hostaddr=006,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=14,hostaddr=6,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
index e57bec1ff2ee54da1ade0c4344ba57d680f9aa09..96e004db6ae5a5bb0ab8fcd63e022bd38b4ee6f0 100644 (file)
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:014.006
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:14.6