public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>,
	Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH qemu-server v2 1/3] move verify_volume_id_or_* format registrations into Drive submodule
Date: Wed,  5 Aug 2026 10:21:20 +0200	[thread overview]
Message-ID: <20260805082122.43184-2-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20260805082122.43184-1-t.ellmenreich@proxmox.com>

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.

Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Reviewed-by: Elias Huhsovitz <e.huhsovitz@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)?$@;
-- 
2.47.3





  reply	other threads:[~2026-08-05  8:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  8:21 [PATCH qemu-server v2 0/3] refactor of volume_id classification Thomas Ellmenreich
2026-08-05  8:21 ` Thomas Ellmenreich [this message]
2026-08-05  8:21 ` [PATCH qemu-server v2 2/3] add new classify_drive_file utility Thomas Ellmenreich
2026-08-05  8:21 ` [PATCH qemu-server v2 3/3] removed some unnecessary undef checks 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=20260805082122.43184-2-t.ellmenreich@proxmox.com \
    --to=t.ellmenreich@proxmox.com \
    --cc=e.huhsovitz@proxmox.com \
    --cc=pve-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