For secure live migration with local disks via NBD over a unix socket, we have to somehow communicate support for it from the source node to the target node. This is because there can only be one NBD server with either a TCP or Unix socket bound, not both.
The source node passes that information via STDIN after the spice ticket followed by a newline for backwards compatibility. If there is no spice ticket we just pass the newline followed by the 'nbd_protocol_version: <version>' line. For unix socket support we parse the line 'nbd_protocol_version: <version>'. A version >= 1 means unix socket support. We use a fallback to 0 should there be no line containing that pattern which is the case if the source node has an older qemu-server version. Signed-off-by: Mira Limbeck <m.limb...@proxmox.com> --- PVE/API2/Qemu.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 3b61334..8891db9 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2035,10 +2035,17 @@ __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>)) { chomp $line; $spice_ticket = $line; + while (defined(my $line = <STDIN>)) { + chomp $line; + if ($line =~ m/^nbd_protocol_version: (\d+)$/) { + $nbd_protocol_version = $1; + } + } } } @@ -2067,7 +2074,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