fd53546283b4aa9b62904ead2f2db6ff2fc89021
[pti/rtp.git] / meta-stx / recipes-extended / ceph / ceph-13.2.2 / 0005-Add-hooks-for-orderly-shutdown-on-controller.patch
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
5
6 Hook the ceph init script to add systemd overrides to define
7 an orderly shutdown for StarlingX controllers.
8
9 Signed-off-by: Don Penney <don.penney@windriver.com>
10 ---
11  src/init-ceph.in | 32 ++++++++++++++++++++++++++++++++
12  1 file changed, 32 insertions(+)
13
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
19                 continue
20             fi
21  
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
26 +
27 +                # Set nullglob so wildcards will return empty string if no match
28 +                shopt -s nullglob
29 +
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
33 +[Unit]
34 +Before=docker.service
35 +After=sm-shutdown.service
36 +
37 +EOF
38 +                done
39 +
40 +                for d in /run/systemd/system/ceph-mon*.d; do
41 +                    cat <<EOF > $d/starlingx-overrides.conf
42 +[Unit]
43 +Before=docker.service
44 +After=sm-shutdown.service ${OSD_SERVICES}
45 +
46 +EOF
47 +                done
48 +
49 +                shopt -u nullglob
50 +
51 +                systemctl daemon-reload
52 +            fi
53 +
54             [ -n "$post_start" ] && do_cmd "$post_start"
55             [ -n "$lockfile" ] && [ "$?" -eq 0 ] && touch $lockfile
56             ;;
57 -- 
58 2.7.4
59