This allows support for host/guest clipboard sharing when using vnc guests (and possibly other graphics types in the future). This channel is similar to the spicevmc channel, but it contains a couple additional options to enable/disable clipboard sharing and specify the mouse mode. In the case of spice, these settings are specified on the 'graphics' element, but for qemu-vdagent, they are specified on the channel. For example: --channel=qemu-vdagent,source.clipboard.copypaste=on,source.mouse.mode=client Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> --- man/virt-install.rst | 9 +++++++++ tests/data/cli/compare/virt-install-many-devices.xml | 7 +++++++ tests/test_cli.py | 1 + virtinst/cli.py | 2 ++ virtinst/devices/char.py | 8 +++++++- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/man/virt-install.rst b/man/virt-install.rst index c1d1c1aa..3a6e8dcd 100644 --- a/man/virt-install.rst +++ b/man/virt-install.rst @@ -1761,6 +1761,15 @@ Some of the types of character device redirection are: and can be any string, such as the default com.redhat.spice.0 that specifies how the guest will see the channel. +``--channel qemu-vdagent,target.type=virtio[,target.name=NAME]`` + Communication channel for QEMU vd agent, using virtio serial (requires + 2.6.34 or later host and guest). This allows copy/paste functionality with + VNC guests. Note that the guest clipboard integration is implemented via + spice-vdagent, which must be running even when the guest does not use spice + graphics. NAME is optional metadata that specifies how the guest will see + the channel, and should be left as the default com.redhat.spice.0 unless you + know what you are doing. + Use --channel=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCharChannel diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml index 6068b643..f6606a18 100644 --- a/tests/data/cli/compare/virt-install-many-devices.xml +++ b/tests/data/cli/compare/virt-install-many-devices.xml @@ -647,6 +647,13 @@ <channel type="spicevmc"> <target type="virtio" name="com.redhat.spice.0"/> </channel> + <channel type="qemu-vdagent"> + <source> + <clipboard copypaste="yes"/> + <mouse mode="client"/> + </source> + <target type="virtio" name="com.redhat.spice.0"/> + </channel> <input type="keyboard" bus="usb"/> <input type="tablet" bus="usb"/> <input type="mouse" bus="ps2"/> diff --git a/tests/test_cli.py b/tests/test_cli.py index 6a0df787..153b33fd 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -669,6 +669,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser --channel pty,target_type=virtio,name=org.linux-kvm.port1 --channel pty,target.type=virtio,target.name=org.linux-kvm.port2 --channel spicevmc +--channel qemu-vdagent,source.clipboard.copypaste=on,source.mouse.mode=client --console pty,target_type=virtio diff --git a/virtinst/cli.py b/virtinst/cli.py index 52be9f29..c869c323 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -3396,6 +3396,8 @@ def _add_char_source_args(cls, prefix=""): _add_arg("protocol.type", "source.protocol") _add_arg("log.file", "source.log_file") _add_arg("log.append", "source.log_append", is_onoff=True) + _add_arg("source.clipboard.copypaste", "source.clipboard_copypaste", is_onoff=True) + _add_arg("source.mouse.mode", "source.mouse_mode") ################## diff --git a/virtinst/devices/char.py b/virtinst/devices/char.py index 9547c649..01fc634b 100644 --- a/virtinst/devices/char.py +++ b/virtinst/devices/char.py @@ -45,6 +45,10 @@ class CharSource(XMLBuilder): slave = XMLProperty("./@slave") mode = XMLProperty("./@mode") + # for qemu-vdagent channel + clipboard_copypaste = XMLProperty("./clipboard/@copypaste", is_yesno=True) + mouse_mode = XMLProperty("./mouse/@mode") + # It's weird to track these properties here, since the XML is set on # the parent, but this is how libvirt does it internally, which means # everything that shares a charsource has these values too. @@ -80,6 +84,7 @@ class _DeviceChar(Device): TYPE_SPICEVMC = "spicevmc" TYPE_SPICEPORT = "spiceport" TYPE_NMDM = "nmdm" + TYPE_QEMUVDAGENT = "qemu-vdagent" CHANNEL_NAME_SPICE = "com.redhat.spice.0" CHANNEL_NAME_QEMUGA = "org.qemu.guest_agent.0" @@ -117,7 +122,8 @@ class _DeviceChar(Device): self.source.mode = "bind" if not self.target_type and self.DEVICE_TYPE == "channel": self.target_type = "virtio" - if not self.target_name and self.type == self.TYPE_SPICEVMC: + if not self.target_name and (self.type == self.TYPE_SPICEVMC or + self.type == self.TYPE_QEMUVDAGENT): self.target_name = self.CHANNEL_NAME_SPICE -- 2.35.3