mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-11 05:15:41 +00:00
parse nbd_protocol_version if available
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.limbeck@proxmox.com>
This commit is contained in:
parent
eb8cddb55e
commit
c4ac8f713c
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user