fix #2216: Allow .img files in 'iso' type storages

To maintain full (backwards) compatibility, leave the type name as
'iso' - this makes this patch work without changing every consumer of
storage APIs.

Note that currently these files can only be attached as a CDROM/DVD
drive, so USB-only images can be uploaded but might not work in VMs.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
Stefan Reiter
2019-08-22 14:39:53 +02:00
committed by Thomas Lamprecht
parent b9993c4e9d
commit 4c69349140
3 changed files with 7 additions and 5 deletions

View File

@ -415,7 +415,7 @@ sub parse_volname {
my ($vmid, $name) = ($1, $2);
my (undef, $format, $isBase) = parse_name_dir($name);
return ('images', $name, $vmid, undef, undef, $isBase, $format);
} elsif ($volname =~ m!^iso/([^/]+\.[Ii][Ss][Oo])$!) {
} elsif ($volname =~ m!^iso/([^/]+$PVE::Storage::iso_extension_re)$!) {
return ('iso', $1);
} elsif ($volname =~ m!^vztmpl/([^/]+\.tar\.[gx]z)$!) {
return ('vztmpl', $1);
@ -915,7 +915,7 @@ my $get_subdir_files = sub {
my $info;
if ($tt eq 'iso') {
next if $fn !~ m!/([^/]+\.iso)$!i;
next if $fn !~ m!/([^/]+$PVE::Storage::iso_extension_re)$!i;
$info = { volid => "$sid:iso/$1", format => 'iso' };