[pve-devel] [PATCH qemu-server 3/3] live-restore: hold 'create' lock during operation

Stefan Reiter s.reiter at proxmox.com
Wed Apr 21 16:25:25 CEST 2021


Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/QemuServer.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index d042a7e..8b9c40d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6376,6 +6376,11 @@ sub restore_proxmox_backup_archive {
 	die $err;
     }
 
+    if ($options->{live}) {
+	# keep lock during live-restore
+	$new_conf_raw .= "\nlock: create";
+    }
+
     PVE::Tools::file_set_contents($conffile, $new_conf_raw);
 
     PVE::Cluster::cfs_update(); # make sure we read new file
@@ -6397,6 +6402,8 @@ sub restore_proxmox_backup_archive {
 	die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
 
 	pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
+
+	PVE::QemuConfig->remove_lock($vmid, "create");
     }
 }
 
-- 
2.20.1






More information about the pve-devel mailing list