[pve-devel] [PATCH storage v3 1/2] storage_info: return also disabled storages

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jun 27 13:42:56 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>
---

no changes v2 -> v3:

 PVE/Storage.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index cf1e5ec..4947ea3 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 => storage_check_enabled($cfg, $storeid, undef, 1),
 	};
 
 	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