public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt
@ 2022-09-07  9:17 Markus Frank
  2022-09-07  9:17 ` [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current Markus Frank
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Markus Frank @ 2022-09-07  9:17 UTC (permalink / raw)
  To: pve-devel

added Options to use the qemu vdagent implementation to enable the noVNC clipboard.
When enabled with SPICE the spice-vdagent gets replaced with the qemu
implementation.

This patch does not solve #1406, but does allow copy and paste with
a running X-session, when spice-vdagent is installed.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
The alternative to replacing spicevmc would be to only allow noVNC
clipboard if no SPICE is running, because qemu cannot use the same
virtserialport twice. This alternative would also disable the ability
to use the noVNC clipboard with VirtIO/VirGL.

 PVE/QemuServer.pm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c706653..636de2f 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -190,6 +190,12 @@ my $vga_fmt = {
 	minimum => 4,
 	maximum => 512,
     },
+    clipboard => {
+	description => "enable clipboard (requires spice-vdagent)",
+	type => 'boolean',
+	optional => 1,
+	default => 0
+    }
 };
 
 my $ivshmem_fmt = {
@@ -3836,6 +3842,12 @@ sub config_to_command {
 	}
     }
 
+    if ($vga->{clipboard} && $vga->{type} =~ /^std|^cirrus|^vmware/) {
+	push @$devices, '-chardev', 'qemu-vdagent,id=vdagent,name=vdagent,clipboard=on';
+	push @$devices, '-device', 'virtio-serial-pci';
+	push @$devices, '-device', 'virtserialport,chardev=vdagent,name=com.redhat.spice.0';
+    }
+
     my $rng = $conf->{rng0} ? parse_rng($conf->{rng0}) : undef;
     if ($rng && $version_guard->(4, 1, 2)) {
 	check_rng_source($rng->{source});
@@ -3880,7 +3892,11 @@ sub config_to_command {
 	die "failed to get an ip address of type $pfamily for 'localhost'\n" if !@nodeaddrs;
 
 	push @$devices, '-device', "virtio-serial,id=spice$pciaddr";
-	push @$devices, '-chardev', "spicevmc,id=vdagent,name=vdagent";
+	if ($vga->{clipboard}) {
+	    push @$devices, '-chardev', 'qemu-vdagent,id=vdagent,name=vdagent,clipboard=on';
+	} else {
+	    push @$devices, '-chardev', "spicevmc,id=vdagent,name=vdagent";
+	}
 	push @$devices, '-device', "virtserialport,chardev=vdagent,name=com.redhat.spice.0";
 
 	my $localhost = PVE::Network::addr_to_ip($nodeaddrs[0]->{addr});
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current
  2022-09-07  9:17 [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt Markus Frank
@ 2022-09-07  9:17 ` Markus Frank
  2022-09-07  9:18 ` [pve-devel] [PATCH novnc 3/5] added show clipboard button patch to series Markus Frank
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Markus Frank @ 2022-09-07  9:17 UTC (permalink / raw)
  To: pve-devel

By that noVNC is able to check if clipboard is active.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/API2/Qemu.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 99b426e..25f3a1d 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2428,6 +2428,11 @@ __PACKAGE__->register_method({
 		type => 'boolean',
 		optional => 1,
 	    },
+	    clipboard => {
+		description => "Qemu clipboard enabled in config.",
+		type => 'boolean',
+		optional => 1,
+	    },
 	},
     },
     code => sub {
@@ -2446,6 +2451,7 @@ __PACKAGE__->register_method({
 	    my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
 	    $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
 	    $status->{spice} = 1 if $spice;
+	    $status->{clipboard} = $vga->{clipboard};
 	}
 	$status->{agent} = 1 if PVE::QemuServer::get_qga_key($conf, 'enabled');
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH novnc 3/5] added show clipboard button patch to series
  2022-09-07  9:17 [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt Markus Frank
  2022-09-07  9:17 ` [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current Markus Frank
@ 2022-09-07  9:18 ` Markus Frank
  2022-09-07  9:18 ` [pve-devel] [PATCH manager 4/5] added clipboard checkbox to DisplayEdit Markus Frank
  2022-09-07  9:18 ` [pve-devel] [PATCH docs 5/5] added noVNC clipboard documentation Markus Frank
  3 siblings, 0 replies; 6+ messages in thread
From: Markus Frank @ 2022-09-07  9:18 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 .../patches/0019-show-clipboard-button.patch  | 31 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 debian/patches/0019-show-clipboard-button.patch

diff --git a/debian/patches/0019-show-clipboard-button.patch b/debian/patches/0019-show-clipboard-button.patch
new file mode 100644
index 0000000..fec35e2
--- /dev/null
+++ b/debian/patches/0019-show-clipboard-button.patch
@@ -0,0 +1,31 @@
+From 3808828104af3383e6d20e90ea47983c5cd70c28 Mon Sep 17 00:00:00 2001
+From: Markus Frank <m.frank@proxmox.com>
+Date: Fri, 2 Sep 2022 14:35:34 +0200
+Subject: [PATCH] show clipboard button
+
+show button when clipboard at status/current is true
+
+Signed-off-by: Markus Frank <m.frank@proxmox.com>
+---
+ app/pve.js | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/app/pve.js b/app/pve.js
+index 3eeaa47..697d059 100644
+--- a/app/pve.js
++++ b/app/pve.js
+@@ -411,6 +411,11 @@ PVEUI.prototype = {
+ 			document.getElementById('pve_start_dlg')
+ 			    .classList.add("noVNC_open");
+ 		    }
++		    let clipboard = result.data.clipboard;
++		    if (clipboard) {
++			document.getElementById('noVNC_clipboard_button')
++			    .classList.remove('pve_hidden');
++		    }
+ 		},
+ 		failure: function(msg) {
+ 		    me.UI.showStatus(msg, 'error');
+-- 
+2.30.2
+
diff --git a/debian/patches/series b/debian/patches/series
index ef9e9df..1eb50db 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,3 +17,4 @@ extra/0001-Ignore-ResizeObserver-errors.patch
 0016-hide-fullscreen-button-on-isFullscreen-get-variable.patch
 0017-make-error-hideable.patch
 0018-show-start-button-on-not-running-vm-ct.patch
+0019-show-clipboard-button.patch
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH manager 4/5] added clipboard checkbox to DisplayEdit
  2022-09-07  9:17 [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt Markus Frank
  2022-09-07  9:17 ` [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current Markus Frank
  2022-09-07  9:18 ` [pve-devel] [PATCH novnc 3/5] added show clipboard button patch to series Markus Frank
@ 2022-09-07  9:18 ` Markus Frank
  2022-09-07  9:18 ` [pve-devel] [PATCH docs 5/5] added noVNC clipboard documentation Markus Frank
  3 siblings, 0 replies; 6+ messages in thread
From: Markus Frank @ 2022-09-07  9:18 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 www/manager6/qemu/DisplayEdit.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 9bb1763e..77434b7e 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -33,7 +33,9 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 		    return;
 		}
 		let memoryfield = this.up('panel').down('field[name=memory]');
+		let clipboardbox = this.up('panel').down('field[name=clipboard]');
 		let disableMemoryField = false;
+		let disableClipboardBox = false;
 
 		if (val === "cirrus") {
 		    memoryfield.setEmptyText("4");
@@ -44,11 +46,13 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 		} else if (val.match(/^(serial\d|none)$/)) {
 		    memoryfield.setEmptyText("N/A");
 		    disableMemoryField = true;
+		    disableClipboardBox = true;
 		} else {
 		    console.debug("unexpected display type", val);
 		    memoryfield.setEmptyText(Proxmox.Utils.defaultText);
 		}
 		memoryfield.setDisabled(disableMemoryField);
+		clipboardbox.setDisabled(disableClipboardBox);
 	    },
 	},
     },
@@ -60,6 +64,11 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 	maxValue: 512,
 	step: 4,
 	name: 'memory',
+    },
+    {
+        xtype: 'proxmoxcheckbox',
+        fieldLabel: gettext('noVNC clipboard'),
+        name: 'clipboard',
     }],
 });
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH docs 5/5] added noVNC clipboard documentation
  2022-09-07  9:17 [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt Markus Frank
                   ` (2 preceding siblings ...)
  2022-09-07  9:18 ` [pve-devel] [PATCH manager 4/5] added clipboard checkbox to DisplayEdit Markus Frank
@ 2022-09-07  9:18 ` Markus Frank
  3 siblings, 0 replies; 6+ messages in thread
From: Markus Frank @ 2022-09-07  9:18 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 qm.adoc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/qm.adoc b/qm.adoc
index 4d0c7c4..38bc788 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -693,6 +693,14 @@ Selecting `serialX` as display 'type' disables the VGA output, and redirects
 the Web Console to the selected serial port. A configured display 'memory'
 setting will be ignored in that case.
 
+You can enable the noVNC clipboard by setting 'clipboard' to 1.
+To use this, you need to install and enable spice-vdagent on the VM Guest.
+Doing this will give you the ability to use the clipboard button on the left
+side of the noVNC console. However, when using SPICE, the default SPICE clipboard
+implementation will be replaced by the qemu-vdagent implementation, which means
+you cannot simply copy and paste in a SPICE session and instead need to use the
+noVNC Button.
+
 [[qm_usb_passthrough]]
 USB Passthrough
 ~~~~~~~~~~~~~~~
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current
  2022-10-20 11:14 [pve-devel] [PATCH qemu-server v2 1/5] enable clipboard parameter in vga_fmt Markus Frank
@ 2022-10-20 11:14 ` Markus Frank
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Frank @ 2022-10-20 11:14 UTC (permalink / raw)
  To: pve-devel

By that noVNC is able to check if clipboard is active.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/API2/Qemu.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 99b426e..25f3a1d 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2428,6 +2428,11 @@ __PACKAGE__->register_method({
 		type => 'boolean',
 		optional => 1,
 	    },
+	    clipboard => {
+		description => "Qemu clipboard enabled in config.",
+		type => 'boolean',
+		optional => 1,
+	    },
 	},
     },
     code => sub {
@@ -2446,6 +2451,7 @@ __PACKAGE__->register_method({
 	    my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
 	    $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
 	    $status->{spice} = 1 if $spice;
+	    $status->{clipboard} = $vga->{clipboard};
 	}
 	$status->{agent} = 1 if PVE::QemuServer::get_qga_key($conf, 'enabled');
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-20 11:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  9:17 [pve-devel] [PATCH qemu-server 1/5] enable clipboard parameter in vga_fmt Markus Frank
2022-09-07  9:17 ` [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current Markus Frank
2022-09-07  9:18 ` [pve-devel] [PATCH novnc 3/5] added show clipboard button patch to series Markus Frank
2022-09-07  9:18 ` [pve-devel] [PATCH manager 4/5] added clipboard checkbox to DisplayEdit Markus Frank
2022-09-07  9:18 ` [pve-devel] [PATCH docs 5/5] added noVNC clipboard documentation Markus Frank
2022-10-20 11:14 [pve-devel] [PATCH qemu-server v2 1/5] enable clipboard parameter in vga_fmt Markus Frank
2022-10-20 11:14 ` [pve-devel] [PATCH qemu-server 2/5] added clipboard variable to return at status/current Markus Frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal