]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
sysvinit: create /var/run/ceph before pid
authorElena Chernikova <elena.chernikoff@gmail.com>
Sun, 26 Sep 2021 22:13:00 +0000 (01:13 +0300)
committerElena Chernikova <elena.chernikoff@gmail.com>
Sun, 26 Sep 2021 22:13:00 +0000 (01:13 +0300)
/var/run is mounted as tmpfs and will be cleared after reboot.
On sysvinit ceph init service creates this directory for pid with root ownership.

Fixes: https://tracker.ceph.com/issues/19242
Signed-off-by: Elena Chernikova <elena.chernikoff@gmai.com>
src/init-ceph.in

index f60c59293181d67ef3833600dd87407c562392cd..9d93e6b85c1d4004efe8c11c1193a4ff955bc02e 100755 (executable)
@@ -295,9 +295,12 @@ for name in $what; do
 
     get_conf pid_file "$run_dir/$type.$id.pid" "pid file"
 
+    if [ ! -d $run_dir ]; then
+        install -d -m0770 -o ceph -g ceph /var/run/ceph
+    fi
+
     if [ "$command" = "start" -o "$command" = "onestart" ]; then
        if [ -n "$pid_file" ]; then
-           do_cmd "mkdir -p "`dirname $pid_file`
            cmd="$cmd --pid-file $pid_file"
        fi
 
@@ -423,10 +426,6 @@ for name in $what; do
            fi
 
            echo Starting Ceph $name on $host...
-           if [ ! -d $run_dir ]; then
-               # assume /var/run exists
-               install -d -m0770 -o ceph -g ceph /var/run/ceph
-           fi
            get_conf pre_start_eval "" "pre start eval"
            [ -n "$pre_start_eval" ] && $pre_start_eval
            get_conf pre_start "" "pre start command"