]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: use new choose_next_action when so configured
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 9 Mar 2026 20:03:28 +0000 (16:03 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 26 Mar 2026 13:31:39 +0000 (09:31 -0400)
Use the newly added choose_next_action when a CephadmService subclasss
sets the manages_own_next_action class attribute to true.
This allows us to incrementally "opt in" classes to use
the choose_next_action method until all classes have been updated
to use that instead of code directly in _check_daemons.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/serve.py

index ee969ab628beb0ab89ebc20dfcce66b2a87cab6d..9146a925ff9eeb004c52e8ba0a0448d697f7c934 100644 (file)
@@ -1173,6 +1173,30 @@ class CephadmServe:
                     f'{dd.name()} daemon entrypoint args {dd.extra_entrypoint_args} -> {spec.extra_entrypoint_args}')
                 dd.extra_entrypoint_args = spec.extra_entrypoint_args
                 action = 'redeploy'
+            elif svc_obj.manages_own_next_action:
+                # method uses new action enum type
+                _scheduled_action = utils.Action.create(scheduled_action)
+                _action = svc_obj.choose_next_action(
+                    _scheduled_action,
+                    dd.daemon_type,
+                    spec,
+                    curr_deps=deps,
+                    last_deps=last_deps,
+                )
+                if _action is not _scheduled_action:
+                    self.log.info(
+                        (
+                            'Daemon %s chose new action %s (was %s)'
+                            ' (deps: %r, last_deps: %r)'
+                        ),
+                        dd.name(),
+                        _action,
+                        _scheduled_action,
+                        deps,
+                        last_deps,
+                    )
+                    # convert back to legacy str type
+                    action = str(_action)
             elif last_deps != deps:
                 sym_diff = set(deps).symmetric_difference(last_deps)
                 self.log.info(f'Reconfiguring {dd.name()} deps {last_deps} -> {deps} (diff {sym_diff})')