[pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit
Fabian Ebner
f.ebner at proxmox.com
Thu Nov 5 13:45:50 CET 2020
It might make more sense to check in create_datastore_disk whether the
actual mount point exists and bail out before partitioning. That is
similar to what we do for zfs and has the advantage that disks will
still be considered unused after a failed creation attempt. This patch
could still be used in addition to that, but it's probably not worth it
then.
Am 04.11.20 um 12:55 schrieb Fabian Ebner:
> 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),
>
More information about the pbs-devel
mailing list