From: Aashish Sharma Date: Wed, 10 Nov 2021 08:27:47 +0000 (+0530) Subject: mgr/dashboard: Device health status is not getting listed under hosts section X-Git-Tag: v17.1.0~424^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8b868d20c470289c2f23049ac5dbbd2ba0307385;p=ceph-ci.git 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 --- diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py index 2705f7f993a..c1e0db2daa0 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 f3350337c74..2ad9576af80 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')])