On Fri, Apr 10, 2015 at 16:28:23 +0200, Ján Tomko wrote:
Request that the number be parsed as decimal, to allow 08
and 09.
Format it with the leading zero, 1.01 and 1.10 are two
different versions.
https://bugzilla.redhat.com/show_bug.cgi?id=1210650
---
src/conf/domain_conf.c | 6 +--
.../qemuxml2argv-usb-redir-filter-version.args | 19 +++++++++
.../qemuxml2argv-usb-redir-filter-version.xml | 46 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++
.../qemuxml2xmlout-usb-redir-filter-version.xml | 46 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
6 files changed, 121 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1763305..65e2bac 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11347,8 +11347,8 @@ virDomainRedirFilterUSBVersionHelper(const char *version,
*temp = '\0';
temp++;
- if ((virStrToLong_ui(version_copy, NULL, 0, &major)) < 0 ||
- (virStrToLong_ui(temp, NULL, 0, &minor)) < 0) {
+ if ((virStrToLong_ui(version_copy, NULL, 10, &major)) < 0 ||
+ (virStrToLong_ui(temp, NULL, 10, &minor)) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("Cannot parse USB version %s"), version);
goto cleanup;
lol, funny bug
@@ -20209,7 +20209,7 @@ virDomainRedirFilterDefFormat(virBufferPtr
buf,
virBufferAsprintf(buf, " product='0x%04X'",
usbdev->product);
if (usbdev->version >= 0)
- virBufferAsprintf(buf, " version='%d.%d'",
+ virBufferAsprintf(buf, " version='%d.%02d'",
((usbdev->version & 0xf000) >> 12) * 10 +
((usbdev->version & 0x0f00) >> 8),
((usbdev->version & 0x00f0) >> 4) * 10 +
This too
diff --git
a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.args
b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.args
new file mode 100644
index 0000000..7656ac4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.args
@@ -0,0 +1,19 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S \
+-M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
+-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,\
+multifunction=on,addr=0x4 \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
+-chardev spicevmc,id=charredir0,name=usbredir \
+-device 'usb-redir,chardev=charredir0,id=redir0,\
+filter=0x08:0x15E1:0x2007:0x0109:1|0x08:0x15E1:0x2007:0x0940:1|\
+-1:-1:-1:-1:0,bus=usb.0,port=4' \
+-chardev spicevmc,id=charredir1,name=usbredir \
+-device 'usb-redir,chardev=charredir1,id=redir1,\
+filter=0x08:0x15E1:0x2007:0x0109:1|0x08:0x15E1:0x2007:0x0940:1|\
+-1:-1:-1:-1:0,bus=usb.0,port=5' \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.xml
b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.xml
new file mode 100644
index 0000000..f1189c9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.xml
@@ -0,0 +1,46 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0' model='ich9-ehci1'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x7'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci1'>
+ <master startport='0'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci2'>
+ <master startport='2'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x1'/>
+ </controller>
+ <controller type='usb' index='0' model='ich9-uhci3'>
+ <master startport='4'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x2'/>
+ </controller>
Does the test need all the controllers above?
+ <controller type='pci' index='0'
model='pci-root'/>
+ <redirdev bus='usb' type='spicevmc'>
+ <address type='usb' bus='0' port='4'/>
+ </redirdev>
+ <redirdev bus='usb' type='spicevmc'>
+ <address type='usb' bus='0' port='5'/>
+ </redirdev>
+ <redirfilter>
+ <usbdev class='0x08' vendor='0x15E1' product='0x2007'
version='1.09' allow='yes'/>
+ <usbdev class='0x08' vendor='0x15E1' product='0x2007'
version='9.4' allow='yes'/>
+ <usbdev allow='no'/>
+ </redirfilter>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
ACK,
Peter