src/api2/admin/datastore.rs: fix prune worker id
This commit is contained in:
parent
e1c356ec06
commit
503995c767
|
@ -330,17 +330,21 @@ fn prune(
|
||||||
keep_yearly: param["keep-yearly"].as_u64(),
|
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
|
// 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! {
|
let result = try_block! {
|
||||||
if !prune_options.keeps_something() {
|
if !prune_options.keeps_something() {
|
||||||
worker.log("No prune selection - keeping all files.");
|
worker.log("No prune selection - keeping all files.");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else {
|
} else {
|
||||||
if dry_run {
|
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 {
|
} else {
|
||||||
worker.log(format!("Starting prune on store {}", store));
|
worker.log(format!("Starting prune on store \"{}\" group \"{}/{}\"",
|
||||||
|
store, backup_type, backup_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,10 +159,12 @@ fn list_tasks(
|
||||||
None => continue, // skip
|
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);
|
let prefix = format!("{}_", store);
|
||||||
if !worker_id.starts_with(&prefix) { continue; }
|
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; }
|
if worker_id != store { continue; }
|
||||||
} else {
|
} else {
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
Loading…
Reference in New Issue