[pve-devel] [PATCH storage 3/6] prune mark: preserve additional information for the keep-all case

Fabian Ebner f.ebner at proxmox.com
Fri Sep 17 15:02:23 CEST 2021


Currently, if an entry is already marked as 'protected'.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

This makes adding the test in the next patch much simpler, because
the expected mark of a protected backup can be hardcoded as
'protected'. But even without that, it makes sense to preserve the
more specific mark.

 PVE/Storage.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 729c90e..e7d8e62 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1670,6 +1670,8 @@ sub prune_mark_backup_group {
 
     if ($keep->{'keep-all'} || scalar(@positive_opts) == 0) {
 	foreach my $prune_entry (@{$backup_group}) {
+	    # preserve additional information like 'protected'
+	    next if $prune_entry->{mark} && $prune_entry->{mark} ne 'remove';
 	    $prune_entry->{mark} = 'keep';
 	}
 	return;
-- 
2.30.2






More information about the pve-devel mailing list