[pve-devel] [PATCH pve-container] Add a migration lock to avoid a replication on rollback-time.

Wolfgang Link w.link at proxmox.com
Mon Jun 12 10:38:21 CEST 2017


---
 src/PVE/API2/LXC/Snapshot.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC/Snapshot.pm b/src/PVE/API2/LXC/Snapshot.pm
index d3c1d8e..47da325 100644
--- a/src/PVE/API2/LXC/Snapshot.pm
+++ b/src/PVE/API2/LXC/Snapshot.pm
@@ -257,7 +257,13 @@ __PACKAGE__->register_method({
 	    PVE::LXC::Config->snapshot_rollback($vmid, $snapname);
 	};
 
-	return $rpcenv->fork_worker('vzrollback', $vmid, $authuser, $realcmd);
+	
+	my $worker = sub {
+	    # hold migration lock, this makes sure that nobody create replication snapshots
+	    return PVE::GuestHelpers::guest_migration_lock($vmid, 10, $realcmd);
+	};
+
+	return $rpcenv->fork_worker('vzrollback', $vmid, $authuser, $worker);
     }});
 
 __PACKAGE__->register_method({
-- 
2.11.0





More information about the pve-devel mailing list