]> git.proxmox.com Git - pve-guest-common.git/commitdiff
Make rollback compatible with storage replica.
authorWolfgang Link <w.link@proxmox.com>
Mon, 12 Jun 2017 08:38:20 +0000 (10:38 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 12 Jun 2017 08:54:33 +0000 (10:54 +0200)
If we rollback we have to clean up all local replication snapshots.

PVE/AbstractConfig.pm

index 08cbb6a43fc4e198d0e54f7fb41ab98a20966161..f4c8c4e5efa5e85d7b34754ce9a23c05c0f3019f 100644 (file)
@@ -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 (jobid => undef)
+       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 {