From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 61BB69D9BD for ; Fri, 24 Nov 2023 13:32:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3E847F20C for ; Fri, 24 Nov 2023 13:32:50 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 24 Nov 2023 13:32:49 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 02C6343B73 for ; Fri, 24 Nov 2023 13:32:49 +0100 (CET) From: Markus Frank To: pve-devel@lists.proxmox.com Date: Fri, 24 Nov 2023 13:32:38 +0100 Message-Id: <20231124123238.169891-1-m.frank@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.036 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemumigrate.pm, qemu.pm] Subject: [pve-devel] [qemu-server] fix: do not allow live-migration with clipboard=vnc X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2023 12:32:50 -0000 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 --- 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