[pve-devel] [PATCH qemu-server 07/15] phase2_cleanup: add unlock_vm

Alexandre Derumier aderumier at odiso.com
Mon Apr 29 12:01:22 CEST 2019


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index ac2da62..414686f 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -563,14 +563,9 @@ sub phase2_cleanup {
     $self->log('info', "aborting phase 2 - cleanup resources");
 
     cancel_migrate($self, $vmid);
-    
-    my $conf = $self->{vmconf};
-    delete $conf->{lock};
-    eval { PVE::QemuConfig->write_config($vmid, $conf) };
-    if (my $err = $@) {
-        $self->log('err', $err);
-    }
 
+    unlock_vm($self, $vmid);
+        
     # cleanup ressources on target host
     if ($self->{storage_migration}) {
 
@@ -1125,4 +1120,15 @@ sub cancel_migrate {
     }
 }
 
+sub unlock_vm {
+    my ($self, $vmid) = @_;
+
+    my $conf = $self->{vmconf};
+    delete $conf->{lock};
+    eval { PVE::QemuConfig->write_config($vmid, $conf) };
+    if (my $err = $@) {
+        $self->log('err', $err);
+    }
+}
+
 1;
-- 
2.11.0




More information about the pve-devel mailing list