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

Dominik Csapak d.csapak at proxmox.com
Wed May 29 15:33:08 CEST 2019


and highlight the not current osds

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph/OSD.pm     |  4 ++++
 www/manager6/ceph/OSD.js | 34 +++++++++++++++++++++++++++++++---
 2 files changed, 35 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..bf4034aa 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -177,6 +177,22 @@ Ext.define('PVE.node.CephOsdTree', {
 	    width: 80
 	},
 	{
+	    text: gettext('Version'),
+	    dataIndex: 'version',
+	    renderer: function(value, metadata, rec) {
+		var me = this;
+		if (value < me.maxversion) {
+		    return PVE.Utils.get_ceph_icon_html('HEALTH_OLD') + value;
+		}
+
+		if (!value && rec.data.type == 'host') {
+		    return '<i class="fa faded fa-cube"></i> ' + me.versions[rec.data.name];
+		}
+
+		return value;
+	    }
+	},
+	{
 	    text: 'weight',
 	    dataIndex: 'crush_weight',
 	    align: 'right',
@@ -265,6 +281,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 +308,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 (version > me.maxversion) {
+			    me.maxversion = version;
+			}
+		    });
 		    set_button_status();
 		}
 	    });
@@ -484,6 +509,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