5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-02-01 05:47:18 +03:00

api: create/modify: fix content type checks by re-allowing iso images

Fixes: f9be9137 ("api: create/modify: add content type checks"
Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2022-04-22 13:03:06 +02:00 committed by Thomas Lamprecht
parent 6f070e39de
commit db81c00754

View File

@ -142,14 +142,12 @@ my $check_storage_access = sub {
raise_param_exc({ storage => "storage '$storeid' does not support vm images"})
if !$scfg->{content}->{images};
} else {
PVE::Storage::check_volume_access(
$rpcenv,
$authuser,
$storecfg,
$vmid,
$volid,
'images',
);
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';
}
}
if (my $src_image = $drive->{'import-from'}) {
@ -421,14 +419,12 @@ my $create_disks = sub {
print "$ds: successfully created disk '$res->{$ds}'\n";
} else {
PVE::Storage::check_volume_access(
$rpcenv,
$authuser,
$storecfg,
$vmid,
$volid,
'images',
);
PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
if ($storeid) {
my ($vtype) = PVE::Storage::parse_volname($storecfg, $volid);
die "cannot use volume $volid - content type needs to be 'images' or 'iso'"
if $vtype ne 'images' && $vtype ne 'iso';
}
PVE::Storage::activate_volumes($storecfg, [ $volid ]) if $storeid;