[pbs-devel] [PATCH proxmox-backup 2/2] api2/config/datastore: delete_datastore: also remove tape backup jobs

Dominik Csapak d.csapak at proxmox.com
Thu Jul 8 12:13:49 CEST 2021


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 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)?;
-- 
2.30.2






More information about the pbs-devel mailing list