From: Vladislav Odintsov Date: Mon, 4 Jul 2016 12:41:07 +0000 (+0300) Subject: init-ceph: do not use systemd-run in sysvinit X-Git-Tag: ses5-milestone5~446^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=109cfc21680a27e5769523e556ff879da859f7b7;p=ceph.git init-ceph: do not use systemd-run in sysvinit `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 --- diff --git a/src/init-ceph.in b/src/init-ceph.in index 132450520e1b0..e58481a9ff0f0 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -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"