[pve-devel] [qemu-server] fix: do not allow live-migration with clipboard=vnc
Markus Frank
m.frank at proxmox.com
Fri Nov 24 13:32:38 CET 2023
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 at 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
More information about the pve-devel
mailing list