From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3D77A1FF0E3 for ; Tue, 04 Aug 2026 16:09:25 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B5E8B216FE; Tue, 04 Aug 2026 16:09:24 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 04 Aug 2026 16:09:19 +0200 Message-Id: Subject: Re: [PATCH qemu-server 1/3] moved verify_volume_id_or_* format registrations From: "Elias Huhsovitz" To: "Thomas Ellmenreich" , X-Mailer: aerc 0.20.0 References: <20260803121300.138287-1-t.ellmenreich@proxmox.com> <20260803121300.138287-2-t.ellmenreich@proxmox.com> In-Reply-To: <20260803121300.138287-2-t.ellmenreich@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785852547724 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.108 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: OR6HFI43TXF5QI3U6TPZOQMASNWPG33Z X-Message-ID-Hash: OR6HFI43TXF5QI3U6TPZOQMASNWPG33Z X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Good change. The QemuServer.pm is quite long and this refactor makes sense. One small nit inline, otherwise consider this: Reviewed-by: Elias Huhsovitz 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 > --- > 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(); > } > =20 > -PVE::JSONSchema::register_format('pve-volume-id-or-qm-path', \&verify_vo= lume_id_or_qm_path); > - > -sub verify_volume_id_or_qm_path { > - my ($volid, $noerr) =3D @_; > - > - 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) =3D @_; > - > - return $volid if $volid =3D~ m|^/|; > - > - $volid =3D eval { PVE::JSONSchema::check_format('pve-volume-id', $vo= lid, '') }; > - if ($@) { > - return if $noerr; > - die $@; > - } > - return $volid; > -} > - > my $serialdesc =3D { > optional =3D> 1, > type =3D> '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"; > } > =20 > +PVE::JSONSchema::register_format('pve-volume-id-or-qm-path', \&verify_vo= lume_id_or_qm_path); > + > +sub verify_volume_id_or_qm_path { > + my ($volid, $noerr) =3D @_; > + > + 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) =3D @_; > + > + return $volid if $volid =3D~ m|^/|; > + > + $volid =3D eval { PVE::JSONSchema::check_format('pve-volume-id', $vo= lid, '') }; > + if ($@) { > + return if $noerr; > + die $@; > + } > + return $volid; > +} > + > sub drive_is_cloudinit { > my ($drive) =3D @_; > return $drive->{file} =3D~ m@[:/](?:vm-\d+-)?cloudinit(?:\.$QEMU_FOR= MAT_RE)?$@;