public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>, Markus Frank <m.frank@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/6] feature #3690: add regex, format & schema for partition names to pbs-api-types
Date: Mon, 27 Nov 2023 17:29:00 +0100	[thread overview]
Message-ID: <f29eade0-f685-4677-881f-22d2528c10cc@proxmox.com> (raw)
In-Reply-To: <20231110135010.106015-1-m.frank@proxmox.com>

Hello, first some general remarks about this series:

  - the prefix for the commits should be 'fix #num:' or 'close #num:' [1]
  - patches 1, 2 and 6 are missing subsystem tags (e.g. for 1 this could 
be 'api-types')
  - A cover letter with some brief summary of the changes would be nice, 
so that I don't have to pull up the bugzilla entry first to see what 
this series is actually about.


The features seems to work as intended, I tested it on the latest 
master. A few things should be changed though before this goes in,
see the inline comments for the individual patches.

[1] 
https://pve.proxmox.com/wiki/Developer_Documentation#Commits_and_Commit_Messages


On 11/10/23 14:50, Markus Frank wrote:
> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>   pbs-api-types/src/lib.rs | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
> index 4306eca3..af8ad9cc 100644
> --- a/pbs-api-types/src/lib.rs
> +++ b/pbs-api-types/src/lib.rs
> @@ -191,6 +191,7 @@ const_regex! {
>       );
>   
>       pub BLOCKDEVICE_NAME_REGEX = r"^(?:(?:h|s|x?v)d[a-z]+)|(?:nvme\d+n\d+)$";
> +    pub BLOCKDEVICE_PARTITION_NAME_REGEX = r"^(?:(?:h|s|x?v)d[a-z]+\d*)|(?:nvme\d+n\d+(p\d+)?)$";

It appears that this regex also matches disks, not only partitions (e.g 
sda AND sda1 both match). From the rest of the code this seems intended, 
since you are also able to wipe disks AND partitions, but maybe the name 
for this constant should reflect that.

>       pub SUBSCRIPTION_KEY_REGEX = concat!(r"^pbs(?:[cbsp])-[0-9a-f]{10}$");
>   }
>   
> @@ -205,6 +206,8 @@ pub const PASSWORD_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&PASSWORD_
>   pub const UUID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&UUID_REGEX);
>   pub const BLOCKDEVICE_NAME_FORMAT: ApiStringFormat =
>       ApiStringFormat::Pattern(&BLOCKDEVICE_NAME_REGEX);
> +pub const BLOCKDEVICE_PARTITION_NAME_FORMAT: ApiStringFormat =
> +    ApiStringFormat::Pattern(&BLOCKDEVICE_PARTITION_NAME_REGEX);
>   pub const SUBSCRIPTION_KEY_FORMAT: ApiStringFormat =
>       ApiStringFormat::Pattern(&SUBSCRIPTION_KEY_REGEX);
>   pub const SYSTEMD_DATETIME_FORMAT: ApiStringFormat =
> @@ -285,6 +288,13 @@ pub const BLOCKDEVICE_NAME_SCHEMA: Schema =
>           .max_length(64)
>           .schema();
>   
> +pub const BLOCKDEVICE_PARTITION_NAME_SCHEMA: Schema =
> +    StringSchema::new("(Partition) block device name (/sys/class/block/<name>).")
> +        .format(&BLOCKDEVICE_PARTITION_NAME_FORMAT)
> +        .min_length(3)
> +        .max_length(64)
> +        .schema();
> +
>   pub const DISK_ARRAY_SCHEMA: Schema =
>       ArraySchema::new("Disk name list.", &BLOCKDEVICE_NAME_SCHEMA).schema();
>   

-- 
- Lukas




      parent reply	other threads:[~2023-11-27 16:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 13:50 Markus Frank
2023-11-10 13:50 ` [pbs-devel] [PATCH proxmox-backup 2/6] feature #3690: add wipe_blockdev & change_parttype rust equivalent Markus Frank
2023-11-27 16:29   ` Lukas Wagner
2023-11-10 13:50 ` [pbs-devel] [PATCH proxmox-backup 3/6] feature #3690: api: add function wipe_disk Markus Frank
2023-11-10 13:50 ` [pbs-devel] [PATCH proxmox-backup 4/6] feature #3690: cli: " Markus Frank
2023-11-10 13:50 ` [pbs-devel] [PATCH proxmox-backup 5/6] feature #3690: ui: enable wipe disk in StorageAndDisks Markus Frank
2023-11-27 16:29   ` Lukas Wagner
2023-11-10 13:50 ` [pbs-devel] [PATCH proxmox-backup 6/6] prohibit disk wipe of EFI partition Markus Frank
2023-11-27 16:29   ` Lukas Wagner
2023-11-27 16:29 ` Lukas Wagner [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=f29eade0-f685-4677-881f-22d2528c10cc@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=m.frank@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