storage plugin: move get_subdir call

since list_volumes is only supposed to be called with filtered content
types, this should ensure that get_subdir is only called for plugins
that have a defined 'path' property, like the old code in
PVE::Storage::template_list did.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2019-07-19 13:53:45 +02:00
parent c2fc9fbe1d
commit a14e0a5e95

View File

@ -954,18 +954,20 @@ sub list_volumes {
foreach my $ct (@$content_types) { foreach my $ct (@$content_types) {
my $data; my $data;
my $path = $class->get_subdir($scfg, $ct);
if ($ct eq 'images') { if ($ct eq 'images') {
$data = $class->list_images($storeid, $scfg, $vmid); $data = $class->list_images($storeid, $scfg, $vmid);
} elsif ($ct eq 'iso' && !defined($vmid)) { } elsif ($scfg->{path}) {
$data = $get_subdir_files->($storeid, $path, 'iso'); my $path = $class->get_subdir($scfg, $ct);
} elsif ($ct eq 'vztmpl'&& !defined($vmid)) {
$data = $get_subdir_files->($storeid, $path, 'vztmpl'); if ($ct eq 'iso' && !defined($vmid)) {
} elsif ($ct eq 'backup') { $data = $get_subdir_files->($storeid, $path, 'iso');
$data = $get_subdir_files->($storeid, $path, 'backup', $vmid); } elsif ($ct eq 'vztmpl'&& !defined($vmid)) {
} elsif ($ct eq 'snippets') { $data = $get_subdir_files->($storeid, $path, 'vztmpl');
$data = $get_subdir_files->($storeid, $path, 'snippets'); } elsif ($ct eq 'backup') {
$data = $get_subdir_files->($storeid, $path, 'backup', $vmid);
} elsif ($ct eq 'snippets') {
$data = $get_subdir_files->($storeid, $path, 'snippets');
}
} }
next if !$data; next if !$data;