From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
by lore.proxmox.com (Postfix) with ESMTPS id AB2FA1FF15C
for <inbox@lore.proxmox.com>; Wed, 27 Nov 2024 16:23:06 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
by firstgate.proxmox.com (Proxmox) with ESMTP id CF6E61A069;
Wed, 27 Nov 2024 16:23:07 +0100 (CET)
Mime-Version: 1.0
Date: Wed, 27 Nov 2024 16:23:04 +0100
Message-Id: <D5X2BRGHBE6W.3OM2GU7H6CRPN@proxmox.com>
To: "Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>
From: "Shannon Sterz" <s.sterz@proxmox.com>
X-Mailer: aerc 0.18.2-0-ge037c095a049-dirty
References: <20241127150658.107034-1-f.ebner@proxmox.com>
<20241127150658.107034-3-f.ebner@proxmox.com>
In-Reply-To: <20241127150658.107034-3-f.ebner@proxmox.com>
X-SPAM-LEVEL: Spam detection results: 0
AWL -0.039 Adjusted score from AWL reputation of From: address
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DMARC_MISSING 0.1 Missing DMARC policy
KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
information.
RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
information.
RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
information.
SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record
SPF_PASS -0.001 SPF: sender matches SPF record
URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
information. [directory.rs]
Subject: Re: [pbs-devel] [PATCH proxmox-backup 2/2] api: disks: directory:
fail if mount unit already exists
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
<pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>,
<mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>,
<mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>
On Wed Nov 27, 2024 at 4:06 PM CET, Fiona Ebner wrote:
> Without this check, if a mount unit is present, but the file system is
> not mounted, it will just get overwritten. The unit might belong to an
> existing datastore.
>
> There already is a check against a duplicate datastore, but only after
> the mount unit is already overwritten and having the add-datastore
> flag present is not a precondition to trigger the issue.
>
> The check is done even if the newly created directory datastore is
> removable. While in that case, the mount unit is not overwritten, the
> conflict for the mount point is still present, so it is nice to fail
> early.
>
> Signed-off-by: Fiona 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 7bdf0111..d4690d45 100644
> --- a/src/api2/node/disks/directory.rs
> +++ b/src/api2/node/disks/directory.rs
> @@ -204,6 +204,11 @@ pub fn create_datastore_disk(
> }
> }
>
> + let (mount_unit_path, _) = datastore_mount_unit_path_info(&mount_point);
> + if std::path::PathBuf::from(&mount_unit_path).exists() {
> + bail!("systemd mount unit {mount_unit_path:?} already exists");
nit: relying on the `Debug` trait here to quote the string feels a bit..
hacky to me? maybe just:
```rs
bail!("systemd mount unit \"{mount_unit_path}\" already exists");
```
or use single quotes as we do elsewhere.
> + }
> +
> let upid_str = WorkerTask::new_thread(
> "dircreate",
> Some(name.clone()),
Otherwise:
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel