]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: dynamically populate mirroring warning/errors 16360/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 17 Jul 2017 20:44:22 +0000 (16:44 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 18 Jul 2017 14:47:50 +0000 (10:47 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/pybind/mgr/dashboard/rbd_mirroring.py

index a03dcb027628dc5161b1fc1da6c8b2965ce8766b..b4dd51bbe0a55ba1e17c9411becc74031aaf3d4a 100644 (file)
@@ -206,9 +206,24 @@ class Toplevel(RemoteViewCache):
         status, data = self.daemons_and_pools.get()
         if data is None:
             log.warning("Failed to get rbd-mirror daemons and pools")
-            daemons = []
+            daemons = {}
+        daemons = data.get('daemons', [])
+        pools = data.get('pools', {})
+
+        warnings = 0
+        errors = 0
+        for daemon in daemons:
+            if daemon['health_color'] == 'error':
+                errors += 1
+            elif daemon['health_color'] == 'warning':
+                warnings += 1
+        for pool_name, pool in pools.items():
+            if pool['health_color'] == 'error':
+                errors += 1
+            elif pool['health_color'] == 'warning':
+                warnings += 1
+        return {'warnings': warnings, 'errors': errors}
 
-        return {'warnings': 2, 'errors': 1}
 
 class ContentData(RemoteViewCache):
     def __init__(self, module_inst, daemons_and_pools, pool_data):