[pve-devel] [PATCH 14/19] phase3_cleanup: add targetvmid

Alexandre Derumier aderumier at odiso.com
Wed Feb 22 14:33:38 CET 2017


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuMigrate.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 67f7cd1..35b752e 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -940,6 +940,9 @@ sub phase3 {
 sub phase3_cleanup {
     my ($self, $vmid, $err) = @_;
 
+    my $targetvmid = $vmid;
+    $targetvmid = $self->{opts}->{targetvmid} if $self->{opts}->{targetvmid};
+
     my $conf = $self->{vmconf};
     return if $self->{phase2errors};
 
@@ -972,7 +975,7 @@ sub phase3_cleanup {
 
     if ($self->{livemigration}) {
 	# now that config file is move, we can resume vm on target if livemigrate
-	my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $vmid, '--skiplock', '--nocheck'];
+	my $cmd = [@{$self->{rem_ssh}}, 'qm', 'resume', $targetvmid, '--skiplock', '--nocheck'];
 	eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, 
 		errfunc => sub {
 		    my $line = shift;
@@ -1030,7 +1033,7 @@ sub phase3_cleanup {
 	}
 
 	#stop nbd server to remote vm
-	my $cmd = [@{$self->{rem_ssh}}, 'qm', 'nbdstop', $vmid];
+	my $cmd = [@{$self->{rem_ssh}}, 'qm', 'nbdstop', $targetvmid];
 
 	eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) };
 	if (my $err = $@) {
@@ -1040,7 +1043,7 @@ sub phase3_cleanup {
     }
 
     # clear migrate lock
-    my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
+    my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $targetvmid ];
     $self->cmd_logerr($cmd, errmsg => "failed to clear migrate lock");
 }
 
-- 
2.1.4




More information about the pve-devel mailing list