[pve-devel] [PATCH manager 11/15] gui: ceph: add metadata api call to dashboard

Dominik Csapak d.csapak at proxmox.com
Mon May 27 14:14:02 CEST 2019


and use it for displaying outdated osds

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/ceph/Status.js       | 21 +++++++++++++++++++++
 www/manager6/ceph/StatusDetail.js | 39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index 8ab74ab3..c426b88f 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -290,6 +290,15 @@ Ext.define('PVE.node.CephStatus', {
 	    }
 	});
 
+	me.metadatastore = Ext.create('Proxmox.data.UpdateStore', {
+	    storeid: 'ceph-metadata-' + (nodename || 'cluster'),
+	    interval: 15*1000,
+	    proxy: {
+		type: 'proxmox',
+		url: baseurl + 'metadata'
+	    }
+	});
+
 	// save references for the updatefunction
 	me.iops = me.down('#iops');
 	me.readiops = me.down('#readiops');
@@ -315,6 +324,18 @@ Ext.define('PVE.node.CephStatus', {
 	});
 
 	me.mon(me.store, 'load', me.updateAll, me);
+	me.mon(me.metadatastore, 'load', function(store, records, success) {
+	    if (!success || records.length < 1) {
+		return;
+	    }
+	    var rec = records[0];
+	    me.metadata = rec.data;
+
+	    // update detailstatus panel
+	    me.getComponent('statusdetail').updateAll(rec.data, me.status || {});
+
+	}, me);
+
 	me.on('destroy', me.store.stopUpdate);
 	me.store.startUpdate();
     }
diff --git a/www/manager6/ceph/StatusDetail.js b/www/manager6/ceph/StatusDetail.js
index e354b1be..4cbe408d 100644
--- a/www/manager6/ceph/StatusDetail.js
+++ b/www/manager6/ceph/StatusDetail.js
@@ -18,6 +18,9 @@ Ext.define('PVE.ceph.StatusDetail', {
     items: [{
 	flex: 1,
 	itemId: 'osds',
+	maxHeight: 250,
+	scrollable: true,
+	padding: '0 10 5 10',
 	data: {
 	    total: 0,
 	    upin: 0,
@@ -54,7 +57,17 @@ Ext.define('PVE.ceph.StatusDetail', {
 	    '<br /><div>',
 	    gettext('Total'),
 	    ': {total}',
-	    '</div>'
+	    '</div><br />',
+	    '<tpl if="oldosds">',
+	    '<i class="fa fa-refresh warning"></i> ' + gettext('Outdated OSDs') + "<br>",
+	    '<div class="osds">',
+	    '<tpl for="oldosds">',
+	    '<div class="left-aligned">osd.{id}:</div>',
+	    '<div class="right-aligned">{version}</div><br />',
+	    '<div style="clear:both"></div>',
+	    '</tpl>',
+	    '</div>',
+	    '</tpl>'
 	]
     },
     {
@@ -78,6 +91,27 @@ Ext.define('PVE.ceph.StatusDetail', {
 	var me = this;
 	me.suspendLayout = true;
 
+	var maxversion = "00.0.00";
+	Object.values(metadata.version || {}).forEach(function(version) {
+	    if (version > maxversion) {
+		maxversion = version;
+	    }
+	});
+
+	var oldosds = [];
+
+	if (metadata.osd) {
+	    metadata.osd.forEach(function(osd) {
+		var version = PVE.Utils.parse_ceph_version(osd);
+		if (version != maxversion) {
+		    oldosds.push({
+			id: osd.id,
+			version: version
+		    });
+		}
+	    });
+	}
+
 	var pgmap = status.pgmap || {};
 	var health = status.health || {};
 	var osdmap = status.osdmap || { osdmap: {} };
@@ -120,7 +154,8 @@ Ext.define('PVE.ceph.StatusDetail', {
 	    upin: upin_osds,
 	    upout: upout_osds,
 	    downin: downin_osds,
-	    downout: downout_osds
+	    downout: downout_osds,
+	    oldosds: oldosds
 	};
 	var osdcomponent = me.getComponent('osds');
 	osdcomponent.update(Ext.apply(osdcomponent.data, osds));
-- 
2.11.0





More information about the pve-devel mailing list