migration: do not allow live-migration with clipboard=vnc

It is not yet supported for QEMU's vdagent device which is used for
the VNC clipboard.

The migration precondition API call will now treat the VNC clipboard
as a local resource. Thus the GUI blocks migration and shows:
"Can't migrate VM with local resources: clipboard=vnc"

QemuMigrate's prepare function will also abort live migration early
when using the VNC clipboard.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
[FE: adapt commit message a bit]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Markus Frank 2023-11-24 13:32:38 +01:00 committed by Fiona Ebner
parent d440f52417
commit bb30eedfc6
2 changed files with 10 additions and 0 deletions

View File

@ -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}) {

View File

@ -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 = {};