[pve-devel] [PATCH v2 manager 1/5] vzdump: skip protected backups for dumpdir pruning
    Fabian Ebner 
    f.ebner at proxmox.com
       
    Thu Sep 30 13:42:11 CEST 2021
    
    
  
Keeps the behavior consistent with what happens for storages. It also
is required to not get into conflict with the check in archive_remove,
i.e. pruning here marks a backup as 'remove' and then archive_remove
complains that it's protected.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
No changes from v1.
Dependency bump for pve-storage needed.
 PVE/VZDump.pm | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index d00be8b2..a5a956c8 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -992,6 +992,13 @@ sub exec_backup_task {
 	    my $pruned = 0;
 	    if (!defined($opts->{storage})) {
 		my $bklist = get_backup_file_list($opts->{dumpdir}, $bkname);
+
+		for my $prune_entry ($bklist->@*) {
+		    if (-e PVE::Storage::protection_file_path($prune_entry->{path})) {
+			$prune_entry->{mark} = 'protected';
+		    }
+		}
+
 		PVE::Storage::prune_mark_backup_group($bklist, $prune_options);
 
 		foreach my $prune_entry (@{$bklist}) {
-- 
2.30.2
    
    
More information about the pve-devel
mailing list