From: Jiri Denemark Date: Tue, 30 Jun 2015 08:21:21 +0000 (+0200) Subject: qemu: Fix assignment of the default spicevmc channel name X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=365b454ed9e86fb5c7125d66924ff95ae526afdc;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git qemu: Fix assignment of the default spicevmc channel name Make sure we only assign the default spicevmc channel name to spicevmc virtio channels. Caused by commits 3269ee65 and 1133ee2b, which moved the assignment from XML parsing code to QEMU but failed to keep the logic. https://bugzilla.redhat.com/show_bug.cgi?id=1179680 Signed-off-by: Jiri Denemark --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2209cf68e..9b06a4924 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6427,7 +6427,9 @@ qemuBuildVirtioSerialPortDevStr(virDomainDefPtr def, virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) { virBufferAsprintf(&buf, ",chardev=char%s,id=%s", dev->info.alias, dev->info.alias); - if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) { + if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && + (dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC || + dev->target.name)) { virBufferAsprintf(&buf, ",name=%s", dev->target.name ? dev->target.name : "com.redhat.spice.0"); } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args new file mode 100644 index 000000000..7908445f0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args @@ -0,0 +1,16 @@ +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 virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ +-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-usb \ +-hda /dev/HostVG/QEMUGuest1 \ +-chardev pty,id=charchannel0 \ +-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0 \ +-chardev spicevmc,id=charchannel1,name=vdagent \ +-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,\ +name=com.redhat.spice.0 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.xml new file mode 100644 index 000000000..74badedc8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + +
+ + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a212d30e3..4154601d8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1110,6 +1110,9 @@ mymain(void) DO_TEST("channel-spicevmc-old", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC); + DO_TEST("channel-virtio-default", + QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); DO_TEST("smartcard-host", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,