From b76b680f13ef5ae68706fa9ee64f305ea1ce05c4 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 (cherry picked from commit 8b868d20c470289c2f23049ac5dbbd2ba0307385) --- 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 a4d0fbca9c74b..3492b96549806 100644 --- a/src/pybind/mgr/dashboard/services/ceph_service.py +++ b/src/pybind/mgr/dashboard/services/ceph_service.py @@ -266,13 +266,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 9a8ca674c2363..40f6eb9efa464 100644 --- a/src/pybind/mgr/dashboard/tests/test_ceph_service.py +++ b/src/pybind/mgr/dashboard/tests/test_ceph_service.py @@ -126,4 +126,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