[pve-devel] [PATCH 5/5] put target vm in singlestep mode and resume it only when config is moved

Alexandre Derumier aderumier at odiso.com
Mon Aug 13 16:41:15 CEST 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuMigrate.pm |    7 ++++++-
 PVE/QemuServer.pm  |    2 ++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index e002848..ee57cc2 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -416,6 +416,11 @@ 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
+     my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock'];
+     $self->cmd_logerr($cmd, errmsg => "failed to resume target vm");
+
+
     # always stop local VM
     eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); };
     if (my $err = $@) {
@@ -442,7 +447,7 @@ sub phase3_cleanup {
     }
 
     # clear migrate lock
-    my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
+    $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
     $self->cmd_logerr($cmd, errmsg => "failed to clear migrate lock");
 }
 
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 06554fc..73eb2dc 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2059,6 +2059,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"};
-- 
1.7.2.5




More information about the pve-devel mailing list