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) {
my $data;
my $path = $class->get_subdir($scfg, $ct);
if ($ct eq 'images') {
$data = $class->list_images($storeid, $scfg, $vmid);
} elsif ($ct eq 'iso' && !defined($vmid)) {
$data = $get_subdir_files->($storeid, $path, 'iso');
} elsif ($ct eq 'vztmpl'&& !defined($vmid)) {
$data = $get_subdir_files->($storeid, $path, 'vztmpl');
} elsif ($ct eq 'backup') {
$data = $get_subdir_files->($storeid, $path, 'backup', $vmid);
} elsif ($ct eq 'snippets') {
$data = $get_subdir_files->($storeid, $path, 'snippets');
} elsif ($scfg->{path}) {
my $path = $class->get_subdir($scfg, $ct);
if ($ct eq 'iso' && !defined($vmid)) {
$data = $get_subdir_files->($storeid, $path, 'iso');
} elsif ($ct eq 'vztmpl'&& !defined($vmid)) {
$data = $get_subdir_files->($storeid, $path, 'vztmpl');
} 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;