diff --git a/src/pybind/mgr/dashboard/rbd_ls.py b/src/pybind/mgr/dashboard/rbd_ls.py index 87315a91bb4..ba27b3ab3d2 100644 --- a/src/pybind/mgr/dashboard/rbd_ls.py +++ b/src/pybind/mgr/dashboard/rbd_ls.py @@ -10,20 +10,8 @@ class RbdPoolLs(RemoteViewCache): osd_map = self._module.get_sync_object(OsdMap).data - osd_pools = [pool['pool_name'] for pool in osd_map['pools']] - - rbd_pools = [] - for pool in osd_pools: - self.log.debug("Constructing IOCtx " + pool) - try: - ioctx = self._module.rados.open_ioctx(pool) - ioctx.stat("rbd_directory") - rbd_pools.append(pool) - except (rados.PermissionError, rados.ObjectNotFound): - self.log.debug("No RBD directory in " + pool) - except: - self.log.exception("Failed to open pool " + pool) - + rbd_pools = [pool['pool_name'] for pool in osd_map['pools'] if \ + 'rbd' in pool.get('application_metadata', {})] return rbd_pools class RbdLs(RemoteViewCache): diff --git a/src/pybind/mgr/dashboard/rbd_mirroring.html b/src/pybind/mgr/dashboard/rbd_mirroring.html index 2720685474a..c59b9bfbf1c 100644 --- a/src/pybind/mgr/dashboard/rbd_mirroring.html +++ b/src/pybind/mgr/dashboard/rbd_mirroring.html @@ -78,8 +78,8 @@ - + @@ -87,8 +87,8 @@ - + diff --git a/src/pybind/mgr/dashboard/rbd_mirroring.py b/src/pybind/mgr/dashboard/rbd_mirroring.py index d8a5241d601..e549ed51727 100644 --- a/src/pybind/mgr/dashboard/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/rbd_mirroring.py @@ -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 = { diff --git a/src/tools/rbd_mirror/ServiceDaemon.cc b/src/tools/rbd_mirror/ServiceDaemon.cc index 2f4873912b9..5b8a87ca136 100644 --- a/src/tools/rbd_mirror/ServiceDaemon.cc +++ b/src/tools/rbd_mirror/ServiceDaemon.cc @@ -71,15 +71,15 @@ template int ServiceDaemon::init() { dout(20) << dendl; - std::string name = m_cct->_conf->name.get_id(); - if (name.find(RBD_MIRROR_AUTH_ID_PREFIX) == 0) { - name = name.substr(RBD_MIRROR_AUTH_ID_PREFIX.size()); + std::string id = m_cct->_conf->name.get_id(); + if (id.find(RBD_MIRROR_AUTH_ID_PREFIX) == 0) { + id = id.substr(RBD_MIRROR_AUTH_ID_PREFIX.size()); } + std::string instance_id = stringify(m_rados->get_instance_id()); std::map service_metadata = { - {"instance_id", stringify(m_rados->get_instance_id())} - }; - int r = m_rados->service_daemon_register("rbd-mirror", name, + {"id", id}, {"instance_id", instance_id}}; + int r = m_rados->service_daemon_register("rbd-mirror", instance_id, service_metadata); if (r < 0) { return r;
ID InstanceID Hostname Version Health
{daemon.id} {daemon.instance_id}{daemon.id} {daemon.server_hostname} {daemon.version | short_version} {daemon.health}