storage status API: allow to filter multiple content types
This commit is contained in:
@ -47,7 +47,7 @@ __PACKAGE__->register_method ({
|
|||||||
}),
|
}),
|
||||||
content => {
|
content => {
|
||||||
description => "Only list stores which support this content type.",
|
description => "Only list stores which support this content type.",
|
||||||
type => 'string', format => 'pve-storage-content',
|
type => 'string', format => 'pve-storage-content-list',
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
enabled => {
|
enabled => {
|
||||||
|
|||||||
@ -882,14 +882,23 @@ sub storage_info {
|
|||||||
my $ids = $cfg->{ids};
|
my $ids = $cfg->{ids};
|
||||||
|
|
||||||
my $info = {};
|
my $info = {};
|
||||||
|
|
||||||
|
my @ctypes = PVE::Tools::split_list($content);
|
||||||
|
|
||||||
my $slist = [];
|
my $slist = [];
|
||||||
foreach my $storeid (keys %$ids) {
|
foreach my $storeid (keys %$ids) {
|
||||||
|
|
||||||
next if $content && !$ids->{$storeid}->{content}->{$content};
|
|
||||||
|
|
||||||
next if !storage_check_enabled($cfg, $storeid, undef, 1);
|
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};
|
my $type = $ids->{$storeid}->{type};
|
||||||
|
|
||||||
$info->{$storeid} = {
|
$info->{$storeid} = {
|
||||||
|
|||||||
Reference in New Issue
Block a user