[pve-devel] [PATCH storage v4 1/2] storage_info: return also disabled storages
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Jul 27 12:16:45 CEST 2017
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 at proxmox.com>
---
changes v3 -> v4:
* storage_check_enabled returns undef or the scfg, thus make a mapping to 0/1
PVE/Storage.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index cf1e5ec..5d0b2ba 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -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};
--
2.11.0
More information about the pve-devel
mailing list