]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Only start ranked daemon with highest rank gen, if many daemon exists...
authorShweta Bhosale <Shweta.Bhosale1@ibm.com>
Tue, 11 Nov 2025 12:38:03 +0000 (18:08 +0530)
committerShweta Bhosale <Shweta.Bhosale1@ibm.com>
Tue, 30 Jun 2026 12:52:11 +0000 (18:22 +0530)
If the removal of an extra NFS daemon fails for any reason, that daemon should not be started, as the NFS daemon with the highest rank generation is already running.

Fixes: https://tracker.ceph.com/issues/73442
Signed-off-by: Shweta Bhosale <Shweta.Bhosale1@ibm.com>
src/pybind/mgr/cephadm/serve.py

index c518baa4d51af0934b99e99d751d85b99693a074..e82a6daf1ca9af092ad2f7659f947fc1b8d98ecd 100644 (file)
@@ -1246,8 +1246,28 @@ class CephadmServe:
             # If no action is specified, check whether we need to start the daemon
             if not action and dd.daemon_type in DISABLED_SERVICES:
                 if dd.status == 0 and not dd.user_stopped:
-                    self.log.debug(f'Starting daemon {dd.name()}')
-                    action = 'start'
+                    should_start = False
+                    if spec and service_registry.get_service(daemon_type_to_service(dd.daemon_type)).ranked(spec):
+                        # For ranked services, check if we should start this daemon
+                        same_rank_daemons = [
+                            d for d in self.mgr.cache.get_daemons_by_service(dd.service_name())
+                            if d.rank == dd.rank and d.daemon_type == dd.daemon_type
+                        ]
+                        self.log.debug(
+                            f'Start hightest rank_gen daemon of same rank daemons {same_rank_daemons}'
+                        )
+                        if len(same_rank_daemons) == 1:
+                            should_start = True
+                        else:
+                            # Multiple daemons exist for this rank, only start the highest generation
+                            highest_gen_daemon = max(same_rank_daemons,
+                                                     key=lambda d: d.rank_generation or 0)
+                            should_start = (dd == highest_gen_daemon)
+                    else:
+                        should_start = True
+                    if should_start:
+                        self.log.debug(f'Starting daemon {dd.name()}')
+                        action = 'start'
 
             if action:
                 if scheduled_action == 'redeploy' and action == 'reconfig':