From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] api: disks: directory: factor out helper for mount unit path
Date: Wed, 27 Nov 2024 16:21:39 +0100 [thread overview]
Message-ID: <D5X2AOF7LD7C.A5MXOL95D3DU@proxmox.com> (raw)
In-Reply-To: <20241127150658.107034-2-f.ebner@proxmox.com>
On Wed Nov 27, 2024 at 4:06 PM CET, Fiona Ebner wrote:
> In preparation to check for a pre-existing mount unit.
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> src/api2/node/disks/directory.rs | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
> index 6a76dd5a..7bdf0111 100644
> --- a/src/api2/node/disks/directory.rs
> +++ b/src/api2/node/disks/directory.rs
> @@ -324,16 +324,23 @@ pub const ROUTER: Router = Router::new()
> .post(&API_METHOD_CREATE_DATASTORE_DISK)
> .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),
nit, this could be:
```rs
format!("/etc/systemd/system/{mount_unit_name}"),
```
> + mount_unit_name,
> + )
> +}
> +
> fn create_datastore_mount_unit(
> datastore_name: &str,
> mount_point: &str,
> fs_type: FileSystemType,
> what: &str,
> ) -> Result<String, Error> {
> - let mut mount_unit_name = proxmox_systemd::escape_unit(mount_point, true);
> - mount_unit_name.push_str(".mount");
> -
> - let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
> + let (mount_unit_path, mount_unit_name) = datastore_mount_unit_path_info(mount_point);
>
> let unit = SystemdUnitSection {
> Description: format!(
other than that consider this:
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
next prev parent reply other threads:[~2024-11-27 15:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 15:06 [pbs-devel] [PATCH proxmox-backup 0/2] api: disks: directory: fail if mount unit already exists Fiona Ebner
2024-11-27 15:06 ` [pbs-devel] [PATCH proxmox-backup 1/2] api: disks: directory: factor out helper for mount unit path Fiona Ebner
2024-11-27 15:21 ` Shannon Sterz [this message]
2024-11-27 15:06 ` [pbs-devel] [PATCH proxmox-backup 2/2] api: disks: directory: fail if mount unit already exists Fiona Ebner
2024-11-27 15:23 ` Shannon Sterz
2024-11-27 15:26 ` Thomas Lamprecht
2024-11-27 16:08 ` Fiona Ebner
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=D5X2AOF7LD7C.A5MXOL95D3DU@proxmox.com \
--to=s.sterz@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