mirror of
git://git.proxmox.com/git/proxmox-backup.git
synced 2025-01-05 09:17:59 +03:00
api: disks: directory: factor out helper for mount unit path
In preparation to check for a pre-existing mount unit. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
This commit is contained in:
parent
87c648018d
commit
a7792e16c5
@ -324,16 +324,23 @@ pub const ROUTER: Router = Router::new()
|
|||||||
.post(&API_METHOD_CREATE_DATASTORE_DISK)
|
.post(&API_METHOD_CREATE_DATASTORE_DISK)
|
||||||
.match_all("name", &ITEM_ROUTER);
|
.match_all("name", &ITEM_ROUTER);
|
||||||
|
|
||||||
|
fn datastore_mount_unit_path_info(mount_point: &str) -> (String, String) {
|
||||||
|
let mut mount_unit_name = proxmox_systemd::escape_unit(mount_point, true);
|
||||||
|
mount_unit_name.push_str(".mount");
|
||||||
|
|
||||||
|
(
|
||||||
|
format!("/etc/systemd/system/{mount_unit_name}"),
|
||||||
|
mount_unit_name,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn create_datastore_mount_unit(
|
fn create_datastore_mount_unit(
|
||||||
datastore_name: &str,
|
datastore_name: &str,
|
||||||
mount_point: &str,
|
mount_point: &str,
|
||||||
fs_type: FileSystemType,
|
fs_type: FileSystemType,
|
||||||
what: &str,
|
what: &str,
|
||||||
) -> Result<String, Error> {
|
) -> Result<String, Error> {
|
||||||
let mut mount_unit_name = proxmox_systemd::escape_unit(mount_point, true);
|
let (mount_unit_path, mount_unit_name) = datastore_mount_unit_path_info(mount_point);
|
||||||
mount_unit_name.push_str(".mount");
|
|
||||||
|
|
||||||
let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
|
|
||||||
|
|
||||||
let unit = SystemdUnitSection {
|
let unit = SystemdUnitSection {
|
||||||
Description: format!(
|
Description: format!(
|
||||||
|
Loading…
Reference in New Issue
Block a user