Whamcloud - gitweb
LU-4409 tests: disable insanity 10 for DNE
[fs/lustre-release.git] / lustre / tests / insanity.sh
index e113e34..1a25d91 100755 (executable)
@@ -1,4 +1,7 @@
-#!/bin/sh
+#!/bin/bash
+# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
+#
 # Test multiple failures, AKA Test 17
 
 set -e
@@ -11,14 +14,14 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 #              
-ALWAYS_EXCEPT="10  $INSANITY_EXCEPT"
+ALWAYS_EXCEPT="15  $INSANITY_EXCEPT"
 
 if [ "$FAILURE_MODE" = "HARD" ]; then
-        skip_env "$0: is not functional with FAILURE_MODE = HARD, please use recovery-double-scale, bz20407"
-        exit 0
+       skip_env "$TESTSUITE: is not functional with FAILURE_MODE = HARD, " \
+               "please use recovery-double-scale, bz20407"
+       exit 0
 fi
 
-#
 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
 
 SETUP=${SETUP:-""}
@@ -30,7 +33,7 @@ SINGLECLIENT=${SINGLECLIENT:-$HOSTNAME}
 LIVE_CLIENT=${LIVE_CLIENT:-$SINGLECLIENT}
 FAIL_CLIENTS=${FAIL_CLIENTS:-$RCLIENTS}
 
-assert_env mds_HOST
+assert_env mds_HOST MDSCOUNT
 assert_env ost_HOST OSTCOUNT
 assert_env LIVE_CLIENT FSNAME
 
@@ -41,7 +44,7 @@ require_dsh_ost || exit 0
 FAIL_CLIENTS=$(echo " $FAIL_CLIENTS " | sed -re "s/\s+$LIVE_CLIENT\s+/ /g")
 
 DIR=${DIR:-$MOUNT}
-TESTDIR=$DIR/d0.$(basename $0 .sh)
+TESTDIR=$DIR/d0.$TESTSUITE
 
 #####
 # fail clients round robin
@@ -61,12 +64,12 @@ set_fail_client() {
 }
 
 fail_clients() {
-    num=$1
+       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
+       log "Request fail clients: $num, to fail: $FAIL_NUM, 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!"
@@ -84,56 +87,61 @@ fail_clients() {
 
     echo "down clients: $DOWN_CLIENTS"
 
-    for client in $DOWN_CLIENTS; do
-       boot_node $client
-    done
-    DOWN_NUM=`echo $DOWN_CLIENTS | wc -w`
-    client_rmdirs
+       for client in $DOWN_CLIENTS; do
+               boot_node $client
+       done
+       DOWN_NUM=`echo $DOWN_CLIENTS | wc -w`
+       client_rmdirs
 }
 
 reintegrate_clients() {
-    for client in $DOWN_CLIENTS; do
-       wait_for_host $client
-       echo "Restarting $client"
-       zconf_mount $client $MOUNT || return 1
-    done
-    DOWN_CLIENTS=""
-    DOWN_NUM=0
+       for client in $DOWN_CLIENTS; do
+               wait_for_host $client
+               echo "Restarting $client"
+               zconf_mount $client $MOUNT || return 1
+       done
+
+       DOWN_CLIENTS=""
+       DOWN_NUM=0
 }
 
 start_ost() {
-    start ost$1 `ostdevname $1` $OST_MOUNT_OPTS
+       start ost$1 `ostdevname $1` $OST_MOUNT_OPTS
+}
+
+start_mdt() {
+       start mds$1 $(mdsdevname $1) $MDS_MOUNT_OPTS
 }
 
 trap exit INT
 
 client_touch() {
-    file=$1
-    for c in $LIVE_CLIENT $FAIL_CLIENTS;  do
-       if echo $DOWN_CLIENTS | grep -q $c; then continue; fi
-       $PDSH $c touch $TESTDIR/${c}_$file || return 1
-    done
+       file=$1
+       for c in $LIVE_CLIENT $FAIL_CLIENTS; do
+               echo $DOWN_CLIENTS | grep -q $c && continue
+               $PDSH $c touch $TESTDIR/${c}_$file || return 1
+       done
 }
 
 client_rm() {
-    file=$1
-    for c in $LIVE_CLIENT $FAIL_CLIENTS;  do
-       $PDSH $c rm $TESTDIR/${c}_$file
-    done
+       file=$1
+       for c in $LIVE_CLIENT $FAIL_CLIENTS; do
+               $PDSH $c rm $TESTDIR/${c}_$file
+       done
 }
 
 client_mkdirs() {
-    for c in $LIVE_CLIENT $FAIL_CLIENTS;  do
-       echo "$c mkdir $TESTDIR/$c"
-       $PDSH $c "mkdir $TESTDIR/$c && ls -l $TESTDIR/$c"
-    done
+       for c in $LIVE_CLIENT $FAIL_CLIENTS; do
+               echo "$c mkdir $TESTDIR/$c"
+               $PDSH $c "mkdir $TESTDIR/$c && ls -l $TESTDIR/$c"
+       done
 }
 
 client_rmdirs() {
-    for c in $LIVE_CLIENT $FAIL_CLIENTS;  do
-       echo "rmdir $TESTDIR/$c"
-       $PDSH $LIVE_CLIENT "rmdir $TESTDIR/$c"
-    done
+       for c in $LIVE_CLIENT $FAIL_CLIENTS; do
+               echo "rmdir $TESTDIR/$c"
+               $PDSH $LIVE_CLIENT "rmdir $TESTDIR/$c"
+       done
 }
 
 clients_recover_osts() {
@@ -150,7 +158,9 @@ mkdir -p $TESTDIR
 echo "Starting Test 17 at `date`"
 
 test_0() {
-    fail $SINGLEMDS
+       for i in $(seq $MDSCOUNT) ; do
+               fail mds$i
+       done
 
     for i in $(seq $OSTCOUNT) ; do
         fail ost$i
@@ -161,25 +171,60 @@ run_test 0 "Fail all nodes, independently"
 
 ############### First Failure Mode ###############
 test_1() {
-echo "Don't do a MDS - MDS Failure Case"
-echo "This makes no sense"
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       [ "$(facet_fstype mds2)" = "zfs" ] &&
+               skip "LU-2059: no local config for ZFS MDTs" && return
+
+       clients_up
+
+       shutdown_facet mds1
+       reboot_facet mds1
+
+       # prepare for MDS failover
+       change_active mds1
+       reboot_facet mds1
+
+       clients_up &
+       DFPID=$!
+       sleep 5
+
+       shutdown_facet mds2
+
+       echo "Reintegrating MDS2"
+       reboot_facet mds2
+       wait_for_facet mds2
+       start_mdt 2 || return 2
+
+       wait_for_facet mds1
+       start_mdt 1 || return $?
+
+       #Check FS
+       wait $DFPID
+       echo "Verify reintegration"
+       clients_up || return 1
 }
 run_test 1 "MDS/MDS failure"
 ###################################################
 
 ############### Second Failure Mode ###############
 test_2() {
-    echo "Verify Lustre filesystem is up and running"
-    [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+       echo "Verify Lustre filesystem is up and running"
+       [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+
+       [ "$(facet_fstype ost1)" = "zfs" ] &&
+               skip "LU-2059: no local config for ZFS OSTs" && return
 
     clients_up
 
-    shutdown_facet $SINGLEMDS
-    reboot_facet $SINGLEMDS
+       for i in $(seq $MDSCOUNT) ; do
+               shutdown_facet mds$i
+               reboot_facet mds$i
 
-    # prepare for MDS failover
-    change_active $SINGLEMDS
-    reboot_facet $SINGLEMDS
+               # prepare for MDS failover
+               change_active mds$i
+               reboot_facet mds$i
+       done
 
     clients_up &
     DFPID=$!
@@ -192,8 +237,10 @@ test_2() {
     wait_for_facet ost1
     start_ost 1 || return 2
 
-    wait_for_facet $SINGLEMDS
-    start $SINGLEMDS `mdsdevname 1` $MDS_MOUNT_OPTS || return $?
+       for i in $(seq $MDSCOUNT) ; do
+               wait_for_facet mds$i
+               start_mdt $i || return $?
+       done
 
     #Check FS
     wait $DFPID
@@ -205,15 +252,16 @@ test_2() {
 run_test 2 "Second Failure Mode: MDS/OST `date`"
 ###################################################
 
-
 ############### Third Failure Mode ###############
 test_3() {
     #Create files
     echo "Verify Lustre filesystem is up and running"
     [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
-    
+
     #MDS Portion
-    fail $SINGLEMDS
+       for i in $(seq $MDSCOUNT) ; do
+               fail mds$i
+       done
     #Check FS
 
     echo "Test Lustre stability after MDS failover"
@@ -239,24 +287,28 @@ run_test 3  "Thirdb Failure Mode: MDS/CLIENT `date`"
 
 ############### Fourth Failure Mode ###############
 test_4() {
-    echo "Fourth Failure Mode: OST/MDS `date`"
+       echo "Fourth Failure Mode: OST/MDS `date`"
+
+       [ "$(facet_fstype ost1)" = "zfs" ] &&
+               skip "LU-2059: no local config for ZFS OSTs" && return
 
     #OST Portion
     shutdown_facet ost1
+
     #Check FS
     echo "Test Lustre stability after OST failure"
     clients_up &
     DFPIDA=$!
     sleep 5
 
-    #MDS Portion
-    shutdown_facet $SINGLEMDS
-    reboot_facet $SINGLEMDS
+       for i in $(seq $MDSCOUNT) ; do
+               shutdown_facet mds$i
+               reboot_facet mds$i
 
-    # prepare for MDS failover
-    change_active $SINGLEMDS
-    reboot_facet $SINGLEMDS
+               # prepare for MDS failover
+               change_active mds$i
+               reboot_facet mds$i
+       done
 
     clients_up &
     DFPIDB=$!
@@ -268,10 +320,12 @@ test_4() {
     wait_for_facet ost1
     start_ost 1
 
-    wait_for_facet $SINGLEMDS
-    start $SINGLEMDS `mdsdevname 1` $MDS_MOUNT_OPTS
+       for i in $(seq $MDSCOUNT) ; do
+               wait_for_facet mds$i
+               start_mdt $i || return $?
+       done
     #Check FS
-    
+
     wait $DFPIDA
     wait $DFPIDB
     clients_recover_osts ost1
@@ -416,7 +470,9 @@ test_7() {
     client_rm testfile
 
     #MDS Portion
-    fail $SINGLEMDS
+       for i in $(seq $MDSCOUNT) ; do
+               fail mds$i
+       done
 
     $PDSH $LIVE_CLIENT "ls -l $TESTDIR"
     $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile"
@@ -549,14 +605,190 @@ test_9() {
 run_test 9 "Ninth Failure Mode: CLIENT/CLIENT `date`"
 ###################################################
 
+############### Tenth Failure Mode ###############
 test_10() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       #XXX Disable the test now for LU-4409
+       [ $MDSCOUNT -ge 2 ] && skip "skip for DNE due to LU-4409" && return
+
+       [ "$(facet_fstype ost1)" = "zfs" ] &&
+               skip "LU-2059: no local config for ZFS OSTs" && return
+
+       shutdown_facet mds1
+       reboot_facet mds1
+
+       # prepare for MDS failover
+       change_active mds1
+       reboot_facet mds1
+
+       clients_up &
+       DFPID=$!
+       sleep 5
+
+       shutdown_facet ost1
+
+       echo "Reintegrating OST"
+       reboot_facet ost1
+       wait_for_facet ost1
+       start_ost 1 || return 2
+
+       shutdown_facet mds2
+       reboot_facet mds2
+
+       # prepare for MDS failover
+       change_active mds2
+       reboot_facet mds2
+
+       wait_for_facet mds1
+       start_mdt 1 || return $?
+
+       wait_for_facet mds2
+       start_mdt 2 || return $?
+
+       #Check FS
+       wait $DFPID
+       clients_recover_osts ost1
+       echo "Verify reintegration"
+       clients_up || return 1
+}
+run_test 10 "Tenth Failure Mode: MDT0/OST/MDT1 `date`"
+###################################################
+
+############### Seventh Failure Mode ###############
+test_11() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       echo "Verify Lustre filesystem is up and running"
+       [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+
+       #MDS Portion
+       fail mds1
+       #Check FS
+
+       echo "Test Lustre stability after MDS failover"
+       clients_up
+
+       #CLIENT Portion
+       echo "Failing 2 CLIENTS"
+       fail_clients 2
+
+       #Check FS
+       echo "Test Lustre stability after CLIENT failure"
+       clients_up
+
+       #Reintegration
+       echo "Reintegrating CLIENTS"
+       reintegrate_clients || return 1
+
+       fail mds2
+
+       clients_up || return 3
+       sleep 2 # give it a little time for fully recovered before next test
+}
+run_test 11 "Eleventh Failure Mode: MDS0/CLIENT/MDS1 `date`"
+###################################################
+
+test_12() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       echo "Verify Lustre filesystem is up and running"
+       [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+
+       #MDS Portion
+       fail mds1,mds2
+       clients_up
+
+       #OSS Portion
+       fail ost1,ost2
+       clients_up
+
+       #CLIENT Portion
+       echo "Failing 2 CLIENTS"
+       fail_clients 2
+
+       #Check FS
+       echo "Test Lustre stability after CLIENT failure"
+       clients_up
+
+       #Reintegration
+       echo "Reintegrating CLIENTS"
+       reintegrate_clients || return 1
+
+       clients_up || return 3
+       sleep 2 # give it a little time for fully recovered before next test
+}
+run_test 12 "Twelve Failure Mode: MDS0,MDS1/OST0, OST1/CLIENTS `date`"
+###################################################
+
+test_13() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       echo "Verify Lustre filesystem is up and running"
+       [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+
+       #MDS Portion
+       fail mds1,mds2
+       clients_up
+
+       #CLIENT Portion
+       echo "Failing 2 CLIENTS"
+       fail_clients 2
+
+       #Check FS
+       echo "Test Lustre stability after CLIENT failure"
+       clients_up
+
+       #Reintegration
+       echo "Reintegrating CLIENTS"
+       reintegrate_clients || return 1
+
+       clients_up || return 3
+       sleep 2 # give it a little time for fully recovered before next test
+
+       #OSS Portion
+       fail ost1,ost2
+       clients_up || return 4
+}
+run_test 13 "Thirteen Failure Mode: MDS0,MDS1/CLIENTS/OST0,OST1 `date`"
+###################################################
+
+test_14() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       echo "Verify Lustre filesystem is up and running"
+       [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
+
+       #OST Portion
+       fail ost1,ost2
+       clients_up
+
+       #CLIENT Portion
+       echo "Failing 2 CLIENTS"
+       fail_clients 2
+
+       #Check FS
+       echo "Test Lustre stability after CLIENT failure"
+       clients_up
+
+       #Reintegration
+       echo "Reintegrating CLIENTS"
+       reintegrate_clients || return 1
+
+       clients_up || return 3
+       sleep 2 # give it a little time for fully recovered before next test
+
+       #OSS Portion
+       fail mds1,mds2
+       clients_up || return 4
+}
+run_test 14 "Fourteen Failure Mode: OST0,OST1/CLIENTS/MDS0,MDS1 `date`"
+###################################################
+
+test_15() {
     #Run availability after all failures
     DURATION=${DURATION:-$((2 * 60 * 60))} # 6 hours default
     LOADTEST=${LOADTEST:-metadata-load.py}
     $PWD/availability.sh $CONFIG $DURATION $CLIENTS || return 1
 }
-run_test 10 "Running Availability for 6 hours..."
+run_test 15 "Running Availability for 6 hours..."
 
-complete $(basename $0) $SECONDS
+complete $SECONDS
 check_and_cleanup_lustre
 exit_status