From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>, Oguz Bektas <o.bektas@proxmox.com>
Subject: Re: [pbs-devel] [PATCH backup] zfs: check if given pool name is reserved
Date: Tue, 23 Nov 2021 13:52:41 +0100 [thread overview]
Message-ID: <53b3600c-97c0-29e8-8338-1fd201ae02ec@proxmox.com> (raw)
In-Reply-To: <20211123122102.577014-1-o.bektas@proxmox.com>
On 23.11.21 13:21, Oguz Bektas wrote:
> man zpool-create:
> The pool names mirror, raidz, draid, spare and log are reserved, as
> are names _beginning_ with mirror, raidz, draid, and spare. The vdev
> specification is described in the Virtual Devices section of
> zpoolconcepts(7).
>
> Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
> ---
> src/api2/node/disks/zfs.rs | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
> index c9a6ac72..58e5a83e 100644
> --- a/src/api2/node/disks/zfs.rs
> +++ b/src/api2/node/disks/zfs.rs
> @@ -201,6 +201,15 @@ pub fn create_zpool(
> };
>
> // Sanity checks
> +
> + lazy_static::lazy_static! {
> + // pool names starting with these are reserved
> + static ref RESERVED_POOL_NAMES: regex::Regex = regex::Regex::new(r"^(mirror|raidz|draid|spare).*$").unwrap();
> + }
> + if RESERVED_POOL_NAMES.is_match(&name) || &name == "log" {
> + bail!("Pool name {:?} is reserved.", &name);
> + }
> +
> if raidlevel == ZfsRaidLevel::Raid10 && devices.len() % 2 != 0 {
> bail!("Raid10 needs an even number of disks.");
> }
>
zpool already gets us the error, lets rather forward that as I do not want to
maintain such things here if somehow possible.
prev parent reply other threads:[~2021-11-23 12:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 12:21 Oguz Bektas
2021-11-23 12:52 ` Thomas Lamprecht [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=53b3600c-97c0-29e8-8338-1fd201ae02ec@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=o.bektas@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal