From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
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 fcd14162bc9a..a8777acf9ea8 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4034,6 +4034,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 45bbed8dcced..3d89fed72e2d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12911,6 +12911,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;
}
@@ -26688,7 +26695,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) {
@@ -26708,6 +26715,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 ff765e4cc282..676d2893913e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1924,6 +1924,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 e3bcd49c810f..f9eb4052517b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -386,6 +386,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