public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit
Date: Thu, 5 Nov 2020 13:45:50 +0100	[thread overview]
Message-ID: <a9f188fd-a8f8-341d-1743-e9cf38961590@proxmox.com> (raw)
In-Reply-To: <20201104115510.26951-1-f.ebner@proxmox.com>

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@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),
> 




      reply	other threads:[~2020-11-05 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 11:55 Fabian Ebner
2020-11-05 12:45 ` Fabian Ebner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9f188fd-a8f8-341d-1743-e9cf38961590@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal