api: config: delete datastore: also remove tape backup jobs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-07-08 12:13:49 +02:00 committed by Thomas Lamprecht
parent eb1c59cc2a
commit 49f44cedbf
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use pbs_datastore::task::TaskState;
use crate::api2::config::sync::delete_sync_job;
use crate::api2::config::verify::delete_verification_job;
use crate::api2::config::tape_backup_job::{list_tape_backup_jobs, delete_tape_backup_job};
use crate::api2::admin::{
sync::list_sync_jobs,
verify::list_verification_jobs,
@ -464,6 +465,11 @@ pub async fn delete_datastore(
for job in list_sync_jobs(Some(name.clone()), Value::Null, rpcenv)? {
delete_sync_job(job.config.id, None, rpcenv)?
}
let tape_jobs = list_tape_backup_jobs(Value::Null, rpcenv)?;
for job_config in tape_jobs.into_iter().filter(|config| config.setup.store == name) {
delete_tape_backup_job(job_config.id, None, rpcenv)?;
}
}
datastore::save_config(&config)?;