Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/QemuMigrate.pm | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 7c610b7..a7d3e48 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -595,14 +595,7 @@ sub phase2_cleanup {
 
     unlock_vm($self, $vmid);
 
-    my $nodename = PVE::INotify::nodename();
-
-    my $cmd = [@{$self->{rem_ssh}}, 'qm', 'stop', $vmid, '--skiplock', 
'--migratedfrom', $nodename];
-    eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) 
};
-    if (my $err = $@) {
-        $self->log('err', $err);
-        $self->{errors} = 1;
-    }
+    stop_remote_vm($self, $vmid);
 
     if ($self->{tunnel}) {
        eval { finish_tunnel($self, $self->{tunnel});  };
@@ -1155,4 +1148,17 @@ sub unlock_vm {
     }
 }
 
+sub stop_remote_vm {
+    my ($self, $vmid) = @_;
+
+    my $nodename = PVE::INotify::nodename();
+
+    my $cmd = [@{$self->{rem_ssh}}, 'qm', 'stop', $vmid, '--skiplock', 
'--migratedfrom', $nodename];
+    eval{ PVE::Tools::run_command($cmd, outfunc => sub {}, errfunc => sub {}) 
};
+    if (my $err = $@) {
+        $self->log('err', $err);
+        $self->{errors} = 1;
+    }
+}
+
 1;
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to