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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 24 12:45: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>
---

changes v2 -> v3:
* this patch is new in this version

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

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index ee2295a..cdb2e15 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1084,8 +1084,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) {
@@ -1107,6 +1105,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;
@@ -1115,6 +1114,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