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/'.". 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 = config.convert_to_typed_array("datastore")?;