[pbs-devel] [PATCH proxmox-backup 07/11] server/prune_job: add 'keep_all' logic to 'prune_datastore'

Dominik Csapak d.csapak at proxmox.com
Fri Jul 16 10:53:24 CEST 2021


it is the same as when pruning single groups.
for prune_jobs, we never start the worker if there is no prune option set.
but if we want to call 'prune_datastore' from somewhere else, we
have to check it here again

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/server/prune_job.rs | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/server/prune_job.rs b/src/server/prune_job.rs
index 7ea42fcb..40ed555f 100644
--- a/src/server/prune_job.rs
+++ b/src/server/prune_job.rs
@@ -19,11 +19,17 @@ pub fn prune_datastore(
 ) -> Result<(), Error> {
     task_log!(worker, "Starting datastore prune on store \"{}\"", store);
 
-    task_log!(
-        worker,
-        "retention options: {}",
-        prune_options.cli_options_string()
-    );
+    let keep_all = !prune_options.keeps_something();
+
+    if keep_all {
+        task_log!(worker, "No prune selection - keeping all files.");
+    } else {
+        task_log!(
+            worker,
+            "retention options: {}",
+            prune_options.cli_options_string()
+        );
+    }
 
     let base_path = datastore.base_path();
 
@@ -41,7 +47,8 @@ pub fn prune_datastore(
             group.backup_id()
         );
 
-        for (info, keep) in prune_info {
+        for (info, mut keep) in prune_info {
+            if keep_all { keep = true; }
             task_log!(
                 worker,
                 "{} {}/{}/{}",
-- 
2.30.2






More information about the pbs-devel mailing list