storage_info: return also disabled storages

in the Storage/Status API call we have a 'enabled' param which had no
effect because storage_info only returned enabled one way or the
other.

This affected also `pvesm status` which uses the Storage/Status API
call.

So push also disabled storages to the info array but only activate
and get their status when thei are enabled.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2017-07-27 12:16:45 +02:00 committed by Wolfgang Bumiller
parent 1befdf96fc
commit 44ae567c38

View File

@ -1012,8 +1012,6 @@ sub storage_info {
my $slist = [];
foreach my $storeid (keys %$ids) {
next if !storage_check_enabled($cfg, $storeid, undef, 1);
if (defined($content)) {
my $want_ctype = 0;
foreach my $ctype (@ctypes) {
@ -1035,6 +1033,7 @@ sub storage_info {
shared => $ids->{$storeid}->{shared} ? 1 : 0,
content => PVE::Storage::Plugin::content_hash_to_string($ids->{$storeid}->{content}),
active => 0,
enabled => defined(storage_check_enabled($cfg, $storeid, undef, 1)) ? 1 : 0,
};
push @$slist, $storeid;
@ -1043,6 +1042,8 @@ sub storage_info {
my $cache = {};
foreach my $storeid (keys %$ids) {
next if !$info->{$storeid}->{enabled};
my $scfg = $ids->{$storeid};
next if !$info->{$storeid};