From 49f44cedbf15b670eb2da7d2ae82b30aee14da26 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 8 Jul 2021 12:13:49 +0200 Subject: [PATCH] api: config: delete datastore: also remove tape backup jobs Signed-off-by: Dominik Csapak --- src/api2/config/datastore.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs index 1fde362a..19b822d4 100644 --- a/src/api2/config/datastore.rs +++ b/src/api2/config/datastore.rs @@ -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)?;