summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-19 13:05:43 -0700
committerSage Weil <sage@inktank.com>2013-04-19 13:05:43 -0700
commitd395aa521e8a4b295ed2b08dd7cfb7d9f995fcf7 (patch)
tree578b6a2cfa81245b041ff641ea1c5628abdc5c2b
parentbe4807f5b88115bc5a553ecee6f42c0c7d7cfbe2 (diff)
downloadceph-d395aa521e8a4b295ed2b08dd7cfb7d9f995fcf7.tar.gz
init-ceph: do not stop start on first failure
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>
-rw-r--r--src/ceph_common.sh18
-rw-r--r--src/init-ceph.in5
2 files changed, 22 insertions, 1 deletions
diff --git a/src/ceph_common.sh b/src/ceph_common.sh
index 7e8183cde99..188a5d53750 100644
--- a/src/ceph_common.sh
+++ b/src/ceph_common.sh
@@ -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"
diff --git a/src/init-ceph.in b/src/init-ceph.in
index 4c1646280c4..c2148822b6c 100644
--- a/src/init-ceph.in
+++ b/src/init-ceph.in
@@ -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