if v:
setattr(sd, k, str_to_datetime(d[k]))
sd.daemon_type = d['name'].split('.')[0]
+ if sd.daemon_type not in ServiceSpec.KNOWN_SERVICE_TYPES:
+ logger.warning(f"Found unknown service type {sd.daemon_type} on host {host}")
+ continue
+
sd.daemon_id = '.'.join(d['name'].split('.')[1:])
sd.hostname = host
sd.container_id = d.get('container_id')
sd.ports = d.get('ports')
sd.ip = d.get('ip')
sd.rank = int(d['rank']) if d.get('rank') is not None else None
- sd.rank_generation = int(d['rank_generation']) if d.get('rank_generation') is not None else None
+ sd.rank_generation = int(d['rank_generation']) if d.get(
+ 'rank_generation') is not None else None
if sd.daemon_type == 'osd':
sd.osdspec_affinity = self.mgr.osd_service.get_osdspec_affinity(sd.daemon_id)
if 'state' in d:
container_id='container_id',
version='version',
state='running',
- )
+ ),
+ dict(
+ name='something.foo.bar',
+ style='cephadm',
+ fsid='fsid',
+ ),
+
])
))
def test_list_daemons(self, cephadm_module: CephadmOrchestrator):
cephadm_module.service_cache_timeout = 10
with with_host(cephadm_module, 'test'):
CephadmServe(cephadm_module)._refresh_host_daemons('test')
- c = cephadm_module.list_daemons()
- assert wait(cephadm_module, c)[0].name() == 'rgw.myrgw.foobar'
+ dds = wait(cephadm_module, cephadm_module.list_daemons())
+ assert len(dds) == 1
+ assert dds[0].name() == 'rgw.myrgw.foobar'
@mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('[]'))
def test_daemon_action(self, cephadm_module: CephadmOrchestrator):