For secure live migration with local disks via NBD over a unix socket, we have to somehow communicate from the source node to the target node if it supports it. This is because there can only be one NBD server with exactly one socket bound.
The source node passes that information via STDIN. Support for 'spice_ticket: (...)' is added in addition to 'nbd_protocol_version: <version>'. As old source nodes send the spice ticket without a prefix, we still have to have a fallback for this case. New information should always be passed via a prefix that is matched, otherwise it will be recognized as spice ticket. Signed-off-by: Mira Limbeck <m.limb...@proxmox.com> --- v2: - added 'spice_ticket: (...)' variant with fallback for older versions PVE/API2/Qemu.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 21a0eae..fa8315e 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2072,10 +2072,18 @@ __PACKAGE__->register_method({ # read spice ticket from STDIN my $spice_ticket; + my $nbd_protocol_version = 0; if ($stateuri && ($stateuri eq 'tcp' || $stateuri eq 'unix') && $migratedfrom && ($rpcenv->{type} eq 'cli')) { - if (defined(my $line = <STDIN>)) { + while (defined(my $line = <STDIN>)) { chomp $line; - $spice_ticket = $line; + if ($line =~ m/^spice_ticket: (.+)$/) { + $spice_ticket = $1; + } elsif ($line =~ m/^nbd_protocol_version: (\d+)$/) { + $nbd_protocol_version = $1; + } else { + # fallback for old source node + $spice_ticket = $line; + } } } @@ -2104,7 +2112,8 @@ __PACKAGE__->register_method({ syslog('info', "start VM $vmid: $upid\n"); PVE::QemuServer::vm_start($storecfg, $vmid, $stateuri, $skiplock, $migratedfrom, undef, $machine, - $spice_ticket, $migration_network, $migration_type, $targetstorage, $timeout); + $spice_ticket, $migration_network, $migration_type, $targetstorage, $timeout, + $nbd_protocol_version); return; }; -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel