]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: do not stop start on first failure
authorSage Weil <sage@inktank.com>
Fri, 19 Apr 2013 20:05:43 +0000 (13:05 -0700)
committerSage Weil <sage@inktank.com>
Fri, 19 Apr 2013 20:08:00 +0000 (13:08 -0700)
When starting we often loop over many daemon instances.  Currently we stop
on the first error and do not try to start other daemons.

Instead, try them all, but return a failure if anything did not start.

Fixes: #2545
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
(cherry picked from commit d395aa521e8a4b295ed2b08dd7cfb7d9f995fcf7)

Conflicts:

src/init-ceph.in

src/ceph_common.sh
src/init-ceph.in

index b66b1de3a53d5e041891b25ba735155033eaad7a..f20628bfa225d90377480a04aa8bc0c4b946aef4 100644 (file)
@@ -87,6 +87,24 @@ do_cmd() {
     fi
 }
 
+do_cmd_okfail() {
+    ERR=0
+    if [ -z "$ssh" ]; then
+       [ $verbose -eq 1 ] && echo "--- $host# $1"
+       ulimit -c unlimited
+       whoami=`whoami`
+       if [ "$whoami" = "$user" ] || [ -z "$user" ]; then
+           bash -c "$1" || { [ -z "$3" ] && echo "failed: '$1'" && ERR=1 && return 1; }
+       else
+           sudo su $user -c "$1" || { [ -z "$3" ] && echo "failed: '$1'" && ERR=1 && return 1; }
+       fi
+    else
+       [ $verbose -eq 1 ] && echo "--- $ssh $2 \"if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1\""
+       $ssh $2 "if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1" || { [ -z "$3" ] && echo "failed: '$ssh $1'" && ERR=1 && return 1; }
+    fi
+    return 0
+}
+
 do_root_cmd() {
     if [ -z "$ssh" ]; then
        [ $verbose -eq 1 ] && echo "--- $host# $1"
index 8c1855a6aa0e7b10602a2c623ef488aef947ea9d..41fe4f4f4c82d1903ac1212447308b5c2443d80d 100644 (file)
@@ -314,7 +314,10 @@ for name in $what; do
            get_conf pre_start "" "pre start command"
            get_conf post_start "" "post start command"
            [ -n "$pre_start" ] && do_cmd "$pre_start"
-           do_cmd "$cmd" $runarg
+           do_cmd_okfail "$cmd" $runarg
+           if [ "$ERR" != "0" ]; then
+               EXIT_STATUS=$ERR
+           fi
            [ -n "$post_start" ] && do_cmd "$post_start"
            [ -n "$lockfile" ] && [ "$?" -eq 0 ] && touch $lockfile
            ;;