Whamcloud - gitweb
LU-16335 test: add fail_abort_cleanup()
[fs/lustre-release.git] / lustre / scripts / lustre
index baa0430..a615b74 100644 (file)
@@ -7,6 +7,13 @@
 # description:  Part of the lustre file system.
 # probe: true
 # config: /etc/sysconfig/lustre
+### BEGIN INIT INFO
+# Provides: lustre
+# Required-Start: lnet
+# Defalt-Start: -
+# Default-Stop: 0 1 6
+# Description: Lustre init script
+### END INIT INFO
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
@@ -319,7 +326,7 @@ device_is_active ()
 }
 
 # Usage: mount_one_device <label> <successflag> [devtype]
-# Remove <succesflag> on error (trick to detect errors after parallel runs).
+# Remove <successflag> on error (trick to detect errors after parallel runs).
 mount_one_device ()
 {
        local label=$1
@@ -448,13 +455,14 @@ start_services ()
                        assemble_md_device $journal $raidtab 2>/dev/null
                fi
 
+               if mountpt_is_active $label || \
+                  device_is_active $label; then
+                       echo "$label is already mounted"
+                       # no error
+                       continue
+               fi
+
                if [ "x$devtype" != "xzfs" ] ; then
-                       if mountpt_is_active $label || \
-                          device_is_active $label; then
-                               echo "$label is already mounted"
-                               # no error
-                               continue
-                       fi
                        if ! mmp_test $dev; then
                                result=2
                                continue
@@ -595,6 +603,7 @@ stop_lustre_services ()
 # General lustre health check - not device specific.
 health_check ()
 {
+
        old_nullglob="`shopt -p nullglob`"
        shopt -u nullglob
 
@@ -617,29 +626,32 @@ health_check ()
                fi
 
                # check for either a server or a client filesystem
-               MDT=""
-               OST=""
-               LLITE=""
+               local MGT=""
+               local MDT=""
+               local OST=""
+               local LLITE=""
 
-               VAR=$(lctl get_param -n mdt.*.recovery_status 2>&1)
+               ! lctl get_param -n mgs.MGS.* >/dev/null 2>&1 || MGT="YES"
+
+               VAR=$(lctl get_param -n mdt.*.recovery_status 2>&1 | grep '^status:'  )
                if [ $? = 0 ] ; then
-                       MDT="YES"
+                       MDT=$VAR
                fi
 
-               VAR=$(lctl get_param -n obdfilter.*.recovery_status 2>&1)
+               VAR=$(lctl get_param -n obdfilter.*.recovery_status 2>&1 | grep '^status:')
                if [ $? = 0 ] ; then
-                        OST="YES"
-                fi
+                       OST=$VAR
+               fi
 
-                VAR=$(lctl get_param -n llite.fs* 2>&1)
+               VAR=$(lctl get_param -n llite.fs* 2>&1)
                if [ $? = 0 ] ; then
-                        LLITE="YES"
-                fi
+                       LLITE="YES"
+               fi
 
-                if [ "$MDT" -o "$OST" -o "$LLITE" ]; then
-                        STATE="running"
-                        RETVAL=0
-                fi
+               if [ "$MGT" -o "$MDT" -o "$OST" -o "$LLITE" ]; then
+                       STATE="running"
+                       RETVAL=0
+               fi
        else
                # check if this is a router
                if [[ "$(lctl get_param -n routes)" =~ "Routing enabled" ]]; then
@@ -649,7 +661,7 @@ health_check ()
        fi
 
        # check for server disconnections
-        VAR=$(lctl get_param -n *c.*.*server_uuid 2>&1)
+       VAR=$(lctl get_param -n *c.*.*server_uuid 2>&1)
        if [ $? = 0 ] ; then
                DISCON="$(echo $VAR | grep -v FULL)"
                if [ -n "$DISCON" ] ; then
@@ -659,7 +671,7 @@ health_check ()
        fi
 
        # check for servers in recovery
-       if [ -n "$MDT$OST" ] && grep -q RECOV $MDT $OST ; then
+       if [ -n "$MDT$OST" ] && echo $MDT $OST | grep -q RECOV ; then
                STATE="recovery"
                RETVAL=0
        fi