[pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit

Fabian Ebner f.ebner at proxmox.com
Wed Nov 4 12:55:10 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/api2/node/disks/directory.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 2a4780f2..c650b887 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -252,6 +252,11 @@ fn create_datastore_mount_unit(
     mount_unit_name.push_str(".mount");
 
     let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
+    let full_path = std::path::Path::new(&mount_unit_path);
+
+    if full_path.exists() {
+        bail!("mount unit {} already exists!", mount_unit_path);
+    }
 
     let unit = SystemdUnitSection {
         Description: format!("Mount datatstore '{}' under '{}'", datastore_name, mount_point),
-- 
2.20.1






More information about the pbs-devel mailing list