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

Fiona Ebner
2025-07-30T09:31:48Z

Am 30.07.25 um 11:18 AM schrieb Fiona Ebner:
> 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 {

Other places that still need to be adapted:

QemuServer.pm:

$parse_backup_hints
complete_storage()
complete_migration_storage()

CLI/qm.pm:

remote_migrate_vm API endpoint
importdisk API endpoint

API2/Qemu.pm:

$check_storage_access - NEW_DISK_RE branch
$check_storage_access - branch checking $extraction_scfg
$check_storage_access_migrate
update_vm_async API endpoint - documentation for
'import-working-storage' should also mention 'vm-vol'
clone_vm API endpoint
move_vm_disk API endpoint