]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: use unique instance id as daemon identifier
authorJason Dillaman <dillaman@redhat.com>
Thu, 30 Nov 2017 19:06:32 +0000 (14:06 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 13 Dec 2017 15:41:11 +0000 (10:41 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/pybind/mgr/dashboard/rbd_mirroring.html
src/pybind/mgr/dashboard/rbd_mirroring.py

index 2720685474a04f85f946d11cce6ea3615dc0d287..c59b9bfbf1cebdebd4e8db8d53b2aedc1686e876 100644 (file)
@@ -78,8 +78,8 @@
                     <table id="daemons" class="table table-condensed">
                         <thead>
                         <tr>
-                            <th>ID</th>
                             <th>Instance</th>
+                            <th>ID</th>
                             <th>Hostname</th>
                             <th>Version</th>
                             <th>Health</th>
@@ -87,8 +87,8 @@
                         </thead>
                         <tbody>
                             <tr rv-each-daemon="daemons">
-                                <td>{daemon.id}</td>
                                 <td>{daemon.instance_id}</td>
+                                <td>{daemon.id}</td>
                                 <td>{daemon.server_hostname}</td>
                                 <td>{daemon.version | short_version}</td>
                                 <td><span rv-class="daemon.health_color | mirror_health_color">{daemon.health}</span></td>
index d8a5241d6016ea58d82f8511ca6c3748dfba3645..e549ed517278720a70c1550b9bbae9ead51358b3 100644 (file)
@@ -18,19 +18,23 @@ class DaemonsAndPools(RemoteViewCache):
         for server in self._module.list_servers():
             for service in server['services']:
                 if service['type'] == 'rbd-mirror':
-                    metadata = self._module.get_metadata('rbd-mirror',
-                                                         service['id'])
-                    status = self._module.get_daemon_status('rbd-mirror',
-                                                            service['id'])
+                    id = service['id']
+                    metadata = self._module.get_metadata('rbd-mirror', id)
+                    status = self._module.get_daemon_status('rbd-mirror', id)
                     try:
                         status = json.loads(status['json'])
                     except:
                         status = {}
 
+                    instance_id = metadata['instance_id']
+                    if (id == instance_id):
+                        # new version that supports per-cluster leader elections
+                        id = metadata['id']
+
                     # extract per-daemon service data and health
                     daemon = {
-                        'id': service['id'],
-                        'instance_id': metadata['instance_id'],
+                        'id': id,
+                        'instance_id': instance_id,
                         'version': metadata['ceph_version'],
                         'server_hostname': server['hostname'],
                         'service': service,
@@ -41,7 +45,7 @@ class DaemonsAndPools(RemoteViewCache):
                     daemon = dict(daemon, **self.get_daemon_health(daemon))
                     daemons.append(daemon)
 
-        return sorted(daemons, key=lambda k: k['id'])
+        return sorted(daemons, key=lambda k: k['instance_id'])
 
     def get_daemon_health(self, daemon):
         health = {