From 0844a113b7e9a698ddf493401e557c76e299c6d1 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 26 Mar 2025 13:37:04 -0400 Subject: [PATCH] cephadm: stop sidecar systemd units when restarting main units Previously, sidecar units might (will) not be stopped when the primary unit is stopped. This breaks the normal cephadm workflow to redeploy: stop and then start the services. This patch reuses the logic from the service stop to stop the individual sidecars. Note: the sidecars are not individually started as that should already be handled automatically when starting the primary service! Co-authored-by: Adam King Signed-off-by: Adam King Signed-off-by: John Mulligan (cherry picked from commit cc2872c0cb8d2dfefac540af852a62f325038b92) --- src/cephadm/cephadm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 6854fa22b23..87eb55ab92e 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1219,6 +1219,17 @@ def deploy_daemon_units( verbosity=CallVerbosity.DEBUG) call(ctx, ['systemctl', 'reset-failed', unit_name], verbosity=CallVerbosity.DEBUG) + + # TODO: this should happen automatically some day + sd_path_info = systemd_unit.sidecars_from_dropin( + systemd_unit.PathInfo(ctx.unit_dir, ident), missing_ok=True + ) + for sc_unit in sd_path_info.sidecar_unit_files.values(): + call(ctx, ['systemctl', 'stop', sc_unit.name], + verbosity=CallVerbosity.DEBUG) + call(ctx, ['systemctl', 'reset-failed', sc_unit.name], + verbosity=CallVerbosity.DEBUG) + if enable: call_throws(ctx, ['systemctl', 'enable', unit_name]) if start: -- 2.39.5