mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 16:38:49 +00:00
api: create/modify: add content type checks
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
8b8893c3c4
commit
f9be9137fc
@ -104,7 +104,14 @@ my $check_storage_access = sub {
|
|||||||
raise_param_exc({ storage => "storage '$storeid' does not support vm images"})
|
raise_param_exc({ storage => "storage '$storeid' does not support vm images"})
|
||||||
if !$scfg->{content}->{images};
|
if !$scfg->{content}->{images};
|
||||||
} else {
|
} else {
|
||||||
PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
|
PVE::Storage::check_volume_access(
|
||||||
|
$rpcenv,
|
||||||
|
$authuser,
|
||||||
|
$storecfg,
|
||||||
|
$vmid,
|
||||||
|
$volid,
|
||||||
|
'images',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -230,7 +237,14 @@ my $create_disks = sub {
|
|||||||
delete $disk->{format}; # no longer needed
|
delete $disk->{format}; # no longer needed
|
||||||
$res->{$ds} = PVE::QemuServer::print_drive($disk);
|
$res->{$ds} = PVE::QemuServer::print_drive($disk);
|
||||||
} else {
|
} else {
|
||||||
PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
|
PVE::Storage::check_volume_access(
|
||||||
|
$rpcenv,
|
||||||
|
$authuser,
|
||||||
|
$storecfg,
|
||||||
|
$vmid,
|
||||||
|
$volid,
|
||||||
|
'images',
|
||||||
|
);
|
||||||
|
|
||||||
PVE::Storage::activate_volumes($storecfg, [ $volid ]) if $storeid;
|
PVE::Storage::activate_volumes($storecfg, [ $volid ]) if $storeid;
|
||||||
|
|
||||||
@ -645,7 +659,14 @@ __PACKAGE__->register_method({
|
|||||||
die "pipe requires cli environment\n" if $rpcenv->{type} ne 'cli';
|
die "pipe requires cli environment\n" if $rpcenv->{type} ne 'cli';
|
||||||
$archive = { type => 'pipe' };
|
$archive = { type => 'pipe' };
|
||||||
} else {
|
} else {
|
||||||
PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $archive);
|
PVE::Storage::check_volume_access(
|
||||||
|
$rpcenv,
|
||||||
|
$authuser,
|
||||||
|
$storecfg,
|
||||||
|
$vmid,
|
||||||
|
$archive,
|
||||||
|
'backup',
|
||||||
|
);
|
||||||
|
|
||||||
$archive = $parse_restore_archive->($storecfg, $archive);
|
$archive = $parse_restore_archive->($storecfg, $archive);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user