]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #64951 from rhcs-dashboard/72522-remove-service-instances
authorafreen23 <afreen23.git@gmail.com>
Mon, 25 Aug 2025 12:03:07 +0000 (17:33 +0530)
committerGitHub <noreply@github.com>
Mon, 25 Aug 2025 12:03:07 +0000 (17:33 +0530)
mgr/dashboard : 72522 - Remove service instances column to imporve API perf

Reviewed-by: Afreen Misbah <afreen@ibm.com>
1  2 
src/pybind/mgr/dashboard/controllers/host.py
src/pybind/mgr/dashboard/tests/test_host.py

index aebfa0e31f643d9242c5feb64b631fc00ca86095,ff7971cd3556ff4741b8aceab618b24cf2ffbf39..e37b61173275b431483a4f0b64532086ef4ba569
@@@ -105,50 -105,33 +105,51 @@@ class HostControllerTest(ControllerTest
                  'ceph': True,
                  'orchestrator': False
              },
 +            'addr': '',
 +            'cpu_cores': 0,
 +            'model': '',
 +            'nic_count': 0,
 +            'hdd_count': 0,
 +            'flash_count': 0,
 +            'hdd_capacity_bytes': 0,
 +            'flash_capacity_bytes': 0,
              'cpu_count': 1,
              'memory_total_kb': 1024,
-             'services': [],
-             'service_instances': [{'type': 'mon', 'count': 1}]
+             'services': []
          }, {
              'hostname': 'host-1',
              'sources': {
                  'ceph': False,
                  'orchestrator': True
              },
 +            'addr': '',
 +            'cpu_cores': 0,
 +            'model': '',
 +            'nic_count': 0,
 +            'hdd_count': 0,
 +            'flash_count': 0,
 +            'hdd_capacity_bytes': 0,
 +            'flash_capacity_bytes': 0,
              'cpu_count': 2,
              'memory_total_kb': 1024,
-             'services': [],
-             'service_instances': [{'type': 'mon', 'count': 1}]
+             'services': []
          }]
          # test with orchestrator available
          with patch_orch(True, hosts=hosts_without_facts) as fake_client:
              mock_get_hosts.return_value = hosts_without_facts
  
 -            def get_facts_mock(hostname: str):
 -                if hostname == 'host-0':
 -                    return [hosts_facts[0]]
 -                return [hosts_facts[1]]
 +            def get_facts_mock(*args, **_kwargs):
 +                if args:
 +                    hostname = args[0]
 +                    return [hosts_facts[0]] if hostname == 'host-0' else [hosts_facts[1]]
 +                return hosts_facts
 +
              fake_client.hosts.get_facts.side_effect = get_facts_mock
-             # test with ?facts=true
-             self._get('{}?facts=true'.format(self.URL_HOST), version=APIVersion(1, 3))
+             # test with ?facts=true (explicitly disable service_instances)
+             self._get(
+                 '{}?facts=true&include_service_instances=false'.format(self.URL_HOST),
+                 version=APIVersion(1, 3)
+             )
              self.assertStatus(200)
              self.assertHeader('Content-Type',
                                APIVersion(1, 3).to_mime_type())