r = False
return r
- def _apply_all_services(self):
- r = False
- specs = [] # type: List[ServiceSpec]
- for sn, spec in self.spec_store.specs.items():
- specs.append(spec)
- for spec in specs:
- try:
- if self._apply_service(spec):
- r = True
- except Exception as e:
- self.log.exception('Failed to apply %s spec %s: %s' % (
- spec.service_name(), spec, e))
- self.events.for_service(spec, 'ERROR', 'Failed to apply: ' + str(e))
-
- return r
-
def _check_pool_exists(self, pool, service_name):
logger.info(f'Checking pool "{pool}" exists for service {service_name}')
if not self.rados.pool_exists(pool):
remoto = None
from ceph.deployment import inventory
+from ceph.deployment.service_spec import ServiceSpec
import orchestrator
from cephadm.utils import forall_hosts, cephadmNoImage, str_to_datetime
if self.mgr.migration.is_migration_ongoing():
continue
- if self.mgr._apply_all_services():
+ if self._apply_all_services():
continue # did something, refresh
self.mgr._check_daemons()
'detail': daemon_detail,
}
self.mgr.set_health_checks(self.mgr.health_checks)
+
+ def _apply_all_services(self) -> bool:
+ r = False
+ specs = [] # type: List[ServiceSpec]
+ for sn, spec in self.mgr.spec_store.specs.items():
+ specs.append(spec)
+ for spec in specs:
+ try:
+ if self.mgr._apply_service(spec):
+ r = True
+ except Exception as e:
+ self.log.exception('Failed to apply %s spec %s: %s' % (
+ spec.service_name(), spec, e))
+ self.mgr.events.for_service(spec, 'ERROR', 'Failed to apply: ' + str(e))
+
+ return r
def assert_rm_service(cephadm, srv_name):
assert wait(cephadm, cephadm.remove_service(srv_name)) == f'Removed service {srv_name}'
- cephadm._apply_all_services()
+ CephadmServe(cephadm)._apply_all_services()
@contextmanager
specs = [d.spec for d in wait(cephadm_module, cephadm_module.describe_service())]
assert spec in specs
- cephadm_module._apply_all_services()
+ CephadmServe(cephadm_module)._apply_all_services()
dds = wait(cephadm_module, cephadm_module.list_daemons())
own_dds = [dd for dd in dds if dd.service_name() == spec.service_name()]
_run_cephadm.return_value = (['{}'], '', 0)
- assert cephadm_module._apply_all_services() == False
+ assert CephadmServe(cephadm_module)._apply_all_services() == False
_run_cephadm.assert_any_call(
'test', 'osd', 'ceph-volume',
c = cephadm_module.apply_mds(spec)
out = wait(cephadm_module, c)
match_glob(out, "Scheduled mds.fsname update...")
- cephadm_module._apply_all_services()
+ CephadmServe(cephadm_module)._apply_all_services()
[daemon] = cephadm_module.cache.daemons['host1'].keys()
c = cephadm_module.apply_mds(spec)
out = wait(cephadm_module, c)
match_glob(out, "Scheduled mds.fsname update...")
- cephadm_module._apply_all_services()
+ CephadmServe(cephadm_module)._apply_all_services()
ok_to_stop.assert_called_with([daemon[4:]])
assert wait(cephadm_module, c) == 'Scheduled rgw.r.z update...'
# with pytest.raises(OrchestratorError, match="cephadm migration still ongoing. Please wait, until the migration is complete."):
- cephadm_module._apply_all_services()
+ CephadmServe(cephadm_module)._apply_all_services()
cephadm_module.migration_current = 0
cephadm_module.migration.migrate()
CephadmServe(cephadm_module)._refresh_hosts_and_daemons()
cephadm_module.migration.migrate()
- cephadm_module._apply_all_services()
+ CephadmServe(cephadm_module)._apply_all_services()
out = {o.hostname for o in wait(cephadm_module, cephadm_module.list_daemons())}
assert out == {'host1', 'host2'}