From: Shweta Bhosale Date: Tue, 11 Nov 2025 12:38:03 +0000 (+0530) Subject: mgr/cephadm: Only start ranked daemon with highest rank gen, if many daemon exists... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51504dbf2a12a125930b0f4cd14a35553093f820;p=ceph.git mgr/cephadm: Only start ranked daemon with highest rank gen, if many daemon exists with same rank 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 --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index c518baa4d51..e82a6daf1ca 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -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':