From 503995c7679cf569927e7de288d7323719006f13 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 14 Dec 2019 16:05:21 +0100 Subject: [PATCH] src/api2/admin/datastore.rs: fix prune worker id --- src/api2/admin/datastore.rs | 10 +++++++--- src/api2/node/tasks.rs | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 6bf6bea8..3869a177 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -330,17 +330,21 @@ fn prune( keep_yearly: param["keep-yearly"].as_u64(), }; + let worker_id = format!("{}_{}_{}", store, backup_type, backup_id); + // We use a WorkerTask just to have a task log, but run synchrounously - let worker = WorkerTask::new("prune", Some(store.to_owned()), "root@pam", true)?; + let worker = WorkerTask::new("prune", Some(worker_id), "root@pam", true)?; let result = try_block! { if !prune_options.keeps_something() { worker.log("No prune selection - keeping all files."); return Ok(()); } else { if dry_run { - worker.log(format!("Testing prune on store {}", store)); + worker.log(format!("Testing prune on store \"{}\" group \"{}/{}\"", + store, backup_type, backup_id)); } else { - worker.log(format!("Starting prune on store {}", store)); + worker.log(format!("Starting prune on store \"{}\" group \"{}/{}\"", + store, backup_type, backup_id)); } } diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs index a764abf1..b725f35d 100644 --- a/src/api2/node/tasks.rs +++ b/src/api2/node/tasks.rs @@ -159,10 +159,12 @@ fn list_tasks( None => continue, // skip }; - if info.upid.worker_type == "backup" || info.upid.worker_type == "restore" { + if info.upid.worker_type == "backup" || info.upid.worker_type == "restore" || + info.upid.worker_type == "prune" + { let prefix = format!("{}_", store); if !worker_id.starts_with(&prefix) { continue; } - } else if info.upid.worker_type == "prune" || info.upid.worker_type == "garbage_collection" { + } else if info.upid.worker_type == "garbage_collection" { if worker_id != store { continue; } } else { continue; // skip