[pve-devel] [PATCH pve-guest-common] Make rollback compatible with storage replica.

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


If we rollback we have to clean up all local replication snapshots.
---
 PVE/AbstractConfig.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
index 08cbb6a..9e2165d 100644
--- a/PVE/AbstractConfig.pm
+++ b/PVE/AbstractConfig.pm
@@ -592,6 +592,17 @@ sub snapshot_rollback {
 	return $res;
     };
 
+    my $repl_conf = PVE::ReplicationConfig->new();
+    if ($repl_conf->check_for_existing_jobs($vmid, 1)) {
+	# remove all replication snapshots
+	my $volumes = $class->get_replicatable_volumes($storecfg, $conf, 1);
+	my $sorted_volids = [ sort keys %$volumes ];
+
+	# remove all local replication snapshots (lastsync => 0)
+	my $logfunc = sub { my $line = shift; chomp $line; print "$line\n"; };
+	PVE::Replication::prepare($storecfg, $sorted_volids, undef, 0, undef, $logfunc);
+    }
+    
     my $snap = &$get_snapshot_config();
 
     $class->__snapshot_foreach_volume($snap, sub {
-- 
2.11.0





More information about the pve-devel mailing list