Skip to content

Commit cc2872c

Browse files
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 <[email protected]> Signed-off-by: Adam King <[email protected]> Signed-off-by: John Mulligan <[email protected]>
1 parent 95d6395 commit cc2872c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cephadm/cephadm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,17 @@ def deploy_daemon_units(
11981198
verbosity=CallVerbosity.DEBUG)
11991199
call(ctx, ['systemctl', 'reset-failed', unit_name],
12001200
verbosity=CallVerbosity.DEBUG)
1201+
1202+
# TODO: this should happen automatically some day
1203+
sd_path_info = systemd_unit.sidecars_from_dropin(
1204+
systemd_unit.PathInfo(ctx.unit_dir, ident), missing_ok=True
1205+
)
1206+
for sc_unit in sd_path_info.sidecar_unit_files.values():
1207+
call(ctx, ['systemctl', 'stop', sc_unit.name],
1208+
verbosity=CallVerbosity.DEBUG)
1209+
call(ctx, ['systemctl', 'reset-failed', sc_unit.name],
1210+
verbosity=CallVerbosity.DEBUG)
1211+
12011212
if enable:
12021213
call_throws(ctx, ['systemctl', 'enable', unit_name])
12031214
if start:

0 commit comments

Comments
 (0)