[pbs-devel] [PATCH proxmox-backup v2 4/7] api2: disks/directory: refactor BASE_MOUNT_DIR
Dominik Csapak
d.csapak at proxmox.com
Mon Sep 13 16:18:26 CEST 2021
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/api2/node/disks/directory.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 552d7e4b..c6d230de 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -19,6 +19,8 @@ use crate::tools::systemd::{self, types::*};
use crate::server::WorkerTask;
+const BASE_MOUNT_DIR: &str = "/mnt/datastore/";
+
#[api(
properties: {
"filesystem": {
@@ -143,7 +145,7 @@ pub fn create_datastore_disk(
bail!("disk '{}' is already in use.", disk);
}
- let mount_point = format!("/mnt/datastore/{}", &name);
+ let mount_point = format!("{}{}", BASE_MOUNT_DIR, &name);
// check if the default path does exist already and bail if it does
let default_path = std::path::PathBuf::from(&mount_point);
@@ -218,7 +220,7 @@ pub fn create_datastore_disk(
/// Remove a Filesystem mounted under '/mnt/datastore/<name>'.".
pub fn delete_datastore_disk(name: String) -> Result<(), Error> {
- let path = format!("/mnt/datastore/{}", name);
+ let path = format!("{}{}", BASE_MOUNT_DIR, name);
// path of datastore cannot be changed
let (config, _) = pbs_config::datastore::config()?;
let datastores: Vec<DataStoreConfig> = config.convert_to_typed_array("datastore")?;
--
2.30.2
More information about the pbs-devel
mailing list