put target vm in singlestep mode and resume it only when config is moved

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2012-08-21 12:21:53 +02:00 committed by Dietmar Maurer
parent d691e6d3ec
commit b67900f17a
2 changed files with 14 additions and 0 deletions

View File

@ -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 = $@) {

View File

@ -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"};