From: Markus Frank <m.frank@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [qemu-server] fix: do not allow live-migration with clipboard=vnc
Date: Fri, 24 Nov 2023 13:32:38 +0100 [thread overview]
Message-ID: <20231124123238.169891-1-m.frank@proxmox.com> (raw)
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
next reply other threads:[~2023-11-24 12:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 12:32 Markus Frank [this message]
2023-11-29 9:31 ` [pve-devel] applied: " Fiona Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231124123238.169891-1-m.frank@proxmox.com \
--to=m.frank@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.