From db4b469285cdc09a688685cab77f4e38f91ba5d5 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 27 Oct 2021 13:22:27 +0200 Subject: [PATCH] pbs-datastore: skip protected backups in pruning as a separate keep reason so it will not be calculated for the other reasons Signed-off-by: Dominik Csapak Signed-off-by: Wolfgang Bumiller --- pbs-datastore/src/prune.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pbs-datastore/src/prune.rs b/pbs-datastore/src/prune.rs index 70c3d91c..0eaa8acd 100644 --- a/pbs-datastore/src/prune.rs +++ b/pbs-datastore/src/prune.rs @@ -7,7 +7,7 @@ use pbs_api_types::PruneOptions; use super::BackupInfo; -enum PruneMark { Keep, KeepPartial, Remove } +enum PruneMark { Protected, Keep, KeepPartial, Remove } fn mark_selections Result> ( mark: &mut HashMap, @@ -30,6 +30,10 @@ fn mark_selections Result> ( for info in list { let backup_id = info.backup_dir.relative_path(); if mark.get(&backup_id).is_some() { continue; } + if info.protected { + mark.insert(backup_id, PruneMark::Protected); + continue; + } let sel_id: String = select_id(&info)?; if already_included.contains(&sel_id) { continue; }