server/prune_job: add 'keep_all' logic to 'prune_datastore'

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-07-16 10:53:24 +02:00 committed by Dietmar Maurer
parent 61f05679d2
commit 0052dc6d28

View File

@ -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,
"{} {}/{}/{}",