[pve-devel] [PATCH v2 qemu-server 08/16] phase2_cleanup: add stop_remote_vm

Alexandre Derumier aderumier at odiso.com
Mon Mar 9 16:24:31 CET 2020


Signed-off-by: Alexandre Derumier <aderumier at 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




More information about the pve-devel mailing list