public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [qemu-server] fix: do not allow live-migration with clipboard=vnc
@ 2023-11-24 12:32 Markus Frank
  2023-11-29  9:31 ` [pve-devel] applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Frank @ 2023-11-24 12:32 UTC (permalink / raw)
  To: pve-devel

In the migrate_vm_precondition API function if clipboard
is set to vnc on a running VM the text "clipboard=vnc"
gets added to local_resources so that the GUI blocks execution and shows:
"Can't migrate VM with local resources: clipboard=vnc"

In QemuMigrate's prepare function a new 'die' prevents a
live-migration if a running VMs has clipboard set to vnc.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/API2/Qemu.pm   | 5 +++++
 PVE/QemuMigrate.pm | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index f5bff53..f26adf5 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -4376,6 +4376,11 @@ __PACKAGE__->register_method({
 	    PVE::QemuServer::check_local_resources($vmconf, 1);
 	delete $missing_mappings_by_node->{$localnode};
 
+	my $vga = PVE::QemuServer::parse_vga($vmconf->{vga});
+	if ($res->{running} && $vga->{'clipboard'} && $vga->{'clipboard'} eq 'vnc') {
+	    push $local_resources->@*, "clipboard=vnc";
+	}
+
 	# if vm is not running, return target nodes where local storage/mapped devices are available
 	# for offline migration
 	if (!$res->{running}) {
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index f30ce9f..b87e47a 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -255,6 +255,11 @@ sub prepare {
 	}
     }
 
+    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
+    if ($running && $vga->{'clipboard'} && $vga->{'clipboard'} eq 'vnc') {
+	die "VMs with 'clipboard' set to 'vnc' are not live migratable!\n";
+    }
+
     my $vollist = PVE::QemuServer::get_vm_volumes($conf);
 
     my $storages = {};
-- 
2.39.2





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

end of thread, other threads:[~2023-11-29  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-24 12:32 [pve-devel] [qemu-server] fix: do not allow live-migration with clipboard=vnc Markus Frank
2023-11-29  9:31 ` [pve-devel] applied: " Fiona Ebner

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