]> git.proxmox.com Git - pve-storage.git/commitdiff
storage plugin: move get_subdir call
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 19 Jul 2019 11:53:45 +0000 (13:53 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 19 Jul 2019 12:04:34 +0000 (14:04 +0200)
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>
PVE/Storage/Plugin.pm

index e075a1dee3becab190ba818656ad93bca0d20ec0..08ec7494fc1177ed6e8d19c5414a9fa308c4726f 100644 (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;