]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: do not use systemd-run in sysvinit 9871/head
authorVladislav Odintsov <odivlad@gmail.com>
Mon, 4 Jul 2016 12:41:07 +0000 (15:41 +0300)
committerVladislav Odintsov <odivlad@gmail.com>
Tue, 5 Jul 2016 12:03:25 +0000 (15:03 +0300)
`systemd-run` logic in initscripts was introduced because of ticket
http://tracker.ceph.com/issues/7627.

If we have systemd-based operating system, we should use systemd unit files
from systemd directory to start/stop ceph daemons.
Otherwise, `daemon()` from `/etc/init.d/functions` on systemd distro starts service
in `system.slice` and everything works well.

`systemd-run` can not be run on non-systemd distros, so it's not needed
on SysV systems.

also, ceph-disk is now able to run the "systemctl"
to enable and start the ceph-osd, and ceph-deploy is also now
playing well with systemd when it comes to ceph-mon and ceph-mds

Fixes: http://tracker.ceph.com/issues/16440
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
src/init-ceph.in

index 132450520e1b08e958b2e2456ee260515d8c6bb5..e58481a9ff0f0ec9cb5581e028607499b32a62d3 100755 (executable)
@@ -17,17 +17,12 @@ if [ -e /lib/lsb/init-functions ]; then
     . /lib/lsb/init-functions
 fi
 
-# detect systemd, also check whether the systemd-run binary exists
-SYSTEMD_RUN=$(which systemd-run 2>/dev/null)
-grep -qs systemd /proc/1/comm || SYSTEMD_RUN=""
-
 if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
     # looks like an autotools src dir build
     BINDIR=.
     SBINDIR=.
     LIBEXECDIR=.
     ETCDIR=.
-    SYSTEMD_RUN=""
     ASSUME_DEV=1
 else
     if [ -e CMakeCache.txt ] && [ -e bin/init-ceph ]; then
@@ -37,7 +32,6 @@ else
        SBINDIR=bin
        LIBEXECDIR=$CEPH_ROOT/src
        ETCDIR=.
-       SYSTEMD_RUN=""
        ASSUME_DEV=1
     else
        BINDIR=@bindir@
@@ -53,7 +47,6 @@ if [ -n "$CEPH_BIN" ] && [ -n "$CEPH_ROOT" ] && [ -n "$CEPH_BUILD_DIR" ]; then
   SBINDIR=$CEPH_ROOT/src
   ETCDIR=$CEPH_BIN
   LIBEXECDIR=$CEPH_ROOT/src
-  SYSTEMD_RUN=""
   ASSUME_DEV=1
 fi
 
@@ -359,12 +352,7 @@ for name in $what; do
 
            [ -n "$TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES" ] && tcmalloc="TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES=$TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES"
 
-           if [ -n "$SYSTEMD_RUN" ]; then
-                time=`date +%s.%N` 
-               cmd="$SYSTEMD_RUN --unit=ceph-$name.$time -r bash -c '$files $tcmalloc $cmd --cluster $cluster --setuser ceph --setgroup ceph -f'"
-           else
-               cmd="$files $tcmalloc $wrap $cmd --cluster $cluster --setuser ceph --setgroup ceph $runmode"
-           fi
+           cmd="$files $tcmalloc $wrap $cmd --cluster $cluster --setuser ceph --setgroup ceph $runmode"
 
            if [ $dofsmount -eq 1 ] && [ -n "$fs_devs" ]; then
                get_conf pre_mount "true" "pre mount command"