public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard
@ 2023-11-14  9:22 Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt Markus Frank
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

overall changes v11:
* renamed vnc-clipboard to clipboard and changed it to a string

overall changes v9:
* renamed vnc_clipboard to vnc-clipboard


qemu-server:

changes v14:
* removed trailing spaces

changes v10:
* separated "vnc-clipboard return at status/current" to its own patch
* added missing trailing comma
* changed capitalization

changes v8:
* removed unnecessary conditions
* removed spicedevices variable and changed back to devices
* created is_spice variable

changes v6:
* added check if vga->type is set to prevent error when using default display
* renamed clipboard to vnc_clipboard

changes v5:
* removed return of regex check in the assertion-function for the clipboard config
* moved clipboard code into spice-if-block

changes v4:
* removed duplicate code and created a spicedevices variable to store
spice/vdagent devices.
* clipboard_check_compatibility function

changes v3:
* added hint to make clearer that the spice guest tools are required for
 the noVNC-clipboard
* Checkbox changes to ComboBox when a spice device is selected to make
 clear that only one clipboard can be used at a time.
* added 2 test-cases

changes v2:
* added pci address to virtio-serial-pci

Markus Frank (3):
  enable VNC clipboard parameter in vga_fmt
  add clipboard variable to return at status/current
  test cases for clipboard spice & std

 PVE/API2/Qemu.pm                          | 15 ++++++
 PVE/QemuServer.pm                         | 66 ++++++++++++++++-------
 test/cfg2cmd/VNC-clipboard-spice.conf     |  1 +
 test/cfg2cmd/VNC-clipboard-spice.conf.cmd | 27 ++++++++++
 test/cfg2cmd/VNC-clipboard-std.conf       |  1 +
 test/cfg2cmd/VNC-clipboard-std.conf.cmd   | 27 ++++++++++
 6 files changed, 119 insertions(+), 18 deletions(-)
 create mode 100644 test/cfg2cmd/VNC-clipboard-spice.conf
 create mode 100644 test/cfg2cmd/VNC-clipboard-spice.conf.cmd
 create mode 100644 test/cfg2cmd/VNC-clipboard-std.conf
 create mode 100644 test/cfg2cmd/VNC-clipboard-std.conf.cmd


novnc:

v12:
* forgot to update novnc patch in v11

Markus Frank (1):
  add "show clipboard button" patch to series

 .../patches/0019-show-clipboard-button.patch  | 30 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 debian/patches/0019-show-clipboard-button.patch


manager:

changes v14:
* added gettext for hints
* made change listener function shorter

changes v13:
* send "delete: vga" if print_property_string returns empty string.
* shows a hint for the default & vnc clipboard

changes v11:
* added hint that SPICE & VNC Clipboard won't work at the same time.

changes v7:
* fixed the empty Display Bug in VGA options found by Friedrich
 (it should be "Default" instead of empty) 

changes v6:
* Changed onGetValues in DisplayEdit to only set the saved vnc_clipboard
variable, so it's possible to reset type and memory to default values

changes v4:
* moved clipboard option from Display settings in Hardware to Options

Markus Frank (1):
  add clipboard checkbox to VM Options

 www/manager6/qemu/DisplayEdit.js |  8 ++++
 www/manager6/qemu/Options.js     | 82 ++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)


docs:

changes v4:
* rewrote entire Text
* added command example to set clipboard to 1

Markus Frank (1):
  add VNC clipboard documentation

 qm.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

-- 
2.39.2





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

* [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  2023-11-20 15:37   ` [pve-devel] partially-applied-series: " Thomas Lamprecht
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 2/6] add clipboard variable to return at status/current Markus Frank
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

add option to use the qemu vdagent implementation to enable the VNC
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 on the guest.

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/API2/Qemu.pm  |  7 +++++
 PVE/QemuServer.pm | 66 ++++++++++++++++++++++++++++++++++-------------
 2 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 38bdaab..0177489 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1035,6 +1035,9 @@ __PACKAGE__->register_method({
 			$conf->{boot} = PVE::QemuServer::print_bootorder($devs);
 		    }
 
+		    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
+		    PVE::QemuServer::assert_clipboard_config($vga);
+
 		    # auto generate uuid if user did not specify smbios1 option
 		    if (!$conf->{smbios1}) {
 			$conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid();
@@ -1857,6 +1860,10 @@ my $update_vm_api  = sub {
 			die "only root can modify '$opt' config for real devices\n";
 		    }
 		    $conf->{pending}->{$opt} = $param->{$opt};
+		} elsif ($opt eq 'vga') {
+		    my $vga = PVE::QemuServer::parse_vga($param->{$opt});
+		    PVE::QemuServer::assert_clipboard_config($vga);
+		    $conf->{pending}->{$opt} = $param->{$opt};
 		} elsif ($opt =~ m/^usb\d+/) {
 		    if (my $olddevice = $conf->{$opt}) {
 			check_usb_perm($rpcenv, $authuser, $vmid, undef, $opt, $conf->{$opt});
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c465fb6..e9d0a94 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -199,6 +199,13 @@ my $vga_fmt = {
 	minimum => 4,
 	maximum => 512,
     },
+    clipboard => {
+	description => 'Enable a specific clipboard. If not set, depending on'
+	    .' the display type the SPICE one will be added.',
+	type => 'string',
+	enum => ['vnc'],
+	optional => 1,
+    },
 };
 
 my $ivshmem_fmt = {
@@ -1342,6 +1349,21 @@ sub pve_verify_hotplug_features {
     die "unable to parse hotplug option\n";
 }
 
+sub assert_clipboard_config {
+    my ($vga) = @_;
+
+    my $clipboard_regex = qr/^(std|cirrus|vmware|virtio|qxl)/;
+
+    if (
+	$vga->{'clipboard'}
+	&& $vga->{'clipboard'} eq 'vnc'
+	&& $vga->{type}
+	&& $vga->{type} !~ $clipboard_regex
+    ) {
+	die "vga type $vga->{type} is not compatible with VNC clipboard\n";
+    }
+}
+
 sub scsi_inquiry {
     my($fh, $noerr) = @_;
 
@@ -3892,7 +3914,10 @@ sub config_to_command {
 
     my $spice_port;
 
-    if ($qxlnum || $vga->{type} =~ /^virtio/) {
+    assert_clipboard_config($vga);
+    my $is_spice = $qxlnum || $vga->{type} =~ /^virtio/;
+
+    if ($is_spice || ($vga->{'clipboard'} && $vga->{'clipboard'} eq 'vnc')) {
 	if ($qxlnum > 1) {
 	    if ($winversion){
 		for (my $i = 1; $i < $qxlnum; $i++){
@@ -3913,29 +3938,34 @@ sub config_to_command {
 
 	my $pciaddr = print_pci_addr("spice", $bridges, $arch, $machine_type);
 
-	my $pfamily = PVE::Tools::get_host_address_family($nodename);
-	my @nodeaddrs = PVE::Tools::getaddrinfo_all('localhost', family => $pfamily);
-	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'} && $vga->{'clipboard'} eq 'vnc') {
+	    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});
-	$spice_port = PVE::Tools::next_spice_port($pfamily, $localhost);
+	if ($is_spice) {
+	    my $pfamily = PVE::Tools::get_host_address_family($nodename);
+	    my @nodeaddrs = PVE::Tools::getaddrinfo_all('localhost', family => $pfamily);
+	    die "failed to get an ip address of type $pfamily for 'localhost'\n" if !@nodeaddrs;
 
-	my $spice_enhancement_str = $conf->{spice_enhancements} // '';
-	my $spice_enhancement = parse_property_string($spice_enhancements_fmt, $spice_enhancement_str);
-	if ($spice_enhancement->{foldersharing}) {
-	    push @$devices, '-chardev', "spiceport,id=foldershare,name=org.spice-space.webdav.0";
-	    push @$devices, '-device', "virtserialport,chardev=foldershare,name=org.spice-space.webdav.0";
-	}
+	    my $localhost = PVE::Network::addr_to_ip($nodeaddrs[0]->{addr});
+	    $spice_port = PVE::Tools::next_spice_port($pfamily, $localhost);
 
-	my $spice_opts = "tls-port=${spice_port},addr=$localhost,tls-ciphers=HIGH,seamless-migration=on";
-	$spice_opts .= ",streaming-video=$spice_enhancement->{videostreaming}"
-	    if $spice_enhancement->{videostreaming};
+	    my $spice_enhancement_str = $conf->{spice_enhancements} // '';
+	    my $spice_enhancement = parse_property_string($spice_enhancements_fmt, $spice_enhancement_str);
+	    if ($spice_enhancement->{foldersharing}) {
+		push @$devices, '-chardev', "spiceport,id=foldershare,name=org.spice-space.webdav.0";
+		push @$devices, '-device', "virtserialport,chardev=foldershare,name=org.spice-space.webdav.0";
+	    }
 
-	push @$devices, '-spice', "$spice_opts";
+	    my $spice_opts = "tls-port=${spice_port},addr=$localhost,tls-ciphers=HIGH,seamless-migration=on";
+	    $spice_opts .= ",streaming-video=$spice_enhancement->{videostreaming}"
+		if $spice_enhancement->{videostreaming};
+	    push @$devices, '-spice', "$spice_opts";
+	}
     }
 
     # enable balloon by default, unless explicitly disabled
-- 
2.39.2





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

* [pve-devel] [PATCH qemu-server v14 2/6] add clipboard variable to return at status/current
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 3/6] test cases for clipboard spice & std Markus Frank
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

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

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/API2/Qemu.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 0177489..2bca07f 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2699,6 +2699,13 @@ __PACKAGE__->register_method({
 		type => 'boolean',
 		optional => 1,
 	    },
+	    clipboard => {
+		description => 'Enable a specific clipboard. If not set, depending on'
+		    .' the display type the SPICE one will be added.',
+		type => 'string',
+		enum => ['vnc'],
+		optional => 1,
+	    },
 	},
     },
     code => sub {
@@ -2717,6 +2724,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.39.2





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

* [pve-devel] [PATCH qemu-server v14 3/6] test cases for clipboard spice & std
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 2/6] add clipboard variable to return at status/current Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH novnc v14 4/6] add "show clipboard button" patch to series Markus Frank
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

add one test case for a spice display and one for std

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 test/cfg2cmd/VNC-clipboard-spice.conf     |  1 +
 test/cfg2cmd/VNC-clipboard-spice.conf.cmd | 27 +++++++++++++++++++++++
 test/cfg2cmd/VNC-clipboard-std.conf       |  1 +
 test/cfg2cmd/VNC-clipboard-std.conf.cmd   | 27 +++++++++++++++++++++++
 4 files changed, 56 insertions(+)
 create mode 100644 test/cfg2cmd/VNC-clipboard-spice.conf
 create mode 100644 test/cfg2cmd/VNC-clipboard-spice.conf.cmd
 create mode 100644 test/cfg2cmd/VNC-clipboard-std.conf
 create mode 100644 test/cfg2cmd/VNC-clipboard-std.conf.cmd

diff --git a/test/cfg2cmd/VNC-clipboard-spice.conf b/test/cfg2cmd/VNC-clipboard-spice.conf
new file mode 100644
index 0000000..54cfa38
--- /dev/null
+++ b/test/cfg2cmd/VNC-clipboard-spice.conf
@@ -0,0 +1 @@
+vga: qxl,clipboard=vnc
diff --git a/test/cfg2cmd/VNC-clipboard-spice.conf.cmd b/test/cfg2cmd/VNC-clipboard-spice.conf.cmd
new file mode 100644
index 0000000..f24cc7f
--- /dev/null
+++ b/test/cfg2cmd/VNC-clipboard-spice.conf.cmd
@@ -0,0 +1,27 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'vm8006,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smp '1,sockets=1,cores=1,maxcpus=1' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 512 \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \
+  -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
+  -device 'qxl-vga,id=vga,max_outputs=4,bus=pci.0,addr=0x2' \
+  -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
+  -chardev 'qemu-vdagent,id=vdagent,name=vdagent,clipboard=on' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -machine 'type=pc+pve0'
diff --git a/test/cfg2cmd/VNC-clipboard-std.conf b/test/cfg2cmd/VNC-clipboard-std.conf
new file mode 100644
index 0000000..a980f42
--- /dev/null
+++ b/test/cfg2cmd/VNC-clipboard-std.conf
@@ -0,0 +1 @@
+vga: std,clipboard=vnc
diff --git a/test/cfg2cmd/VNC-clipboard-std.conf.cmd b/test/cfg2cmd/VNC-clipboard-std.conf.cmd
new file mode 100644
index 0000000..c0c6cd2
--- /dev/null
+++ b/test/cfg2cmd/VNC-clipboard-std.conf.cmd
@@ -0,0 +1,27 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'vm8006,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smp '1,sockets=1,cores=1,maxcpus=1' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 512 \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \
+  -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
+  -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
+  -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
+  -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
+  -chardev 'qemu-vdagent,id=vdagent,name=vdagent,clipboard=on' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -machine 'type=pc+pve0'
-- 
2.39.2





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

* [pve-devel] [PATCH novnc v14 4/6] add "show clipboard button" patch to series
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
                   ` (2 preceding siblings ...)
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 3/6] test cases for clipboard spice & std Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  2023-11-18 16:34   ` [pve-devel] applied: " Thomas Lamprecht
  2023-11-14  9:22 ` [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options Markus Frank
  2023-11-14  9:22 ` [pve-devel] [PATCH docs v14 6/6] add VNC clipboard documentation Markus Frank
  5 siblings, 1 reply; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 .../patches/0019-show-clipboard-button.patch  | 30 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 31 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..b87229e
--- /dev/null
+++ b/debian/patches/0019-show-clipboard-button.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Markus Frank <m.frank@proxmox.com>
+Date: Fri, 28 Oct 2022 13:57:57 +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 | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/app/pve.js b/app/pve.js
+index 287615f..1b98f20 100644
+--- a/app/pve.js
++++ b/app/pve.js
+@@ -411,6 +411,10 @@ PVEUI.prototype = {
+ 			document.getElementById('pve_start_dlg')
+ 			    .classList.add("noVNC_open");
+ 		    }
++		    if (result.data.clipboard === "vnc") {
++			document.getElementById('noVNC_clipboard_button')
++			    .classList.remove('pve_hidden');
++		    }
+ 		},
+ 		failure: function(msg, code) {
+ 		    if (code === 403) {
+-- 
+2.39.2
+
diff --git a/debian/patches/series b/debian/patches/series
index 085e2b4..212add7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,3 +16,4 @@
 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.39.2





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

* [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
                   ` (3 preceding siblings ...)
  2023-11-14  9:22 ` [pve-devel] [PATCH novnc v14 4/6] add "show clipboard button" patch to series Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  2023-11-17 15:07   ` Dominik Csapak
  2023-11-14  9:22 ` [pve-devel] [PATCH docs v14 6/6] add VNC clipboard documentation Markus Frank
  5 siblings, 1 reply; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 www/manager6/qemu/DisplayEdit.js |  8 ++++
 www/manager6/qemu/Options.js     | 82 ++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 9bb1763e..d7cd51a9 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -4,6 +4,9 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
     onlineHelp: 'qm_display',
 
     onGetValues: function(values) {
+	if (typeof this.originalConfig.clipboard !== 'undefined') {
+	    values.clipboard = this.originalConfig.clipboard;
+	}
 	let ret = PVE.Parser.printPropertyString(values, 'type');
 	if (ret === '') {
 	    return { 'delete': 'vga' };
@@ -11,6 +14,11 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 	return { vga: ret };
     },
 
+    onSetValues: function(values) {
+	this.originalConfig = values;
+	return values;
+    },
+
     items: [{
 	name: 'type',
 	xtype: 'proxmoxKVComboBox',
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 7b112400..fd76feb8 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -154,6 +154,88 @@ Ext.define('PVE.qemu.Options', {
 		    },
 		} : undefined,
 	    },
+	    vga: {
+		header: gettext('Clipboard'),
+		defaultValue: false,
+		renderer: function(value) {
+		    let vga = PVE.Parser.parsePropertyString(value, 'type');
+		    if (vga.clipboard) {
+			return vga.clipboard.toUpperCase();
+		    } else {
+			return Proxmox.Utils.defaultText + ' (SPICE)';
+		    }
+		},
+		editor: caps.vms['VM.Config.HWType'] ? {
+		    xtype: 'proxmoxWindowEdit',
+		    subject: gettext('Clipboard'),
+		    onlineHelp: 'qm_display',
+		    items: {
+			xtype: 'pveDisplayInputPanel',
+			referenceHolder: true,
+			items: [
+			    {
+				xtype: 'proxmoxKVComboBox',
+				name: 'clipboard',
+				reference: 'clipboard',
+				itemId: 'clipboardBox',
+				fieldLabel: gettext('Clipboard'),
+				deleteDefaultValue: true,
+				listeners: {
+				    change: function(field, value) {
+					let inputpanel = field.up("inputpanel");
+					let isVnc = value === 'vnc';
+					inputpanel.lookup('vncHint').setVisible(isVnc);
+					inputpanel.lookup('defaultHint').setVisible(!isVnc);
+				    },
+				},
+				value: '__default__',
+				comboItems: [
+				    ['__default__', Proxmox.Utils.defaultText + ' (SPICE)'],
+				    ['vnc', 'VNC'],
+				],
+			    },
+			    {
+				itemId: 'vncHint',
+				name: 'vncHint',
+				reference: 'vncHint',
+				xtype: 'displayfield',
+				userCls: 'pmx-hint',
+				hidden: true,
+				value: gettext('You cannot use the default SPICE clipboard if the VNC Clipboard is selected.')
+				    + ' ' + gettext('VNC Clipboard requires spice-tools installed in the Guest-VM.'),
+			    },
+
+			    {
+				itemId: 'defaultHint',
+				name: 'defaultHint',
+				reference: 'defaultHint',
+				xtype: 'displayfield',
+				userCls: 'pmx-hint',
+				hidden: false,
+				value: gettext('This option depends on your display type.') + ' ' +
+				    gettext('If the display type uses SPICE you are able to use the default SPICE Clipboard.'),
+			    },
+
+			],
+			onGetValues: function(values) {
+			    values = Ext.apply(this.originalConfig, values);
+			    if (values.delete === "clipboard") {
+				delete values.clipboard;
+				delete values.delete;
+			    }
+			    let ret = PVE.Parser.printPropertyString(values, 'type');
+			    if (ret === "") {
+				return { 'delete': "vga" };
+			    }
+			    return { vga: ret };
+			},
+			onSetValues: function(values) {
+			    this.originalConfig = PVE.Parser.parsePropertyString(values.vga, 'type');
+			    return this.originalConfig;
+			},
+		    },
+		} : undefined,
+	    },
 	    hotplug: {
 		header: gettext('Hotplug'),
 		defaultValue: 'disk,network,usb',
-- 
2.39.2





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

* [pve-devel] [PATCH docs v14 6/6] add VNC clipboard documentation
  2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
                   ` (4 preceding siblings ...)
  2023-11-14  9:22 ` [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options Markus Frank
@ 2023-11-14  9:22 ` Markus Frank
  5 siblings, 0 replies; 10+ messages in thread
From: Markus Frank @ 2023-11-14  9:22 UTC (permalink / raw)
  To: pve-devel

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com> 
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 qm.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/qm.adoc b/qm.adoc
index 55a4728..cd0d907 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -817,6 +817,24 @@ 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.
 
+.VNC clipboard
+You can enable the VNC clipboard by setting `clipboard` to `vnc`.
+
+----
+# qm set <vmid> -vga <displaytype>,clipboard=vnc
+----
+
+In order to use the clipboard feature, you must first install the
+SPICE guest tools. On Debian-based distributions, this can be achieved
+by installing `spice-vdagent`. For other Operating Systems search for it
+in the offical repositories or see: https://www.spice-space.org/download.html
+
+Once you have installed the spice guest tools, you can use the VNC clipboard
+function (e.g. in the noVNC console panel). However, if you're using
+SPICE, virtio or virgl, you'll need to choose which clipboard to use.
+This is because the default *SPICE* clipboard will be replaced by the
+*VNC* clipboard, if `clipboard` is set to `vnc`.
+
 [[qm_usb_passthrough]]
 USB Passthrough
 ~~~~~~~~~~~~~~~
-- 
2.39.2





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

* Re: [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options
  2023-11-14  9:22 ` [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options Markus Frank
@ 2023-11-17 15:07   ` Dominik Csapak
  0 siblings, 0 replies; 10+ messages in thread
From: Dominik Csapak @ 2023-11-17 15:07 UTC (permalink / raw)
  To: Proxmox VE development discussion, Markus Frank

one minor nit inline, but not a blocker for me

did not test again, but the changes are small enough imho

aside from that, this patch (and the series since i already
reviewed the previous versions and there did not change anything)

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>

On 11/14/23 10:22, Markus Frank wrote:
> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>   www/manager6/qemu/DisplayEdit.js |  8 ++++
>   www/manager6/qemu/Options.js     | 82 ++++++++++++++++++++++++++++++++
>   2 files changed, 90 insertions(+)
> 
> diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
> index 9bb1763e..d7cd51a9 100644
> --- a/www/manager6/qemu/DisplayEdit.js
> +++ b/www/manager6/qemu/DisplayEdit.js
> @@ -4,6 +4,9 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
>       onlineHelp: 'qm_display',
>   
>       onGetValues: function(values) {
> +	if (typeof this.originalConfig.clipboard !== 'undefined') {
> +	    values.clipboard = this.originalConfig.clipboard;
> +	}
>   	let ret = PVE.Parser.printPropertyString(values, 'type');
>   	if (ret === '') {
>   	    return { 'delete': 'vga' };
> @@ -11,6 +14,11 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
>   	return { vga: ret };
>       },
>   
> +    onSetValues: function(values) {
> +	this.originalConfig = values;
> +	return values;
> +    },
> +
>       items: [{
>   	name: 'type',
>   	xtype: 'proxmoxKVComboBox',
> diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
> index 7b112400..fd76feb8 100644
> --- a/www/manager6/qemu/Options.js
> +++ b/www/manager6/qemu/Options.js
> @@ -154,6 +154,88 @@ Ext.define('PVE.qemu.Options', {
>   		    },
>   		} : undefined,
>   	    },
> +	    vga: {
> +		header: gettext('Clipboard'),
> +		defaultValue: false,
> +		renderer: function(value) {
> +		    let vga = PVE.Parser.parsePropertyString(value, 'type');
> +		    if (vga.clipboard) {
> +			return vga.clipboard.toUpperCase();
> +		    } else {
> +			return Proxmox.Utils.defaultText + ' (SPICE)';
> +		    }
> +		},
> +		editor: caps.vms['VM.Config.HWType'] ? {
> +		    xtype: 'proxmoxWindowEdit',
> +		    subject: gettext('Clipboard'),
> +		    onlineHelp: 'qm_display',
> +		    items: {
> +			xtype: 'pveDisplayInputPanel',
> +			referenceHolder: true,
> +			items: [
> +			    {
> +				xtype: 'proxmoxKVComboBox',
> +				name: 'clipboard',
> +				reference: 'clipboard',
> +				itemId: 'clipboardBox',
> +				fieldLabel: gettext('Clipboard'),
> +				deleteDefaultValue: true,
> +				listeners: {
> +				    change: function(field, value) {
> +					let inputpanel = field.up("inputpanel");
> +					let isVnc = value === 'vnc';
> +					inputpanel.lookup('vncHint').setVisible(isVnc);
> +					inputpanel.lookup('defaultHint').setVisible(!isVnc);
> +				    },
> +				},
> +				value: '__default__',
> +				comboItems: [
> +				    ['__default__', Proxmox.Utils.defaultText + ' (SPICE)'],
> +				    ['vnc', 'VNC'],
> +				],
> +			    },
> +			    {
> +				itemId: 'vncHint',
> +				name: 'vncHint',
> +				reference: 'vncHint',
> +				xtype: 'displayfield',
> +				userCls: 'pmx-hint',
> +				hidden: true,
> +				value: gettext('You cannot use the default SPICE clipboard if the VNC Clipboard is selected.')
> +				    + ' ' + gettext('VNC Clipboard requires spice-tools installed in the Guest-VM.'),
> +			    },

this


> +
> +			    {
> +				itemId: 'defaultHint',
> +				name: 'defaultHint',
> +				reference: 'defaultHint',
> +				xtype: 'displayfield',
> +				userCls: 'pmx-hint',
> +				hidden: false,
> +				value: gettext('This option depends on your display type.') + ' ' +
> +				    gettext('If the display type uses SPICE you are able to use the default SPICE Clipboard.'),
> +			    },

and this should have the same style of line break (iow. + ' ' + ath the end of the first line
or at the beginning of the second one, but noth both ;)

> +
> +			],
> +			onGetValues: function(values) {
> +			    values = Ext.apply(this.originalConfig, values);
> +			    if (values.delete === "clipboard") {
> +				delete values.clipboard;
> +				delete values.delete;
> +			    }
> +			    let ret = PVE.Parser.printPropertyString(values, 'type');
> +			    if (ret === "") {
> +				return { 'delete': "vga" };
> +			    }
> +			    return { vga: ret };
> +			},
> +			onSetValues: function(values) {
> +			    this.originalConfig = PVE.Parser.parsePropertyString(values.vga, 'type');
> +			    return this.originalConfig;
> +			},
> +		    },
> +		} : undefined,
> +	    },
>   	    hotplug: {
>   		header: gettext('Hotplug'),
>   		defaultValue: 'disk,network,usb',





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

* [pve-devel] applied: [PATCH novnc v14 4/6] add "show clipboard button" patch to series
  2023-11-14  9:22 ` [pve-devel] [PATCH novnc v14 4/6] add "show clipboard button" patch to series Markus Frank
@ 2023-11-18 16:34   ` Thomas Lamprecht
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Lamprecht @ 2023-11-18 16:34 UTC (permalink / raw)
  To: Proxmox VE development discussion, Markus Frank

please add some reference for why you do this next time, 

"qemu-server will gain VGA clipboard support so this can be used
for virtual machines too in the future"

could be already enough, as then one knows where to look at for
information about where this is used.


Am 14/11/2023 um 10:22 schrieb Markus Frank:
> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
> Tested-by: Dominik Csapak <d.csapak@proxmox.com>
> Signed-off-by: Markus Frank <m.frank@proxmox.com>

this order is wrong, trailers should only grow downwards, so when you picked
up Dominik's R-b and T-b it should have been added at the end.

> ---
>  .../patches/0019-show-clipboard-button.patch  | 30 +++++++++++++++++++
>  debian/patches/series                         |  1 +
>  2 files changed, 31 insertions(+)
>  create mode 100644 debian/patches/0019-show-clipboard-button.patch
> 
>

applied, thanks!




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

* [pve-devel] partially-applied-series: [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt
  2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt Markus Frank
@ 2023-11-20 15:37   ` Thomas Lamprecht
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Lamprecht @ 2023-11-20 15:37 UTC (permalink / raw)
  To: Proxmox VE development discussion, Markus Frank

Am 14/11/2023 um 10:22 schrieb Markus Frank:
> add option to use the qemu vdagent implementation to enable the VNC
> 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 on the guest.
> 
> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
> Tested-by: Dominik Csapak <d.csapak@proxmox.com>
> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>  PVE/API2/Qemu.pm  |  7 +++++
>  PVE/QemuServer.pm | 66 ++++++++++++++++++++++++++++++++++-------------
>  2 files changed, 55 insertions(+), 18 deletions(-)
> 
>

applied the qemu-server part, with a follow-up to add an actual description to
the cfg2cmd tests, thanks!




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

end of thread, other threads:[~2023-11-20 15:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14  9:22 [pve-devel] [PATCH qemu-server/novnc/manager/docs v14 0/6] Feature VNC-Clipboard Markus Frank
2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 1/6] enable VNC clipboard parameter in vga_fmt Markus Frank
2023-11-20 15:37   ` [pve-devel] partially-applied-series: " Thomas Lamprecht
2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 2/6] add clipboard variable to return at status/current Markus Frank
2023-11-14  9:22 ` [pve-devel] [PATCH qemu-server v14 3/6] test cases for clipboard spice & std Markus Frank
2023-11-14  9:22 ` [pve-devel] [PATCH novnc v14 4/6] add "show clipboard button" patch to series Markus Frank
2023-11-18 16:34   ` [pve-devel] applied: " Thomas Lamprecht
2023-11-14  9:22 ` [pve-devel] [PATCH manager v14 5/6] add clipboard checkbox to VM Options Markus Frank
2023-11-17 15:07   ` Dominik Csapak
2023-11-14  9:22 ` [pve-devel] [PATCH docs v14 6/6] add VNC clipboard documentation 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