diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 54f46c60ee..8eac8edd79 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1422,8 +1422,27 @@ qemuBuildChardevStr(const virDomainChrSourceDef *dev,
dev->data.spiceport.channel);
break;
- case VIR_DOMAIN_CHR_TYPE_NMDM:
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
+ virBufferAsprintf(&buf, "qemu-vdagent,id=%s,name=vdagent",
+ charAlias);
+ if (dev->data.qemuVdagent.clipboard != VIR_TRISTATE_BOOL_ABSENT)
+ virBufferAsprintf(&buf, ",clipboard=%s",
+ virTristateSwitchTypeToString(dev->data.qemuVdagent.clipboard));
+ switch (dev->data.qemuVdagent.mouse) {
+ case VIR_DOMAIN_MOUSE_MODE_CLIENT:
+ virBufferAddLit(&buf, ",mouse=on");
+ break;
+ case VIR_DOMAIN_MOUSE_MODE_SERVER:
+ virBufferAddLit(&buf, ",mouse=off");
+ break;
+ case VIR_DOMAIN_MOUSE_MODE_DEFAULT:
+ case VIR_DOMAIN_MOUSE_MODE_LAST:
+ default:
+ break;
+ }
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_NMDM:
case VIR_DOMAIN_CHR_TYPE_LAST:
default:
break;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 95bcbc08ef..d9f93bd2fa 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6820,11 +6820,37 @@ qemuMonitorJSONAttachCharDevGetProps(const char *chrID,
break;
+ case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT: {
+ virTristateBool mouse = VIR_TRISTATE_BOOL_ABSENT;
+ switch (chr->data.qemuVdagent.mouse) {
+ case VIR_DOMAIN_MOUSE_MODE_CLIENT:
+ mouse = VIR_TRISTATE_BOOL_YES;
+ break;
+ case VIR_DOMAIN_MOUSE_MODE_SERVER:
+ mouse = VIR_TRISTATE_BOOL_NO;
+ break;
+ case VIR_DOMAIN_MOUSE_MODE_DEFAULT:
+ break;
+ case VIR_DOMAIN_MOUSE_MODE_LAST:
+ default:
+ virReportEnumRangeError(virDomainMouseMode,
+ chr->data.qemuVdagent.mouse);
+ return NULL;
+ }
+ backendType = "qemu-vdagent";
+
+ if (virJSONValueObjectAdd(&backendData,
+ "T:clipboard", chr->data.qemuVdagent.clipboard,
+ "T:mouse", mouse,
+ NULL) < 0)
+ return NULL;
+ break;
+ }
+
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
case VIR_DOMAIN_CHR_TYPE_PIPE:
case VIR_DOMAIN_CHR_TYPE_STDIO:
case VIR_DOMAIN_CHR_TYPE_NMDM:
- case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
virReportError(VIR_ERR_OPERATION_FAILED,
_("Hotplug unsupported for char device type '%s'"),
virDomainChrTypeToString(chr->type));
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 4a0ccf4b2b..094ebce9c6 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1987,6 +1987,15 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def,
}
break;
+ case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_QEMU_VDAGENT)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("chardev '%s' not supported in this QEMU binary"),
+ virDomainChrTypeToString(def->type));
+ return -1;
+ }
+ break;
+
case VIR_DOMAIN_CHR_TYPE_NULL:
case VIR_DOMAIN_CHR_TYPE_VC:
case VIR_DOMAIN_CHR_TYPE_PTY:
@@ -1997,7 +2006,6 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def,
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
case VIR_DOMAIN_CHR_TYPE_NMDM:
- case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
case VIR_DOMAIN_CHR_TYPE_LAST:
break;
}
diff --git a/tests/qemuxml2argvdata/channel-qemu-vdagent-features.x86_64-latest.args b/tests/qemuxml2argvdata/channel-qemu-vdagent-features.x86_64-latest.args
new file mode 100644
index 0000000000..651246bdfd
--- /dev/null
+++ b/tests/qemuxml2argvdata/channel-qemu-vdagent-features.x86_64-latest.args
@@ -0,0 +1,41 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64 \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-device '{"driver":"virtio-serial-pci","id":"virtio-serial1","bus":"pci.0","addr":"0xa"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
+-chardev qemu-vdagent,id=charchannel0,name=vdagent,clipboard=on,mouse=on \
+-device '{"driver":"virtserialport","bus":"virtio-serial1.0","nr":3,"chardev":"charchannel0","id":"channel0","name":"com.redhat.spice.0"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-vnc 127.0.0.1:3,audiodev=audio1 \
+-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/channel-qemu-vdagent-features.xml b/tests/qemuxml2argvdata/channel-qemu-vdagent-features.xml
new file mode 100644
index 0000000000..2d8afe3d33
--- /dev/null
+++ b/tests/qemuxml2argvdata/channel-qemu-vdagent-features.xml
@@ -0,0 +1,37 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/channel-qemu-vdagent.x86_64-latest.args b/tests/qemuxml2argvdata/channel-qemu-vdagent.x86_64-latest.args
new file mode 100644
index 0000000000..0f49b48ca8
--- /dev/null
+++ b/tests/qemuxml2argvdata/channel-qemu-vdagent.x86_64-latest.args
@@ -0,0 +1,41 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64 \
+-m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-device '{"driver":"virtio-serial-pci","id":"virtio-serial1","bus":"pci.0","addr":"0xa"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
+-chardev qemu-vdagent,id=charchannel0,name=vdagent,clipboard=off,mouse=off \
+-device '{"driver":"virtserialport","bus":"virtio-serial1.0","nr":3,"chardev":"charchannel0","id":"channel0","name":"com.redhat.spice.0"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-vnc 127.0.0.1:3,audiodev=audio1 \
+-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/channel-qemu-vdagent.xml b/tests/qemuxml2argvdata/channel-qemu-vdagent.xml
new file mode 100644
index 0000000000..91a62888df
--- /dev/null
+++ b/tests/qemuxml2argvdata/channel-qemu-vdagent.xml
@@ -0,0 +1,37 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a23a89a506..1d6e03490d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1710,6 +1710,8 @@ mymain(void)
DO_TEST("channel-spicevmc",
QEMU_CAPS_SPICE,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST_CAPS_LATEST("channel-qemu-vdagent");
+ DO_TEST_CAPS_LATEST("channel-qemu-vdagent-features");
DO_TEST("channel-virtio-default",
QEMU_CAPS_SPICE);
DO_TEST_NOCAPS("channel-virtio-unix");
diff --git a/tests/qemuxml2xmloutdata/channel-qemu-vdagent-features.x86_64-latest.xml b/tests/qemuxml2xmloutdata/channel-qemu-vdagent-features.x86_64-latest.xml
new file mode 100644
index 0000000000..66a9135fc7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/channel-qemu-vdagent-features.x86_64-latest.xml
@@ -0,0 +1,58 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ qemu64
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/channel-qemu-vdagent.x86_64-latest.xml b/tests/qemuxml2xmloutdata/channel-qemu-vdagent.x86_64-latest.xml
new file mode 100644
index 0000000000..c85acce85d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/channel-qemu-vdagent.x86_64-latest.xml
@@ -0,0 +1,58 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ qemu64
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 58ee29cd33..518842112e 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1467,6 +1467,8 @@ mymain(void)
QEMU_CAPS_DEVICE_PL011,
QEMU_CAPS_DEVICE_VIRTIO_RNG,
QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST_CAPS_LATEST("channel-qemu-vdagent");
+ DO_TEST_CAPS_LATEST("channel-qemu-vdagent-features");
cleanup:
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)