]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: sort servers and OSDs in OSD list 17993/head
authorJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 14:13:48 +0000 (15:13 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 14:14:58 +0000 (15:14 +0100)
Fixes: http://tracker.ceph.com/issues/21572
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/dashboard/module.py

index 0a7c625be3183a6c0783d160d698accae0559d42..114271caea81306fd4b3dff12b0ddd32069d5ac8 100644 (file)
@@ -965,7 +965,6 @@ class Module(MgrModule):
                 for server in servers:
                     hostname = server['hostname']
                     services = server['services']
-                    first = True
                     for s in services:
                         if s["type"] == "osd":
                             osd_id = int(s["id"])
@@ -977,18 +976,18 @@ class Module(MgrModule):
                             summary = self._osd_summary(osd_id,
                                                         osd_map.osds_by_id[osd_id])
 
-                            if first:
-                                # A little helper for rendering
-                                summary['first'] = True
-                                first = False
                             result[hostname].append(summary)
 
+                    result[hostname].sort(key=lambda a: a['id'])
+                    if len(result[hostname]):
+                        result[hostname][0]['first'] = True
+
                 global_instance().log.warn("result.size {0} servers.size {1}".format(
                     len(result), len(servers)
                 ))
 
                 # Return list form for convenience of rendering
-                return result.items()
+                return sorted(result.items(), key=lambda a: a[0])
 
             @cherrypy.expose
             def index(self):