Skip to content

Commit

Permalink
init-ceph: do not use systemd-run in sysvinit
Browse files Browse the repository at this point in the history
`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>
(cherry picked from commit 109cfc2)

Conflicts:

	src/init-ceph.in

	  1. In master there is no comment already about the
	     relative paths when starting daemon as ./init-ceph.
	  2. In master's initscript there is difference to start
	     in build directory or not. Just remove SYSTEMD_RUN variable.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
  • Loading branch information
odivlad committed Jul 14, 2016
1 parent 66dca55 commit f17ebd7
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/init-ceph.in
Expand Up @@ -17,18 +17,13 @@ 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 we start up as ./init-ceph, assume everything else is in the
# current directory too.
if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
BINDIR=.
SBINDIR=.
LIBEXECDIR=.
ETCDIR=.
SYSTEMD_RUN=""
ASSUME_DEV=1
else
BINDIR=@bindir@
Expand All @@ -43,7 +38,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

Expand Down Expand Up @@ -349,12 +343,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"
Expand Down

0 comments on commit f17ebd7

Please sign in to comment.