[pve-devel] [PATCH manager v2 2/4] gui/ceph: show versions in osd overview

Dominik Csapak d.csapak at proxmox.com
Fri May 31 12:15:51 CEST 2019


and highlight the not current osds

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* use compare_ceph_versions
* show 'unknown' when we do not have the version info for a node
 PVE/API2/Ceph/OSD.pm     |  4 ++++
 www/manager6/ceph/OSD.js | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 5f781e27..adb0025c 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -139,6 +139,9 @@ __PACKAGE__->register_method ({
 		} else {
 		    $new->{osdtype} = 'filestore';
 		}
+		for my $field (qw(ceph_version ceph_version_short)) {
+		    $new->{$field} = $osdmd->{$field} if $osdmd->{$field};
+		}
 	    }
 
 	    $newnodes->{$e->{id}} = $new;
@@ -175,6 +178,7 @@ __PACKAGE__->register_method ({
 
 	# we want this for the noout flag
 	$data->{flags} = $flags if $flags;
+	$data->{versions} = PVE::Cluster::get_node_kv("ceph-version");
 
 	return $data;
     }});
diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index cb3d5f0d..cae6d120 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -177,6 +177,25 @@ Ext.define('PVE.node.CephOsdTree', {
 	    width: 80
 	},
 	{
+	    text: gettext('Version'),
+	    dataIndex: 'version',
+	    renderer: function(value, metadata, rec) {
+		var me = this;
+		var icon = "";
+		var version = value || "";
+		if (value && value != me.maxversion) {
+		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_OLD');
+		}
+
+		if (!value && rec.data.type == 'host') {
+		    icon = '<i class="fa faded fa-cube"></i> ';
+		    version = me.versions[rec.data.name] || Proxmox.Utils.unknownText;
+		}
+
+		return icon + version;
+	    }
+	},
+	{
 	    text: 'weight',
 	    dataIndex: 'crush_weight',
 	    align: 'right',
@@ -265,6 +284,7 @@ Ext.define('PVE.node.CephOsdTree', {
 
 	// we expect noout to be not set by default
 	var noout = false;
+	me.maxversion = "00.0.00";
 
 	var nodename = me.pveSelNode.data.node;
 	if (!nodename) {
@@ -291,16 +311,24 @@ Ext.define('PVE.node.CephOsdTree', {
 		    );
 		},
 		success: function(response, opts) {
+		    var data = response.result.data;
 		    sm.deselectAll();
-		    me.setRootNode(response.result.data.root);
+		    me.setRootNode(data.root);
 		    me.expandAll();
 		    // extract noout flag
-		    if (response.result.data.flags &&
-			response.result.data.flags.search(/noout/) !== -1) {
+		    if (data.flags && data.flags.search(/noout/) !== -1) {
 			noout = true;
 		    } else {
 			noout = false;
 		    }
+
+		    me.versions = data.versions;
+		    // extract max version
+		    Object.values(data.versions || {}).forEach(function(version) {
+			if (PVE.Utils.compare_ceph_versions(version, me.maxversion) > 0) {
+			    me.maxversion = version;
+			}
+		    });
 		    set_button_status();
 		}
 	    });
@@ -484,6 +512,9 @@ Ext.define('PVE.node.CephOsdTree', {
 		     { type: 'string', name: 'blfsdev' },
 		     { type: 'string', name: 'dbdev' },
 		     { type: 'string', name: 'waldev' },
+		     { type: 'string', name: 'version', calculate: function(data) {
+			 return PVE.Utils.parse_ceph_version(data);
+		     } },
 		     { type: 'string', name: 'iconCls', calculate: function(data) {
 			 var iconCls = 'fa x-fa-tree fa-';
 			 switch (data.type) {
-- 
2.11.0





More information about the pve-devel mailing list