[pve-devel] [PATCH qemu-server] fix 3674: QEMU restore: verify storage allows images before writing

Markus Frank m.frank at proxmox.com
Wed Feb 23 10:42:22 CET 2022


With this patch restoring a backup on a disabled storage results in an
error and just creates a VM with the configuration from the backup
without any virtual disk instead of forcing the creation of the disk(s).
Works as intended.

Tested-by: Markus Frank <m.frank at proxmox.com>

On 2/17/22 15:12, Matthias Heiserer wrote:
> When restoring a backup and the storage the disks would be created on
> doesn't allow 'images', the process errors without cleanup.
> This is the same behaviour we currently have when the storage is
> disabled.
>
> Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
> ---
>   PVE/QemuServer.pm | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index a99f1a5..2a1ec48 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6299,6 +6299,10 @@ my $restore_allocate_devices = sub {
>   	my $supported = grep { $_ eq $d->{format} } @$validFormats;
>   	$d->{format} = $defFormat if !$supported;
>   
> +	# check if images can be stored on the requested storage
> +	die "Content type 'images' is not available on storage '$storeid'\n"
> +	    if !$scfg->{content}->{images};
> +
>   	my $name;
>   	if ($d->{is_cloudinit}) {
>   	    $name = "vm-$vmid-cloudinit";






More information about the pve-devel mailing list