[pbs-devel] [PATCH proxmox-backup 1/2] api: tape: fix datastore lookup operations

Dominik Csapak d.csapak at proxmox.com
Fri Nov 19 16:23:27 CET 2021


restore needs write access, and backup only read access

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/tape/backup.rs  | 4 ++--
 src/api2/tape/restore.rs | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/api2/tape/backup.rs b/src/api2/tape/backup.rs
index a006aa87..b374de25 100644
--- a/src/api2/tape/backup.rs
+++ b/src/api2/tape/backup.rs
@@ -168,7 +168,7 @@ pub fn do_tape_backup_job(
 
     let worker_type = job.jobtype().to_string();
 
-    let datastore = DataStore::lookup_datastore(&setup.store, Some(Operation::Write))?;
+    let datastore = DataStore::lookup_datastore(&setup.store, Some(Operation::Read))?;
 
     let (config, _digest) = pbs_config::media_pool::config()?;
     let pool_config: MediaPoolConfig = config.lookup("pool", &setup.pool)?;
@@ -349,7 +349,7 @@ pub fn backup(
         &setup.drive,
     )?;
 
-    let datastore = DataStore::lookup_datastore(&setup.store, Some(Operation::Write))?;
+    let datastore = DataStore::lookup_datastore(&setup.store, Some(Operation::Read))?;
 
     let (config, _digest) = pbs_config::media_pool::config()?;
     let pool_config: MediaPoolConfig = config.lookup("pool", &setup.pool)?;
diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
index f821b3e5..10bb9003 100644
--- a/src/api2/tape/restore.rs
+++ b/src/api2/tape/restore.rs
@@ -93,10 +93,10 @@ impl TryFrom<String> for DataStoreMap {
             if let Some(index) = store.find('=') {
                 let mut target = store.split_off(index);
                 target.remove(0); // remove '='
-                let datastore = DataStore::lookup_datastore(&target, Some(Operation::Read))?;
+                let datastore = DataStore::lookup_datastore(&target, Some(Operation::Write))?;
                 map.insert(store, datastore);
             } else if default.is_none() {
-                default = Some(DataStore::lookup_datastore(&store, Some(Operation::Read))?);
+                default = Some(DataStore::lookup_datastore(&store, Some(Operation::Write))?);
             } else {
                 bail!("multiple default stores given");
             }
-- 
2.30.2





More information about the pbs-devel mailing list