[libvirt] [PATCH] spice: don't force user to specify spicevmc channel

Martin Kletzander mkletzan at redhat.com
Fri Jan 31 16:08:33 UTC 2014

We support only one spicevmc channel name anyway and the code is
prepared to use the default one, there's only one check missing.  I'm
not adding it to documentation in case there is another channel name
aded in the future, but this helps people using virsh for defining
domains with spice vdagent.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
I extended the context to see what I meant by "the code is already
prepared to use the default one".

 src/qemu/qemu_command.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2db745a..2124477 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6127,30 +6127,31 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
                            "%s", _("virtio serial device has invalid address type"));
             goto error;

                           ",bus=" QEMU_VIRTIO_SERIAL_PREFIX "%d.%d",

     if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
         dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
+        dev->target.name &&
         STRNEQ_NULLABLE(dev->target.name, "com.redhat.spice.0")) {
                        _("Unsupported spicevmc target name '%s'"),
         goto error;

     if (!(dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
           dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
           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) {
             virBufferAsprintf(&buf, ",name=%s", dev->target.name
                               ? dev->target.name : "com.redhat.spice.0");

More information about the libvir-list mailing list