fix #3886: QEMU restore: verify storage allows images before writing

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@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Matthias Heiserer 2022-02-24 11:45:59 +01:00 committed by Thomas Lamprecht
parent 5f5aba2578
commit 62af60cd3d

View File

@ -6249,6 +6249,10 @@ my $parse_backup_hints = sub {
$devinfo->{$devname}->{format} = $format;
$devinfo->{$devname}->{storeid} = $storeid;
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
die "Content type 'images' is not available on storage '$storeid'\n"
if !$scfg->{content}->{images};
# check permission on storage
my $pool = $options->{pool}; # todo: do we need that?
if ($user ne 'root@pam') {
@ -6265,6 +6269,9 @@ my $parse_backup_hints = sub {
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
my $format = qemu_img_format($scfg, $volname); # has 'raw' fallback
die "Content type 'images' is not available on storage '$storeid'\n"
if !$scfg->{content}->{images};
$virtdev_hash->{$virtdev} = {
format => $format,
storeid => $storeid,