[pve-devel] [PATCH manager 1/4] remove all stale replicated volumes
Fabian Ebner
f.ebner at proxmox.com
Thu Oct 1 13:15:32 CEST 2020
Commit 0433b86df6dfdf1d64ee09322719a02a91690707 introduced a
regression where only stale replicated volumes with a snapshot with
an older timestamp would be cleaned up. This restores the previous
behavior where all stale replicated volumes, i.e. those with a
replication snapshot, but not present in $wanted_volids, are cleaned up.
Before this patch, after removing a volume from the guest config,
it would only be cleaned up the second time the replication ran afterwards.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/CLI/pvesr.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/PVE/CLI/pvesr.pm b/PVE/CLI/pvesr.pm
index cb79e2bf..1f175470 100644
--- a/PVE/CLI/pvesr.pm
+++ b/PVE/CLI/pvesr.pm
@@ -137,8 +137,9 @@ __PACKAGE__->register_method ({
push @$volids, map { $_->{volid} } @$images;
}
my ($last_snapshots, $cleaned_replicated_volumes) = PVE::Replication::prepare($storecfg, $volids, $jobid, $last_sync, $parent_snapname, $logfunc);
- foreach my $volid (keys %$cleaned_replicated_volumes) {
- if (!$wanted_volids->{$volid}) {
+ foreach my $volid (@{$volids}) {
+ if (($last_snapshots->{$volid} || $cleaned_replicated_volumes->{$volid})
+ && !$wanted_volids->{$volid}) {
$logfunc->("$jobid: delete stale volume '$volid'");
PVE::Storage::vdisk_free($storecfg, $volid);
delete $last_snapshots->{$volid};
--
2.20.1
More information about the pve-devel
mailing list