diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 69721fc6..6d717c8f 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -416,6 +416,18 @@ sub phase3_cleanup { die "Failed to move config to node '$self->{node}' - rename failed: $!\n" if !rename($conffile, $newconffile); + ## now that config file is move, we can resume vm on target if livemigrate + if ($self->{tunnel}) { + + my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock']; + eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) }; + if (my $err = $@) { + $self->log('err', $err); + $self->{errors} = 1; + } + } + + # always stop local VM eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); }; if (my $err = $@) { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 2a37e879..db8da387 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2037,6 +2037,8 @@ sub config_to_command { push @$cmd, '-incoming', $migrate_uri if $migrate_uri; + push @$cmd, '-S' if $migrate_uri; + my $use_usb2 = 0; for (my $i = 0; $i < $MAX_USB_DEVICES; $i++) { next if !$conf->{"usb$i"};