[pve-devel] [PATCH manager] gui: ceph: parse the whole message for monitor ids

Dominik Csapak d.csapak at proxmox.com
Thu Jul 4 15:36:13 CEST 2019


sometimes a monitor id is only mentioned in a later part of the message
not always the first

for example, if more than one monitor is missing the msgr2 protocol
each monitor gets its own line

before this patch the whole error would only be attributed to the first
monitor mentioned, now it is attributed to all

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
best viewed with '-w' since it is mostly one indentation level more
 www/manager6/ceph/Services.js | 37 +++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/www/manager6/ceph/Services.js b/www/manager6/ceph/Services.js
index 4aea9f32..3d10a7ed 100644
--- a/www/manager6/ceph/Services.js
+++ b/www/manager6/ceph/Services.js
@@ -75,26 +75,29 @@ Ext.define('PVE.ceph.Services', {
 			return;
 		    }
 
-		    var match = value.detail[0].message.match(/mon.([a-zA-Z0-9\-\.]+)/);
-		    if (!match) {
-			return;
-		    }
-		    var monid = match[1];
+		    var i;
+		    for (i = 0; i < value.detail.length; i++) {
+			var match = value.detail[i].message.match(/mon.([a-zA-Z0-9\-\.]+)/);
+			if (!match) {
+			    continue;
+			}
+			var monid = match[1];
 
-		    if (!monmessages[monid]) {
-			monmessages[monid] = {
-			    worstSeverity: healthstates.HEALTH_OK,
-			    messages: []
-			};
-		    }
+			if (!monmessages[monid]) {
+			    monmessages[monid] = {
+				worstSeverity: healthstates.HEALTH_OK,
+				messages: []
+			    };
+			}
 
 
-		    monmessages[monid].messages.push(
-			PVE.Utils.get_ceph_icon_html(value.severity, true) +
-			Ext.Array.reduce(value.detail, reduceFn, '')
-		    );
-		    if (healthstates[value.severity] < monmessages[monid].worstSeverity) {
-			monmessages[monid].worstSeverity = healthstates[value.severity];
+			monmessages[monid].messages.push(
+							 PVE.Utils.get_ceph_icon_html(value.severity, true) +
+							 Ext.Array.reduce(value.detail, reduceFn, '')
+			);
+			if (healthstates[value.severity] < monmessages[monid].worstSeverity) {
+			    monmessages[monid].worstSeverity = healthstates[value.severity];
+			}
 		    }
 		});
 	    }
-- 
2.20.1





More information about the pve-devel mailing list