public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Elias Huhsovitz" <e.huhsovitz@proxmox.com>
To: "Thomas Ellmenreich" <t.ellmenreich@proxmox.com>,
	<pve-devel@lists.proxmox.com>
Subject: Re: [PATCH qemu-server 1/3] moved verify_volume_id_or_* format registrations
Date: Tue, 04 Aug 2026 16:09:19 +0200	[thread overview]
Message-ID: <DKG7WC1BYLPH.B88DELMF8XRM@proxmox.com> (raw)
In-Reply-To: <20260803121300.138287-2-t.ellmenreich@proxmox.com>

Good change. The QemuServer.pm is quite long and this refactor makes
sense. One small nit inline, otherwise consider this:

Reviewed-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>

On Mon Aug 3, 2026 at 2:12 PM CEST, Thomas Ellmenreich wrote:
> The format registrations of verify_volume_id_or_qm_path and
> verify_volume_id_or_absolute_path were moved from QemuServer to
> QemuServer::Drive, which is a more fitting location.

nit: Commit messages should be written in imperative.

e.g., "move verify_volume_id_or_* format registrations from X to Y"
instead of "verify_volume_id_or_* were moved from X to Y"

> Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
> ---
>  src/PVE/QemuServer.pm       | 28 ----------------------------
>  src/PVE/QemuServer/Drive.pm | 28 ++++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 9aec7f9c..fdef20dc 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -895,34 +895,6 @@ sub pve_verify_cpuset {
>      return PVE::CpuSet->new($members)->short_string();
>  }
>  
> -PVE::JSONSchema::register_format('pve-volume-id-or-qm-path', \&verify_volume_id_or_qm_path);
> -
> -sub verify_volume_id_or_qm_path {
> -    my ($volid, $noerr) = @_;
> -
> -    return $volid if $volid eq 'none' || $volid eq 'cdrom';
> -
> -    return verify_volume_id_or_absolute_path($volid, $noerr);
> -}
> -
> -PVE::JSONSchema::register_format(
> -    'pve-volume-id-or-absolute-path',
> -    \&verify_volume_id_or_absolute_path,
> -);
> -
> -sub verify_volume_id_or_absolute_path {
> -    my ($volid, $noerr) = @_;
> -
> -    return $volid if $volid =~ m|^/|;
> -
> -    $volid = eval { PVE::JSONSchema::check_format('pve-volume-id', $volid, '') };
> -    if ($@) {
> -        return if $noerr;
> -        die $@;
> -    }
> -    return $volid;
> -}
> -
>  my $serialdesc = {
>      optional => 1,
>      type => 'string',
> diff --git a/src/PVE/QemuServer/Drive.pm b/src/PVE/QemuServer/Drive.pm
> index b80b7dbb..52e4a89b 100644
> --- a/src/PVE/QemuServer/Drive.pm
> +++ b/src/PVE/QemuServer/Drive.pm
> @@ -753,6 +753,34 @@ sub verify_bootdisk {
>      die "invalid boot disk '$value'\n";
>  }
>  
> +PVE::JSONSchema::register_format('pve-volume-id-or-qm-path', \&verify_volume_id_or_qm_path);
> +
> +sub verify_volume_id_or_qm_path {
> +    my ($volid, $noerr) = @_;
> +
> +    return $volid if $volid eq 'none' || $volid eq 'cdrom';
> +
> +    return verify_volume_id_or_absolute_path($volid, $noerr);
> +}
> +
> +PVE::JSONSchema::register_format(
> +    'pve-volume-id-or-absolute-path',
> +    \&verify_volume_id_or_absolute_path,
> +);
> +
> +sub verify_volume_id_or_absolute_path {
> +    my ($volid, $noerr) = @_;
> +
> +    return $volid if $volid =~ m|^/|;
> +
> +    $volid = eval { PVE::JSONSchema::check_format('pve-volume-id', $volid, '') };
> +    if ($@) {
> +        return if $noerr;
> +        die $@;
> +    }
> +    return $volid;
> +}
> +
>  sub drive_is_cloudinit {
>      my ($drive) = @_;
>      return $drive->{file} =~ m@[:/](?:vm-\d+-)?cloudinit(?:\.$QEMU_FORMAT_RE)?$@;





  reply	other threads:[~2026-08-04 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 12:12 [PATCH qemu-server 0/3] refactor of volume_id classification Thomas Ellmenreich
2026-08-03 12:12 ` [PATCH qemu-server 1/3] moved verify_volume_id_or_* format registrations Thomas Ellmenreich
2026-08-04 14:09   ` Elias Huhsovitz [this message]
2026-08-03 12:12 ` [PATCH qemu-server 2/3] add new classify_drive_file utility Thomas Ellmenreich
2026-08-04 14:23   ` Elias Huhsovitz
2026-08-03 12:12 ` [PATCH qemu-server 3/3] removed some unnecessary undef checks Thomas Ellmenreich
2026-08-05  8:24   ` Elias Huhsovitz
2026-08-05  9:55     ` Fiona Ebner
2026-08-05  8:22 ` superseded: [PATCH qemu-server 0/3] refactor of volume_id classification Thomas Ellmenreich

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=DKG7WC1BYLPH.B88DELMF8XRM@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.ellmenreich@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