From: John Mulligan Date: Wed, 26 Mar 2025 17:37:04 +0000 (-0400) Subject: cephadm: stop sidecar systemd units when restarting main units X-Git-Tag: testing/wip-jcollin-testing-20250820.041311-squid~90^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0844a113b7e9a698ddf493401e557c76e299c6d1;p=ceph-ci.git 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) --- 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: