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

Alexandre Derumier aderumier at odiso.com
Thu Aug 16 07:25:25 CEST 2012


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 69721fc..6d717c8 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 35489aa..70475a5 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2052,6 +2052,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