]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: move ceph specific action checks to function
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 9 Mar 2026 23:03:46 +0000 (19:03 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 26 Mar 2026 13:31:39 +0000 (09:31 -0400)
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 <jmulligan@redhat.com>
src/pybind/mgr/cephadm/serve.py

index 5b49ee395e244985b8bce004d855885f86072a32..a3af2ad10dbdce76ae95486b8ddde42812793b3b 100644 (file)
@@ -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