[pve-devel] [PATCH manager v3 2/7] include a 'status' field for storages

Dominik Csapak d.csapak at proxmox.com
Mon May 8 12:31:46 CEST 2017


by default it is unknown,
if we have rrd stats, we set it to ''
because we do not know the *real* status, but want to indicate
we have *some* status information

we can use this information for the tree

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
we could in the future add additional information about the storage here,
e.g. if we could reach it (in case of network storage)

then we could have a more useful status
 PVE/API2Tools.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index 78eb4718..9a4e17c4 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -116,11 +116,17 @@ sub extract_storage_stats {
 	storage => $storeid, 
 	node => $node, 
 	type => 'storage', 
+	status => 'unknown',
     }; 
 
     if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
 	$entry->{maxdisk} = ($d->[1] || 0) + 0;
 	$entry->{disk} = ($d->[2] || 0) + 0;
+	# we have rrd data here, but cannot say anything about the real status
+	# because we do not know if it is network storage, local, etc.
+	# and a 'known' status does not give us any benefit
+	# so we set it to the empty string
+	$entry->{status} = '';
     }
 
     return $entry;
-- 
2.11.0





More information about the pve-devel mailing list