X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Finsanity.sh;h=74ca4a24c360eeefc26f8891ea4e9788ecf1a2b5;hb=46021d556b67557d545e01522c41b9fad20120e1;hp=4d4f7703a704730c82461e11d0e528000ba530c3;hpb=fa8df3b66d6f4e13d0b6076bb087a52b20d4166c;p=fs%2Flustre-release.git diff --git a/lustre/tests/insanity.sh b/lustre/tests/insanity.sh index 4d4f770..74ca4a2 100755 --- a/lustre/tests/insanity.sh +++ b/lustre/tests/insanity.sh @@ -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 @@ -9,17 +12,16 @@ LUSTRE=${LUSTRE:-`dirname $0`/..} init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} +init_logging # 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" + 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:-""} @@ -31,17 +33,18 @@ 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 mds_HOST +assert_env ost_HOST 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 +require_dsh_mds || exit 0 +require_dsh_ost || exit 0 # 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} +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,57 +87,57 @@ 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 } 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 $MOUNT/${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 $MOUNT/${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 $MOUNT/$c" - $PDSH $c "mkdir $MOUNT/$c" - $PDSH $c "ls -l $MOUNT/$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 $MOUNT/$c" - $PDSH $LIVE_CLIENT "rmdir $MOUNT/$c" - done + for c in $LIVE_CLIENT $FAIL_CLIENTS; do + echo "rmdir $TESTDIR/$c" + $PDSH $LIVE_CLIENT "rmdir $TESTDIR/$c" + done } clients_recover_osts() { @@ -144,6 +147,9 @@ clients_recover_osts() { check_and_setup_lustre +rm -rf $TESTDIR +mkdir -p $TESTDIR + # 9 Different Failure Modes Combinations echo "Starting Test 17 at `date`" @@ -167,10 +173,13 @@ 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" - client_df + [ "$(facet_fstype ost1)" = "zfs" ] && + skip "LU-2059: no local config for ZFS OSTs" && return + + clients_up shutdown_facet $SINGLEMDS reboot_facet $SINGLEMDS @@ -179,7 +188,7 @@ test_2() { change_active $SINGLEMDS reboot_facet $SINGLEMDS - client_df & + clients_up & DFPID=$! sleep 5 @@ -187,17 +196,17 @@ test_2() { echo "Reintegrating OST" reboot_facet ost1 - wait_for ost1 + wait_for_facet ost1 start_ost 1 || return 2 - wait_for $SINGLEMDS + wait_for_facet $SINGLEMDS start $SINGLEMDS `mdsdevname 1` $MDS_MOUNT_OPTS || return $? #Check FS wait $DFPID clients_recover_osts ost1 echo "Verify reintegration" - client_df || return 1 + clients_up || return 1 } run_test 2 "Second Failure Mode: MDS/OST `date`" @@ -215,7 +224,7 @@ test_3() { #Check FS echo "Test Lustre stability after MDS failover" - client_df + clients_up #CLIENT Portion echo "Failing 2 CLIENTS" @@ -223,13 +232,13 @@ test_3() { #Check FS echo "Test Lustre stability after CLIENT failure" - client_df + clients_up #Reintegration echo "Reintegrating CLIENTS" reintegrate_clients || return 1 - client_df || return 3 + clients_up || return 3 sleep 2 # give it a little time for fully recovered before next test } run_test 3 "Thirdb Failure Mode: MDS/CLIENT `date`" @@ -237,14 +246,17 @@ 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" - client_df & + clients_up & DFPIDA=$! sleep 5 @@ -256,17 +268,17 @@ test_4() { change_active $SINGLEMDS reboot_facet $SINGLEMDS - client_df & + clients_up & DFPIDB=$! sleep 5 #Reintegration echo "Reintegrating OST" reboot_facet ost1 - wait_for ost1 + wait_for_facet ost1 start_ost 1 - - wait_for $SINGLEMDS + + wait_for_facet $SINGLEMDS start $SINGLEMDS `mdsdevname 1` $MDS_MOUNT_OPTS #Check FS @@ -274,14 +286,14 @@ test_4() { wait $DFPIDB clients_recover_osts ost1 echo "Test Lustre stability after MDS failover" - client_df || return 1 + clients_up || return 1 } 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 + [ $OSTCOUNT -lt 2 ] && skip_env "$OSTCOUNT < 2, not enough OSTs" && return 0 echo "Fifth Failure Mode: OST/OST `date`" @@ -289,7 +301,7 @@ test_5() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up #OST Portion shutdown_facet ost1 @@ -297,7 +309,7 @@ test_5() { #Check FS echo "Test Lustre stability after OST failure" - client_df & + clients_up & DFPIDA=$! sleep 5 @@ -307,15 +319,15 @@ test_5() { #Check FS echo "Test Lustre stability after OST failure" - client_df & + clients_up & DFPIDB=$! sleep 5 #Reintegration echo "Reintegrating OSTs" - wait_for ost1 + wait_for_facet ost1 start_ost 1 - wait_for ost2 + wait_for_facet ost2 start_ost 2 clients_recover_osts ost1 @@ -324,7 +336,7 @@ test_5() { wait $DFPIDA wait $DFPIDB - client_df || return 2 + clients_up || return 2 } run_test 5 "Fifth Failure Mode: OST/OST `date`" ################################################### @@ -337,7 +349,7 @@ test_6() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up client_touch testfile || return 2 #OST Portion @@ -346,7 +358,7 @@ test_6() { #Check FS echo "Test Lustre stability after OST failure" - client_df & + clients_up & DFPIDA=$! echo DFPIDA=$DFPIDA sleep 5 @@ -357,25 +369,25 @@ test_6() { #Check FS echo "Test Lustre stability after CLIENTs failure" - client_df & + clients_up & DFPIDB=$! echo DFPIDB=$DFPIDB sleep 5 #Reintegration echo "Reintegrating OST/CLIENTs" - wait_for ost1 + wait_for_facet ost1 start_ost 1 reintegrate_clients || return 1 sleep 5 - wait_remote_prog df $((TIMEOUT * 3 + 10)) + wait_remote_prog "stat -f" $((TIMEOUT * 3 + 20)) wait $DFPIDA wait $DFPIDB echo "Verifying mount" [ -z "$(mounted_lustre_filesystems)" ] && return 3 - client_df + clients_up } run_test 6 "Sixth Failure Mode: OST/CLIENT `date`" ################################################### @@ -389,7 +401,7 @@ test_7() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up client_touch testfile || return 1 #CLIENT Portion @@ -398,9 +410,9 @@ test_7() { #Check FS echo "Test Lustre stability after CLIENTs failure" - client_df - $PDSH $LIVE_CLIENT "ls -l $MOUNT" - $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" + clients_up + $PDSH $LIVE_CLIENT "ls -l $TESTDIR" + $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" #Sleep echo "Wait 1 minutes" @@ -410,19 +422,19 @@ test_7() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && return 2 - client_df + clients_up client_rm testfile #MDS Portion fail $SINGLEMDS - $PDSH $LIVE_CLIENT "ls -l $MOUNT" - $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" + $PDSH $LIVE_CLIENT "ls -l $TESTDIR" + $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" #Reintegration echo "Reintegrating CLIENTs" reintegrate_clients || return 2 - client_df + clients_up #Sleep echo "wait 1 minutes" @@ -440,7 +452,7 @@ test_8() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up client_touch testfile #CLIENT Portion @@ -449,9 +461,9 @@ test_8() { #Check FS echo "Test Lustre stability after CLIENTs failure" - client_df - $PDSH $LIVE_CLIENT "ls -l $MOUNT" - $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" + clients_up + $PDSH $LIVE_CLIENT "ls -l $TESTDIR" + $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" #Sleep echo "Wait 1 minutes" @@ -461,7 +473,7 @@ test_8() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up client_touch testfile @@ -471,20 +483,20 @@ test_8() { #Check FS echo "Test Lustre stability after OST failure" - client_df & + clients_up & DFPID=$! sleep 5 #non-failout hangs forever here - #$PDSH $LIVE_CLIENT "ls -l $MOUNT" - #$PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" + #$PDSH $LIVE_CLIENT "ls -l $TESTDIR" + #$PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" #Reintegration echo "Reintegrating CLIENTs/OST" reintegrate_clients || return 3 - wait_for ost1 + wait_for_facet ost1 start_ost 1 wait $DFPID - client_df || return 1 + clients_up || return 1 client_touch testfile2 || return 2 #Sleep @@ -503,7 +515,7 @@ test_9() { echo "Verify Lustre filesystem is up and running" [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running" - client_df + clients_up client_touch testfile || return 1 #CLIENT Portion @@ -512,9 +524,9 @@ test_9() { #Check FS echo "Test Lustre stability after CLIENTs failure" - client_df - $PDSH $LIVE_CLIENT "ls -l $MOUNT" || return 1 - $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" || return 2 + clients_up + $PDSH $LIVE_CLIENT "ls -l $TESTDIR" || return 1 + $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" || return 2 #Sleep echo "Wait 1 minutes" @@ -522,7 +534,7 @@ test_9() { #Create files echo "Verify Lustre filesystem is up and running" - $PDSH $LIVE_CLIENT df $MOUNT || return 3 + client_up $LIVE_CLIENT || return 3 client_touch testfile || return 4 #CLIENT Portion @@ -531,14 +543,14 @@ test_9() { #Check FS echo "Test Lustre stability after CLIENTs failure" - client_df - $PDSH $LIVE_CLIENT "ls -l $MOUNT" || return 5 - $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" || return 6 + clients_up + $PDSH $LIVE_CLIENT "ls -l $TESTDIR" || return 5 + $PDSH $LIVE_CLIENT "rm -f $TESTDIR/*_testfile" || return 6 #Reintegration echo "Reintegrating CLIENTs/CLIENTs" reintegrate_clients || return 7 - client_df + clients_up #Sleep echo "Wait 1 minutes" @@ -555,6 +567,6 @@ test_10() { } run_test 10 "Running Availability for 6 hours..." -equals_msg `basename $0`: test complete, cleaning up +complete $SECONDS check_and_cleanup_lustre -[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true +exit_status