From: John Mulligan Date: Mon, 9 Mar 2026 23:03:46 +0000 (-0400) Subject: mgr/cephadm: move ceph specific action checks to function X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0a76eed0874b787cca6f788530407bb2b6a39890;p=ceph.git mgr/cephadm: move ceph specific action checks to function Move core ceph type services next action check to the _ceph_service_needs_reconfig helper function. This is a private helper that does not use choose_next_action because of the additional needs for the last_config and monmap/extra conf that no other service needed to care about. Moving the logic to a function shrinks the already-long _check_daemons a bit and makes it possible to stop checking for services that don't use choose_next_action in a future commit. Plus cephadm always treats core ceph services a bit special anyway, right? :-) Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 5b49ee395e24..a3af2ad10dbd 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1201,15 +1201,9 @@ class CephadmServe: sym_diff = set(deps).symmetric_difference(last_deps) self.log.info(f'Reconfiguring {dd.name()} deps {last_deps} -> {deps} (diff {sym_diff})') action = 'reconfig' - elif self.mgr.last_monmap and \ - self.mgr.last_monmap > last_config and \ - dd.daemon_type in CEPH_TYPES: - self.log.info('Reconfiguring %s (monmap changed)...' % dd.name()) - action = 'reconfig' - elif self.mgr.extra_ceph_conf_is_newer(last_config) and \ - dd.daemon_type in CEPH_TYPES: - self.log.info('Reconfiguring %s (extra config changed)...' % dd.name()) - action = 'reconfig' + action = _ceph_service_next_action( + action, dd.daemon_type, dd.name(), self.mgr, last_config + ) if action: if scheduled_action == 'redeploy' and action == 'reconfig': @@ -1893,3 +1887,26 @@ def _host_selector(svc: Any) -> Optional[HostSelector]: if hasattr(svc, 'filter_host_candidates'): return cast(HostSelector, svc) return None + + +def _ceph_service_next_action( + action: Optional[str], + daemon_type: str, + name: str, + mgr: 'CephadmOrchestrator', + last_config: Optional[datetime.datetime], +) -> Optional[str]: + if daemon_type not in CEPH_TYPES: + return action + if last_config is None: + return action + if action in ['reconfig', 'redeploy']: + return action + + if mgr.last_monmap and mgr.last_monmap > last_config: + logger.info('Reconfiguring %s (monmap changed)...', name) + return 'reconfig' + if mgr.extra_ceph_conf_is_newer(last_config): + logger.info('Reconfiguring %s (extra config changed)...', name) + return 'reconfig' + return action