]> 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:05:43 +0000 (13:05 -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>
src/ceph_common.sh
src/init-ceph.in

index 7e8183cde995f054d6ed4ebf9f39f0d5eefaba66..188a5d537502a0bbe7e5c25947a0fe76b9848537 100644 (file)
@@ -99,6 +99,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 4c1646280c46f7b9da1620f16f84a2be95b585c0..c2148822b6cfd3c3ad7c82ce77043fdf500d2353 100644 (file)
@@ -320,7 +320,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
 
            if [ "$type" = "mon" ]; then
                # this will only work if we are using default paths