1 From 1f882d7ee20d70548d380ce27eedab3ae30180d4 Mon Sep 17 00:00:00 2001
2 From: Jackie Huang <jackie.huang@windriver.com>
3 Date: Fri, 17 Apr 2020 00:55:52 +0800
4 Subject: [PATCH] Add hooks for orderly shutdown on controller
6 Hook the ceph init script to add systemd overrides to define
7 an orderly shutdown for StarlingX controllers.
9 Signed-off-by: Don Penney <don.penney@windriver.com>
11 src/init-ceph.in | 32 ++++++++++++++++++++++++++++++++
12 1 file changed, 32 insertions(+)
14 diff --git a/src/init-ceph.in b/src/init-ceph.in
15 index d13032a..a6113fa 100755
16 --- a/src/init-ceph.in
17 +++ b/src/init-ceph.in
18 @@ -434,6 +434,38 @@ for name in $what; do
22 + . /etc/platform/platform.conf
23 + if [ "${nodetype}" = "controller" ]; then
24 + # StarlingX: Hook the transient services launched by systemd-run
25 + # to allow for proper cleanup and orderly shutdown
27 + # Set nullglob so wildcards will return empty string if no match
30 + OSD_SERVICES=$(for svc in /run/systemd/system/ceph-osd*.service; do basename $svc; done | xargs echo)
31 + for d in /run/systemd/system/ceph-osd*.d; do
32 + cat <<EOF > $d/starlingx-overrides.conf
34 +Before=docker.service
35 +After=sm-shutdown.service
40 + for d in /run/systemd/system/ceph-mon*.d; do
41 + cat <<EOF > $d/starlingx-overrides.conf
43 +Before=docker.service
44 +After=sm-shutdown.service ${OSD_SERVICES}
51 + systemctl daemon-reload
54 [ -n "$post_start" ] && do_cmd "$post_start"
55 [ -n "$lockfile" ] && [ "$?" -eq 0 ] && touch $lockfile