mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 19:20:11 +00:00
fix #5284: api: clone_vm: assert content type support for target storage
Asserts whether the target storage supports storing VM images before cloning a VM and its volumes to the target storage. Without the check in place, a VMs volumes can be cloned to a storage, which does not support VM images, but won't be able to start since any attached volume must be stored on a supported storage. Signed-off-by: Daniel Kral <d.kral@proxmox.com>
This commit is contained in:
parent
b17e33788d
commit
767dea05da
@ -3851,13 +3851,15 @@ __PACKAGE__->register_method({
|
||||
my $storecfg = PVE::Storage::config();
|
||||
|
||||
if ($storage) {
|
||||
# check if storage is enabled on local node
|
||||
PVE::Storage::storage_check_enabled($storecfg, $storage);
|
||||
# check if storage is enabled on local node and supports vm images
|
||||
my $scfg = PVE::Storage::storage_check_enabled($storecfg, $storage);
|
||||
raise_param_exc({ storage => "storage '$storage' does not support vm images" })
|
||||
if !$scfg->{content}->{images};
|
||||
|
||||
if ($target) {
|
||||
# check if storage is available on target node
|
||||
PVE::Storage::storage_check_enabled($storecfg, $storage, $target);
|
||||
# clone only works if target storage is shared
|
||||
my $scfg = PVE::Storage::storage_config($storecfg, $storage);
|
||||
die "can't clone to non-shared storage '$storage'\n"
|
||||
if !$scfg->{shared};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user