From 03340eaf0004e3cc8e3f8991ea96a46757d92830 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Sat, 26 Jan 2019 13:34:55 -0500 Subject: [PATCH] Add hooks for orderly shutdown on controller Hook the ceph init script to add systemd overrides to define an orderly shutdown for StarlingX controllers. Signed-off-by: Don Penney --- src/init-ceph.in | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/init-ceph.in b/src/init-ceph.in index 1fdb4b3..515d818 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -861,6 +861,38 @@ for name in $what; do fi fi + . /etc/platform/platform.conf + if [ "${nodetype}" = "controller" ]; then + # StarlingX: Hook the transient services launched by systemd-run + # to allow for proper cleanup and orderly shutdown + + # Set nullglob so wildcards will return empty string if no match + shopt -s nullglob + + OSD_SERVICES=$(for svc in /run/systemd/system/ceph-osd*.service; do basename $svc; done | xargs echo) + for d in /run/systemd/system/ceph-osd*.d; do + cat < $d/starlingx-overrides.conf +[Unit] +Before=docker.service +After=sm-shutdown.service + +EOF + done + + for d in /run/systemd/system/ceph-mon*.d; do + cat < $d/starlingx-overrides.conf +[Unit] +Before=docker.service +After=sm-shutdown.service ${OSD_SERVICES} + +EOF + done + + shopt -u nullglob + + systemctl daemon-reload + fi + [ -n "$post_start" ] && do_cmd "$post_start" [ -n "$lockfile" ] && [ "$?" -eq 0 ] && touch $lockfile ;; -- 1.8.3.1