From: Afreen Misbah Date: Mon, 15 Dec 2025 15:53:44 +0000 (+0530) Subject: 'mgr/dashboard: Fix display of IP address in host page X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=36307be926102978e1ea40fa8d26a4ef86140394;p=ceph.git 'mgr/dashboard: Fix display of IP address in host page - Hosts data is getting merged with hosts' facts which is not sending address hence not getting displayed in UI - The value is empty hence in the API - Caused by https://github.com/ceph/ceph/pull/65102 Fixes https://tracker.ceph.com/issues/74222 Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index 818e39c7dfd6..6877146df058 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -147,6 +147,7 @@ def get_hosts(sources=None): merge_dicts( { 'ceph_version': mgr.version, + 'addr': '', 'services': [], 'sources': { 'ceph': False, @@ -300,7 +301,6 @@ class Host(RESTController): facts = facts_map.get(hostname, {}) host_facts = { 'hostname': facts.get('hostname', hostname), - 'addr': facts.get('addr', ''), 'cpu_cores': facts.get('cpu_cores', 0), 'cpu_count': facts.get('cpu_count', 0), 'model': facts.get('model', ''), diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/08-hosts.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/08-hosts.e2e-spec.ts index de366ebfdb53..6deff9fdc1fe 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/08-hosts.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/08-hosts.e2e-spec.ts @@ -14,6 +14,17 @@ describe('Host Page', () => { hosts.navigateTo(); }); + describe('should have all host details', () => { + it('should have hostname'), + () => { + cy.get('[data-testid="hostname"]').should('not.be.empty'); + }; + it('should have IP address'), + () => { + cy.get('[data-testid="ip-address"]').should('not.be.empty'); + }; + }); + // rgw is needed for testing the force maintenance it('should create rgw services', () => { services.navigateTo('create'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html index 19c8e6309b83..9ea40658b1be 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html @@ -72,11 +72,12 @@ - + {{ row.hostname }}
+ *ngIf="row.addr" + data-testid="ip-address"> ({{ row.addr }})
diff --git a/src/pybind/mgr/dashboard/tests/test_host.py b/src/pybind/mgr/dashboard/tests/test_host.py index 0048e89d097c..27b5215425d1 100644 --- a/src/pybind/mgr/dashboard/tests/test_host.py +++ b/src/pybind/mgr/dashboard/tests/test_host.py @@ -77,12 +77,14 @@ class HostControllerTest(ControllerTestCase): def test_host_list_with_facts(self, mock_get_hosts): hosts_without_facts = [{ 'hostname': 'host-0', + 'addr': '192.168.1.1', 'sources': { 'ceph': True, 'orchestrator': False } }, { 'hostname': 'host-1', + 'addr': '192.168.1.2', 'sources': { 'ceph': False, 'orchestrator': True @@ -101,11 +103,11 @@ class HostControllerTest(ControllerTestCase): hosts_with_facts = [{ 'hostname': 'host-0', + 'addr': '192.168.1.1', 'sources': { 'ceph': True, 'orchestrator': False }, - 'addr': '', 'cpu_cores': 0, 'model': '', 'nic_count': 0, @@ -118,11 +120,11 @@ class HostControllerTest(ControllerTestCase): 'services': [] }, { 'hostname': 'host-1', + 'addr': '192.168.1.2', 'sources': { 'ceph': False, 'orchestrator': True }, - 'addr': '', 'cpu_cores': 0, 'model': '', 'nic_count': 0,