From: Shweta Bhosale Date: Thu, 23 Oct 2025 15:06:06 +0000 (+0530) Subject: mgr/cephadm: Signal handling while daemon reconfig X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ef8a1e2f378f13afc695be74590d3ffc3454dcb;p=ceph.git mgr/cephadm: Signal handling while daemon reconfig Fixes: https://tracker.ceph.com/issues/73633 Signed-off-by: Shweta Bhosale --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 7cf65220c80..201b0319ba9 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1202,10 +1202,15 @@ def deploy_daemon( # If this was a reconfig and the daemon is not a Ceph daemon, restart it # so it can pick up potential changes to its configuration files if deployment_type == DeploymentType.RECONFIG and daemon_type not in ceph_daemons(): - # ceph daemons do not need a restart; others (presumably) do to pick - # up the new config - call_throws(ctx, ['systemctl', 'reset-failed', ident.unit_name]) - call_throws(ctx, ['systemctl', 'restart', ident.unit_name]) + if not ctx.skip_restart_for_reconfig: + # ceph daemons do not need a restart; others (presumably) do to pick + # up the new config + call_throws(ctx, ['systemctl', 'reset-failed', ident.unit_name]) + call_throws(ctx, ['systemctl', 'restart', ident.unit_name]) + elif ctx.send_signal_to_daemon: + ctx.signal_name = ctx.send_signal_to_daemon + ctx.signal_number = None + command_signal(ctx) def clean_cgroup(ctx: CephadmContext, fsid: str, unit_name: str) -> None: @@ -4896,6 +4901,18 @@ def _add_deploy_parser_args( default=None, help='Time in seconds to wait for graceful service shutdown before forcefully killing it' ) + parser_deploy.add_argument( + '--skip-restart-for-reconfig', + action='store_true', + default=False, + help='skip restart for non ceph daemons and perform default action' + ) + parser_deploy.add_argument( + '--send-signal-to-daemon', + action='store_true', + default=False, + help='Send signal to daemon' + ) def _name_opts(parser: argparse.ArgumentParser) -> None: diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index ef4699838d1..bad6568f500 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2710,7 +2710,9 @@ Then run the following: def _daemon_action(self, daemon_spec: CephadmDaemonDeploySpec, action: str, - image: Optional[str] = None) -> str: + image: Optional[str] = None, + skip_restart_for_reconfig: bool = False, + send_signal_to_daemon: Optional[str] = None) -> str: self._daemon_action_set_image(action, image, daemon_spec.daemon_type, daemon_spec.daemon_id) @@ -2735,7 +2737,9 @@ Then run the following: daemon_spec) with self.async_timeout_handler(daemon_spec.host, f'cephadm deploy ({daemon_spec.daemon_type} daemon)'): return self.wait_async( - CephadmServe(self)._create_daemon(daemon_spec, reconfig=(action == 'reconfig'))) + CephadmServe(self)._create_daemon(daemon_spec, reconfig=(action == 'reconfig'), + skip_restart_for_reconfig=skip_restart_for_reconfig, + send_signal_to_daemon=send_signal_to_daemon)) actions = { 'start': ['reset-failed', 'start'], diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 1f1b5c2fd6f..4f5d37250e2 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1182,6 +1182,8 @@ class CephadmServe: dd.hostname, dd.name() ) ) + skip_restart_for_reconfig = False + send_signal_to_daemon = None if not last_config: self.log.info('Reconfiguring %s (unknown last config time)...' % ( dd.name())) @@ -1231,7 +1233,9 @@ class CephadmServe: action = 'redeploy' try: daemon_spec = CephadmDaemonDeploySpec.from_daemon_description(dd) - self.mgr._daemon_action(daemon_spec, action=action) + self.mgr._daemon_action(daemon_spec, action=action, + skip_restart_for_reconfig=skip_restart_for_reconfig, + send_signal_to_daemon=send_signal_to_daemon) if self.mgr.cache.rm_scheduled_daemon_action(dd.hostname, dd.name()): self.mgr.cache.save_host(dd.hostname) except OrchestratorError as e: @@ -1411,6 +1415,8 @@ class CephadmServe: daemon_spec: CephadmDaemonDeploySpec, reconfig: bool = False, osd_uuid_map: Optional[Dict[str, Any]] = None, + skip_restart_for_reconfig: bool = False, + send_signal_to_daemon: Optional[str] = None, ) -> str: daemon_params: Dict[str, Any] = {} @@ -1451,6 +1457,10 @@ class CephadmServe: if reconfig: daemon_params['reconfig'] = True + if skip_restart_for_reconfig: + daemon_params['skip_restart_for_reconfig'] = True + if send_signal_to_daemon: + daemon_params['send_signal_to_daemon'] = send_signal_to_daemon if self.mgr.allow_ptrace: daemon_params['allow_ptrace'] = True