datastore: add check for maintenance in lookup
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
2a05c75ff1
commit
e9d2fc9362
@ -10,7 +10,7 @@ use proxmox_schema::api;
|
||||
use proxmox_sys::{task_log, task_warn, WorkerTaskContext};
|
||||
|
||||
use pbs_api_types::{
|
||||
Authid, GroupFilter, MediaPoolConfig, TapeBackupJobConfig, TapeBackupJobSetup,
|
||||
Authid, GroupFilter, MediaPoolConfig, Operation, TapeBackupJobConfig, TapeBackupJobSetup,
|
||||
TapeBackupJobStatus, Userid, JOB_ID_SCHEMA, PRIV_DATASTORE_READ, PRIV_TAPE_AUDIT,
|
||||
PRIV_TAPE_WRITE, UPID_SCHEMA,
|
||||
};
|
||||
@ -158,7 +158,7 @@ pub fn do_tape_backup_job(
|
||||
|
||||
let worker_type = job.jobtype().to_string();
|
||||
|
||||
let datastore = DataStore::lookup_datastore(&setup.store)?;
|
||||
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)?;
|
||||
@ -328,7 +328,7 @@ pub fn backup(
|
||||
|
||||
check_backup_permission(&auth_id, &setup.store, &setup.pool, &setup.drive)?;
|
||||
|
||||
let datastore = DataStore::lookup_datastore(&setup.store)?;
|
||||
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)?;
|
||||
|
@ -17,7 +17,7 @@ use proxmox_sys::{task_log, task_warn, WorkerTaskContext};
|
||||
use proxmox_uuid::Uuid;
|
||||
|
||||
use pbs_api_types::{
|
||||
Authid, CryptMode, Userid, DATASTORE_MAP_ARRAY_SCHEMA, DATASTORE_MAP_LIST_SCHEMA,
|
||||
Authid, CryptMode, Operation, Userid, DATASTORE_MAP_ARRAY_SCHEMA, DATASTORE_MAP_LIST_SCHEMA,
|
||||
DRIVE_NAME_SCHEMA, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, PRIV_TAPE_READ,
|
||||
TAPE_RESTORE_SNAPSHOT_SCHEMA, UPID_SCHEMA,
|
||||
};
|
||||
@ -75,10 +75,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)?;
|
||||
let datastore = DataStore::lookup_datastore(&target, Some(Operation::Write))?;
|
||||
map.insert(store, datastore);
|
||||
} else if default.is_none() {
|
||||
default = Some(DataStore::lookup_datastore(&store)?);
|
||||
default = Some(DataStore::lookup_datastore(&store, Some(Operation::Write))?);
|
||||
} else {
|
||||
bail!("multiple default stores given");
|
||||
}
|
||||
|
Reference in New Issue
Block a user