From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- docs/schemas/domaincommon.rng | 8 +++++ src/conf/domain_conf.c | 13 ++++++- src/conf/domain_conf.h | 1 + .../graphics-dbus-clipboard.xml | 35 +++++++++++++++++++ .../graphics-dbus-clipboard.xml | 1 + tests/qemuxml2xmltest.c | 3 ++ 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/graphics-dbus-clipboard.xml create mode 120000 tests/qemuxml2xmloutdata/graphics-dbus-clipboard.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5938f0d5acd3..213e1a07c0e8 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4039,6 +4039,14 @@ </attribute> </element> </optional> + <optional> + <element name="clipboard"> + <attribute name="copypaste"> + <ref name="virYesNo"/> + </attribute> + <empty/> + </element> + </optional> </interleave> </group> <group> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 791df66ff024..99cf63c1bc55 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12918,6 +12918,13 @@ virDomainGraphicsDefParseXMLDBus(virDomainGraphicsDef *def, return -1; } + if ((cur = virXPathNode("./clipboard", ctxt))) { + if (virXMLPropTristateBool(cur, "copypaste", + VIR_XML_PROP_REQUIRED, + &def->data.dbus.copypaste) < 0) + return -1; + } + return 0; } @@ -26766,7 +26773,7 @@ virDomainGraphicsDefFormat(virBuffer *buf, virBufferAsprintf(buf, " address='%s'", def->data.dbus.address); - if (!def->data.dbus.gl && def->data.dbus.audioId <= 0) + if (!def->data.dbus.gl && def->data.dbus.audioId <= 0 && !def->data.dbus.copypaste) break; if (!children) { @@ -26786,6 +26793,10 @@ virDomainGraphicsDefFormat(virBuffer *buf, virBufferAsprintf(buf, "<audio id='%d'/>\n", def->data.dbus.audioId); + if (def->data.dbus.copypaste) + virBufferAsprintf(buf, "<clipboard copypaste='%s'/>\n", + virTristateBoolTypeToString(def->data.dbus.copypaste)); + break; case VIR_DOMAIN_GRAPHICS_TYPE_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f15917c49500..a94a9f5d816e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1932,6 +1932,7 @@ struct _virDomainGraphicsDef { char *rendernode; virTristateBool gl; unsigned int audioId; + virTristateBool copypaste; bool fromConfig; /* true if the @address is config file originated */ } dbus; } data; diff --git a/tests/qemuxml2argvdata/graphics-dbus-clipboard.xml b/tests/qemuxml2argvdata/graphics-dbus-clipboard.xml new file mode 100644 index 000000000000..46ba6abb58bc --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-dbus-clipboard.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</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-system-i386</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='dbus'> + <clipboard copypaste='yes'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/graphics-dbus-clipboard.xml b/tests/qemuxml2xmloutdata/graphics-dbus-clipboard.xml new file mode 120000 index 000000000000..a4dc520711ad --- /dev/null +++ b/tests/qemuxml2xmloutdata/graphics-dbus-clipboard.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/graphics-dbus-clipboard.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 276cb8bcc274..4fcf5129c57e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -387,6 +387,9 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_DISPLAY_DBUS, QEMU_CAPS_AUDIODEV); + DO_TEST("graphics-dbus-clipboard", + QEMU_CAPS_DEVICE_CIRRUS_VGA, + QEMU_CAPS_DISPLAY_DBUS); DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64"); DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64"); -- 2.34.1.8.g35151cf07204