[pve-devel] [PATCH qemu-server v2 02/15] fix #5284: api: move-disk: assert content type support for target storage

Fiona Ebner f.ebner at proxmox.com
Thu Feb 20 15:04:00 CET 2025


Am 11.02.25 um 17:08 schrieb Daniel Kral:
> Asserts whether the target storage supports storing VM images before
> moving a VM volume to the target storage.
> 
> Without the check in place, a VM volume can be moved 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 at proxmox.com>

Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>

> ---
> changes since v1:
> - patch without any helpers needed
> 
>  PVE/API2/Qemu.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 295260e7..52234afd 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -4233,6 +4233,10 @@ __PACKAGE__->register_method({
>  	    die "you can't move to the same storage with same format\n"
>  		if $oldstoreid eq $storeid && (!$format || !$oldfmt || $oldfmt eq $format);
>  
> +	    my $scfg = PVE::Storage::storage_check_enabled($storecfg, $storeid);
> +	    raise_param_exc({ storage => "storage '$storeid' does not support vm images" })
> +		if !$scfg->{content}->{images};
> +
>  	    # this only checks snapshots because $disk is passed!
>  	    my $snapshotted = PVE::QemuServer::Drive::is_volume_in_use(
>  		$storecfg,





More information about the pve-devel mailing list