From 8b868d20c470289c2f23049ac5dbbd2ba0307385 Mon Sep 17 00:00:00 2001 From: Aashish Sharma Date: Wed, 10 Nov 2021 13:57:47 +0530 Subject: [PATCH] mgr/dashboard: Device health status is not getting listed under hosts section Device health is shown as failed to retrieve data under Hosts > Device Health section. This PR intends to fix this issue. Fixes: https://tracker.ceph.com/issues/53209 Signed-off-by: Aashish Sharma --- src/pybind/mgr/dashboard/services/ceph_service.py | 6 ++++-- src/pybind/mgr/dashboard/tests/test_ceph_service.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py index 2705f7f993ab5..c1e0db2daa01f 100644 --- a/src/pybind/mgr/dashboard/services/ceph_service.py +++ b/src/pybind/mgr/dashboard/services/ceph_service.py @@ -265,13 +265,15 @@ class CephService(object): except SendCommandError: # Try to retrieve SMART data from another daemon. continue - else: + elif 'mon' in svc_type: try: dev_smart_data = CephService.send_command( - svc_type, 'device get-health-metrics', svc_id, devid=device['devid']) + svc_type, 'device query-daemon-health-metrics', who=daemon) except SendCommandError: # Try to retrieve SMART data from another daemon. continue + else: + dev_smart_data = {} for dev_id, dev_data in dev_smart_data.items(): if 'error' in dev_data: logger.warning( diff --git a/src/pybind/mgr/dashboard/tests/test_ceph_service.py b/src/pybind/mgr/dashboard/tests/test_ceph_service.py index f3350337c74c5..2ad9576af8005 100644 --- a/src/pybind/mgr/dashboard/tests/test_ceph_service.py +++ b/src/pybind/mgr/dashboard/tests/test_ceph_service.py @@ -125,4 +125,7 @@ def test_get_smart_data_from_appropriate_ceph_command(send_command): ] CephService._get_smart_data_by_device({'devid': '1', 'daemons': ['osd.1', 'mon.1']}) send_command.assert_has_calls([mock.call('mon', 'osd tree'), - mock.call('mon', 'device get-health-metrics', '1', devid='1')]) + mock.call('osd', 'smart', '1', devid='1'), + mock.call('mon', 'osd tree'), + mock.call('mon', 'device query-daemon-health-metrics', + who='mon.1')]) -- 2.39.5