]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
'mgr/dashboard: Fix display of IP address in host page 66638/head
authorAfreen Misbah <afreen@ibm.com>
Mon, 15 Dec 2025 15:53:44 +0000 (21:23 +0530)
committerAfreen Misbah <afreen@ibm.com>
Mon, 29 Dec 2025 07:58:40 +0000 (13:28 +0530)
- 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 <afreen@ibm.com>
src/pybind/mgr/dashboard/controllers/host.py
src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/workflow/08-hosts.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html
src/pybind/mgr/dashboard/tests/test_host.py

index 818e39c7dfd65d8bebf8303f86f23ea355bf2293..6877146df058eb84cc00c31e8dd2f8440cd25137 100644 (file)
@@ -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', ''),
index de366ebfdb53e2df98b0060cebd96cc17da75f01..6deff9fdc1fec5c3c00b9fd0ad2b9b50bc4ebffc 100644 (file)
@@ -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');
index 19c8e6309b83b3513b6de9a1a1c4da8f0d812d63..9ea40658b1bef35e9e825d0d84ba92dbf307ff82 100644 (file)
 
 <ng-template #hostNameTpl
              let-row="data.row">
-  <span>
+  <span data-testid="hostname">
     {{ row.hostname }}
   </span><br>
   <span class="text-muted fst-italic"
-        *ngIf="row.addr">
+        *ngIf="row.addr"
+        data-testid="ip-address">
     ({{ row.addr }})
   </span>
 </ng-template>
index 0048e89d097cb303480aaf7b30f19acaff5b74de..27b5215425d1c4f177cb7b0c63cee9a438fbd245 100644 (file)
@@ -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,