]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: continue after failure doing osd data mount
authorSage Weil <sage@inktank.com>
Mon, 9 Jun 2014 03:18:49 +0000 (20:18 -0700)
committerSage Weil <sage@inktank.com>
Fri, 13 Jun 2014 20:30:37 +0000 (13:30 -0700)
If we are starting many daemons and hit an error, we normally note it and
move on.  Do the same when doing the pre-mount step.

Fixes: #8554
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 6a7e20147cc39ed4689809ca7d674d3d408f2a17)

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

index 01781b754157fa94369f08b158f4f58fbe0a224b..d78f831f5e866b9e1b9bf92763a485179174f259 100644 (file)
@@ -137,6 +137,24 @@ do_root_cmd() {
     fi
 }
 
+do_root_cmd_okfail() {
+    ERR=0
+    if [ -z "$ssh" ]; then
+       [ $verbose -eq 1 ] && echo "--- $host# $1"
+       ulimit -c unlimited
+       whoami=`whoami`
+       if [ "$whoami" = "root" ]; then
+           bash -c "$1" || { [ -z "$3" ] && echo "failed: '$1'" && ERR=1 && return 1; }
+       else
+           sudo bash -c "$1" || { [ -z "$3" ] && echo "failed: '$1'" && ERR=1 && return 1; }
+       fi
+    else
+       [ $verbose -eq 1 ] && echo "--- $rootssh $2 \"if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1\""
+       $rootssh $2 "if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1" || { [ -z "$3" ] && echo "failed: '$rootssh $1'" && ERR=1 && return 1; }
+    fi
+    return 0
+}
+
 get_local_daemon_list() {
     type=$1
     if [ -d "/var/lib/ceph/$type" ]; then
index 846bd573cef760444ea502e493780c32ed9d266c..1effb564543572a088cb10d56494c3f5d5c2d260 100644 (file)
@@ -311,10 +311,14 @@ for name in $what; do
 
                if [ "$fs_type" = "btrfs" ]; then
                    echo Mounting Btrfs on $host:$fs_path
-                   do_root_cmd "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t btrfs $fs_opt $first_dev $fs_path"
+                   do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t btrfs $fs_opt $first_dev $fs_path"
                else
                    echo Mounting $fs_type on $host:$fs_path
-                   do_root_cmd "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t $fs_type $fs_opt $first_dev $fs_path"
+                   do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path' /proc/mounts || mount -t $fs_type $fs_opt $first_dev $fs_path"
+               fi
+               if [ "$ERR" != "0" ]; then
+                   EXIT_STATUS=$ERR
+                   continue
                fi
            fi