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

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


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index ff942bb..7c610b7 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -593,6 +593,8 @@ sub phase2_cleanup {
 	}
     }
 
+    unlock_vm($self, $vmid);
+
     my $nodename = PVE::INotify::nodename();
 
     my $cmd = [@{$self->{rem_ssh}}, 'qm', 'stop', $vmid, '--skiplock', '--migratedfrom', $nodename];
@@ -1142,4 +1144,15 @@ sub cancel_migrate {
     $self->log('info', "migrate_cancel error: $@") if $@;
 }
 
+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.20.1




More information about the pve-devel mailing list