From 0af93023882bd0d53f8d223d953ebd977681747c Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Tue, 8 Apr 2025 00:30:08 +0530 Subject: [PATCH] mgr/dashboard: Fix empty ceph version in GET api/hosts Fixes https://tracker.ceph.com/issues/70821 Due to the pagination the host list is being fetched from orchestrator which caused a regression as via orchestrator list ceph version is always marked empty. Caused by https://github.com/ceph/ceph/pull/52154 Also fixed tests , as the new version addition causing whole json object mock to fail in tests Signed-off-by: Afreen Misbah (cherry picked from commit 1aa74cf3fce6394ad08e83e91a90923d983b03c5) --- src/pybind/mgr/dashboard/controllers/host.py | 2 +- src/pybind/mgr/dashboard/tests/test_host.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index d2263b7323865..9681d45ab5b2c 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -146,7 +146,7 @@ def get_hosts(sources=None): hosts = [ merge_dicts( { - 'ceph_version': '', + 'ceph_version': mgr.version, 'services': [], 'sources': { 'ceph': False, diff --git a/src/pybind/mgr/dashboard/tests/test_host.py b/src/pybind/mgr/dashboard/tests/test_host.py index 8a86d3b4ba522..99fd6ce3d84b3 100644 --- a/src/pybind/mgr/dashboard/tests/test_host.py +++ b/src/pybind/mgr/dashboard/tests/test_host.py @@ -187,6 +187,7 @@ class HostControllerTest(ControllerTestCase): def test_get_3(self): mgr.list_servers.return_value = [] + mgr.version = 'ceph version 16.0.0-3151-gf202994fcf' with patch_orch(True, hosts=[HostSpec('node1')]): self._get('{}/node1'.format(self.URL_HOST)) @@ -197,6 +198,7 @@ class HostControllerTest(ControllerTestCase): def test_populate_service_instances(self): mgr.list_servers.return_value = [] + mgr.version = 'ceph version 16.0.0-3151-gf202994fcf' node1_daemons = [ DaemonDescription( -- 2.39.5