]> git.proxmox.com Git - pve-storage.git/commitdiff
storage status API: allow to filter multiple content types
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 7 Aug 2015 07:44:22 +0000 (09:44 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 7 Aug 2015 07:46:49 +0000 (09:46 +0200)
PVE/API2/Storage/Status.pm
PVE/Storage.pm

index d9326b76f6d27fe2c504df38a5e0140c63a9422a..8f97c18845a3622ae095fa085ba7725a95a2c104 100644 (file)
@@ -47,7 +47,7 @@ __PACKAGE__->register_method ({
                 }),
            content => { 
                description => "Only list stores which support this content type.",
-               type => 'string', format => 'pve-storage-content',
+               type => 'string', format => 'pve-storage-content-list',
                optional => 1,
            },
            enabled => {
index 8f81aebeb534133a73eb626519e0c0afb65caf77..7b3dc701eccbada26fc93d6dc0b66e4ceec15847 100755 (executable)
@@ -882,14 +882,23 @@ sub storage_info {
     my $ids = $cfg->{ids};
 
     my $info = {};
-
+    
+    my @ctypes = PVE::Tools::split_list($content);
+    
     my $slist = [];
     foreach my $storeid (keys %$ids) {
 
-       next if $content && !$ids->{$storeid}->{content}->{$content};
-
        next if !storage_check_enabled($cfg, $storeid, undef, 1);
 
+       my $want_ctype = 0;
+       foreach my $ctype (@ctypes) {
+           if ($ids->{$storeid}->{content}->{$ctype}) {
+               $want_ctype = 1;
+               last;
+           }
+       }
+       next if !$want_ctype;
+
        my $type = $ids->{$storeid}->{type};
 
        $info->{$storeid} = {