Whamcloud - gitweb
b=19086
[fs/lustre-release.git] / lustre / tests / insanity.sh
index 92b0201..4d4f770 100755 (executable)
@@ -8,9 +8,16 @@ LUSTRE=${LUSTRE:-`dirname $0`/..}
 
 init_test_env $@
 
-. ${CONFIG:=$LUSTRE/tests/cfg/insanity-local.sh}
-#              13129  13129                 
-ALWAYS_EXCEPT="2      4     10  $INSANITY_EXCEPT"
+. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+#              
+ALWAYS_EXCEPT="10  $INSANITY_EXCEPT"
+
+if [ "$FAILURE_MODE" = "HARD" ]; then
+    mixed_ost_devs && CONFIG_EXCEPTIONS="0 2 4 5 6 8" && \
+        echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. " && \
+        echo "Except the tests: $CONFIG_EXCEPTIONS" && \
+        ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
+fi
 
 #
 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
@@ -20,13 +27,19 @@ CLEANUP=${CLEANUP:-""}
 
 build_test_filter
 
+SINGLECLIENT=${SINGLECLIENT:-$HOSTNAME}
+LIVE_CLIENT=${LIVE_CLIENT:-$SINGLECLIENT}
+FAIL_CLIENTS=${FAIL_CLIENTS:-$RCLIENTS}
+
 assert_env mds_HOST MDS_MKFS_OPTS
 assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
 assert_env LIVE_CLIENT FSNAME
 
+remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
+remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
 
-# This can be a regexp, to allow more clients
-CLIENTS=${CLIENTS:-"`comma_list $LIVE_CLIENT $FAIL_CLIENTS $EXTRA_CLIENTS`"}
+# FAIL_CLIENTS list should not contain the LIVE_CLIENT
+FAIL_CLIENTS=$(echo " $FAIL_CLIENTS " | sed -re "s/\s+$LIVE_CLIENT\s+/ /g")
 
 DIR=${DIR:-$MOUNT}
 
@@ -47,33 +60,16 @@ set_fail_client() {
     echo "fail $FAIL_CLIENT, next is $FAIL_NEXT"
 }
 
-shutdown_client() {
-    client=$1
-    if [ "$FAILURE_MODE" = HARD ]; then
-       $POWER_DOWN $client
-       while ping -w 3 -c 1 $client > /dev/null 2>&1; do 
-          echo "waiting for node $client to fail"
-          sleep 1
-       done  
-    elif [ "$FAILURE_MODE" = SOFT ]; then
-       zconf_umount $client $MOUNT -f
-    fi
-}
-
-reboot_node() {
-    NODE=$1
-    if [ "$FAILURE_MODE" = HARD ]; then
-       $POWER_UP $NODE
-    fi
-}
-
 fail_clients() {
     num=$1
+
+    log "Request clients to fail: ${num}. Num of clients to fail: ${FAIL_NUM}, already failed: $DOWN_NUM"
     if [ -z "$num"  ] || [ "$num" -gt $((FAIL_NUM - DOWN_NUM)) ]; then
        num=$((FAIL_NUM - DOWN_NUM)) 
     fi
     
     if [ -z "$num" ] || [ "$num" -le 0 ]; then
+        log "No clients failed!"
         return
     fi
 
@@ -89,7 +85,7 @@ fail_clients() {
     echo "down clients: $DOWN_CLIENTS"
 
     for client in $DOWN_CLIENTS; do
-       reboot_node $client
+       boot_node $client
     done
     DOWN_NUM=`echo $DOWN_CLIENTS | wc -w`
     client_rmdirs
@@ -146,23 +142,17 @@ clients_recover_osts() {
 #    do_node $CLIENTS "$LCTL "'--device %OSC_`hostname`_'"${facet}_svc_MNT_client_facet recover"
 }
 
-cleanup_and_setup_lustre
+check_and_setup_lustre
 
 # 9 Different Failure Modes Combinations
 echo "Starting Test 17 at `date`"
 
 test_0() {
-    facet_failover $SINGLEMDS
-    echo "Waiting for df pid: $DFPID"
-    wait $DFPID || { echo "df returned $?" && return 1; }
-
-    facet_failover ost1 || return 4
-    echo "Waiting for df pid: $DFPID"
-    wait $DFPID || { echo "df returned $?" && return 2; }
+    fail $SINGLEMDS
 
-    facet_failover ost2 || return 5
-    echo "Waiting for df pid: $DFPID"
-    wait $DFPID || { echo "df returned $?" && return 3; }
+    for i in $(seq $OSTCOUNT) ; do
+        fail ost$i
+    done
     return 0
 }
 run_test 0 "Fail all nodes, independently"
@@ -221,8 +211,7 @@ test_3() {
     [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
     
     #MDS Portion
-    facet_failover $SINGLEMDS
-    wait $DFPID || echo df failed: $?
+    fail $SINGLEMDS
     #Check FS
 
     echo "Test Lustre stability after MDS failover"
@@ -292,6 +281,8 @@ run_test 4 "Fourth Failure Mode: OST/MDS `date`"
 
 ############### Fifth Failure Mode ###############
 test_5() {
+    [ $OSTCOUNT -lt 2 ] && skip "$OSTCOUNT < 2, not enough OSTs" && return 0
+
     echo "Fifth Failure Mode: OST/OST `date`"
 
     #Create files
@@ -357,6 +348,7 @@ test_6() {
     echo "Test Lustre stability after OST failure"
     client_df &
     DFPIDA=$!
+    echo DFPIDA=$DFPIDA
     sleep 5
 
     #CLIENT Portion
@@ -367,17 +359,20 @@ test_6() {
     echo "Test Lustre stability after CLIENTs failure"
     client_df &
     DFPIDB=$!
+    echo DFPIDB=$DFPIDB
     sleep 5
     
     #Reintegration
     echo "Reintegrating OST/CLIENTs"
     wait_for ost1
     start_ost 1
-    reintegrate_clients
+    reintegrate_clients || return 1
     sleep 5 
 
+    wait_remote_prog df $((TIMEOUT * 3 + 10)) 
     wait $DFPIDA
     wait $DFPIDB
+
     echo "Verifying mount"
     [ -z "$(mounted_lustre_filesystems)" ] && return 3
     client_df
@@ -419,11 +414,8 @@ test_7() {
     client_rm testfile
 
     #MDS Portion
-    facet_failover $SINGLEMDS
+    fail $SINGLEMDS
 
-    #Check FS
-    echo "Test Lustre stability after MDS failover"
-    wait $DFPID || echo "df on down clients fails " || return 1
     $PDSH $LIVE_CLIENT "ls -l $MOUNT"
     $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile"
 
@@ -565,4 +557,4 @@ run_test 10 "Running Availability for 6 hours..."
 
 equals_msg `basename $0`: test complete, cleaning up
 check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true
+[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true