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

Fiona Ebner
2025-07-30T09:17:27Z

Am 29.07.25 um 1:25 PM schrieb Wolfgang Bumiller:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@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(-)

The verify_media_type() helper in QemuServer.pm needs updating too,
e.g:

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 05a3be91..15b38caf 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1090,18 +1090,18 @@ sub verify_media_type {

return if !$media;

- my $etype;
if ($media eq 'disk') {
- $etype = 'images';
+ return if $vtype eq 'images' || $vtype eq 'vm-vol';
+ raise_param_exc({
+ $opt =>
+ "wrong volume type '$vtype' for media=$media - expected 'images' or 'vm-vol'",
+ });
} elsif ($media eq 'cdrom') {
- $etype = 'iso';
- } else {
- die "internal error";
+ return if $vtype eq 'iso';
+ raise_param_exc({ $opt => "wrong volume type '$vtype' for media=$media - expected 'iso'" });
}

- return if ($vtype eq $etype);
-
- raise_param_exc({ $opt => "unexpected media type ($vtype != $etype)" });
+ die "internal error - unexpected media type '$media'\n";
}

sub cleanup_drive_path {