gui: ceph: add metadata api call to dashboard

and use it for displaying outdated osds

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-05-27 14:14:02 +02:00 committed by Thomas Lamprecht
parent 813b9a0fc2
commit a23565f4b1
2 changed files with 58 additions and 2 deletions

View File

@ -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();
}

View File

@ -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));