]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add custom choose_next_action to nfs service
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 9 Mar 2026 20:03:48 +0000 (16:03 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 26 Mar 2026 13:31:39 +0000 (09:31 -0400)
The nfs service needs to use the deps difference to detect
if any non-kmip related dependencies changed and force a
redeploy instead of a reconfig when so.

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

index d622e68e4b82960f14ba39c8893d9ed3bded7320..e888876a666690186b93eea03833c85b0e930220 100644 (file)
@@ -435,3 +435,34 @@ class NFSService(CephService):
             if not monitoring_addr:
                 logger.debug(f"No IP address found in the network {spec.monitoring_networks} on host {host}.")
         return monitoring_addr, monitoring_port
+
+    manages_own_next_action = True
+
+    def choose_next_action(
+        self,
+        scheduled_action: utils.Action,
+        daemon_type: Optional[str],
+        spec: Optional[ServiceSpec],
+        curr_deps: List[str],
+        last_deps: List[str],
+    ) -> utils.Action:
+        """Given the scheduled_action, service spec, daemon_type, and
+        current and previous dependency lists return the next action that
+        this service would prefer cephadm take.
+        """
+        if curr_deps == last_deps:
+            return scheduled_action
+        sym_diff = set(curr_deps).symmetric_difference(last_deps)
+        logger.info(
+            'Reconfigure wanted %s: deps %r -> %r (diff %r)',
+            spec.service_name() if spec else daemon_type,
+            last_deps,
+            curr_deps,
+            sym_diff,
+        )
+        action = utils.Action.RECONFIG
+        # check what has changed, based on that decide action
+        only_kmip_updated = all(s.startswith('kmip') for s in sym_diff)
+        if not only_kmip_updated:
+            action = utils.Action.REDEPLOY
+        return action