]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: kick off ceph-create-keys when starting mons
authorSage Weil <sage@inktank.com>
Thu, 28 Feb 2013 21:45:04 +0000 (13:45 -0800)
committerSage Weil <sage@inktank.com>
Thu, 28 Feb 2013 21:45:04 +0000 (13:45 -0800)
We don't have a particularly tidy way to kick off ceph-create-keys from
sysvinit.  So, do something simple, ugly, and functional: if we are
starting a mon, and it looks like a 'new' type that is in /var/lib/ceph,
then start ceph-create-keys too.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/Makefile.am
src/init-ceph.in

index 9daf3f22182eb4a117d7ec13f75b8c15d95dfda5..77deefece50f657a94055409eccae1f9bd0d2a54 100644 (file)
@@ -1049,6 +1049,7 @@ bin_DEBUGPROGRAMS += ceph_test_cfuse_cache_invalidate
 # shell scripts
 editpaths = sed \
        -e 's|@bindir[@]|$(bindir)|g' \
+       -e 's|@sbindir[@]|$(sbindir)|g' \
        -e 's|@libdir[@]|$(libdir)|g' \
        -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
        -e 's|@datadir[@]|$(pkgdatadir)|g' \
index 30727e5aa76e5dd793687e3fb73032b21a205a07..8f2bfb8f43f69485f62f686b305f6f85983e08fb 100644 (file)
@@ -18,10 +18,12 @@ RUN_DIR=/var/run/ceph
 # current directory too.
 if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
     BINDIR=.
+    SBINDIR=.
     LIBDIR=.
     ETCDIR=.
 else
     BINDIR=@bindir@
+    SBINDIR=@prefix@/sbin
     LIBDIR=@libdir@/ceph
     ETCDIR=@sysconfdir@/ceph
 fi
@@ -315,6 +317,24 @@ for name in $what; do
            get_conf post_start "" "post start command"
            [ -n "$pre_start" ] && do_cmd "$pre_start"
            do_cmd "$cmd" $runarg
+
+           if [ "$type" = "mon" ]; then
+               # this will only work if we are using default paths
+               # for the mon data and admin socket.  if so, run
+               # ceph-create-keys.  this is the case for (normal)
+               # chef and ceph-deploy clusters, which is who needs
+               # these keys.  it's also true for default installs
+               # via mkcephfs, which is fine too; there is no harm
+               # in creating these keys.
+               get_conf mon_data "/var/lib/ceph/mon/ceph-$id" "mon data"
+               get_conf asok "/var/run/ceph-$type.$id.asok" "admin socket"
+               if [ "$mon_data" = "/var/lib/ceph/mon/ceph-$id" -a "$asok" = "/var/run/ceph/ceph-mon.$id.asok" ]; then
+                   echo Starting ceph-create-keys on $host...
+                   cmd2="$SBINDIR/ceph-create-keys -i $id 2> /dev/null &"
+                   do_cmd "$cmd2"
+               fi
+           fi
+
            [ -n "$post_start" ] && do_cmd "$post_start"
            [ -n "$lockfile" ] && [ "$?" -eq 0 ] && touch $lockfile
            ;;