[pve-devel] [PATCH qemu-server 04/10] expect 'vm-vol' vtype wherever 'images' was expected

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jul 29 13:15:46 CEST 2025


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/API2/Qemu.pm   | 16 +++++++++-------
 src/PVE/QemuMigrate.pm |  3 ++-
 src/PVE/QemuServer.pm  |  6 ++++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 76883a5b..deb2eae8 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -191,8 +191,9 @@ my $check_storage_access = sub {
                 PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
                 if ($storeid) {
                     my ($vtype) = PVE::Storage::parse_volname($storecfg, $volid);
-                    raise_param_exc({ $ds => "content type needs to be 'images' or 'iso'" })
-                        if $vtype ne 'images' && $vtype ne 'iso';
+                    raise_param_exc(
+                        { $ds => "content type needs to be 'vm-vol', 'images' or 'iso'" })
+                        if $vtype ne 'vm-vol' && $vtype ne 'images' && $vtype ne 'iso';
                 }
             }
 
@@ -206,10 +207,10 @@ my $check_storage_access = sub {
 
                     raise_param_exc(
                         {
-                            $ds =>
-                                "$src_image has wrong type '$vtype' - needs to be 'images' or 'import'",
+                            $ds => "$src_image has wrong type '$vtype'"
+                                . " - needs to be 'vm-vol', 'images' or 'import'",
                         },
-                    ) if $vtype ne 'images' && $vtype ne 'import';
+                    ) if $vtype ne 'vm-vol' && $vtype ne 'images' && $vtype ne 'import';
 
                     if (PVE::QemuServer::Helpers::needs_extraction($vtype, $fmt)) {
                         my $extraction_scfg =
@@ -658,8 +659,9 @@ my sub create_disks : prototype($$$$$$$$$$$) {
             if ($storeid) {
                 my ($vtype, $volume_format) = (checked_parse_volname($storecfg, $volid))[0, 6];
 
-                die "cannot use volume $volid - content type needs to be 'images' or 'iso'"
-                    if $vtype ne 'images' && $vtype ne 'iso';
+                die "cannot use volume $volid"
+                    . " - content type needs to be 'vm-vol', 'images' or 'iso'"
+                    if $vtype ne 'vm-vol' && $vtype ne 'images' && $vtype ne 'iso';
 
                 # TODO PVE 9 - consider disallowing setting an explicit format for managed volumes.
                 if ($disk->{format} && $disk->{format} ne $volume_format) {
diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 9585e292..bdb1fce3 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -168,8 +168,9 @@ sub target_storage_check_available {
             $storecfg, $targetsid, $self->{node},
         );
         my ($vtype) = PVE::Storage::parse_volname($storecfg, $volid);
+        my $ctype = $vtype eq 'vm-vol' ? 'images' : $vtype;
         die "$volid: content type '$vtype' is not available on storage '$targetsid'\n"
-            if !$target_scfg->{content}->{$vtype};
+            if !$target_scfg->{content}->{$ctype};
     }
 }
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d004dd55..05a3be91 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -8241,8 +8241,10 @@ sub check_volume_storage_type {
     my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
     my ($vtype) = PVE::Storage::parse_volname($storecfg, $vol);
 
-    die "storage '$storeid' does not support content-type '$vtype'\n"
-        if !$scfg->{content}->{$vtype};
+    my $ctype = $vtype eq 'vm-vol' ? 'images' : $vtype;
+
+    die "storage '$storeid' does not support content-type '$ctype'\n"
+        if !$scfg->{content}->{$ctype};
 
     return 1;
 }
-- 
2.47.2





More information about the pve-devel mailing list