Whamcloud - gitweb
b=12797
[fs/lustre-release.git] / lustre / tests / replay-dual.sh
index 6db74a2..026ffe2 100755 (executable)
@@ -5,37 +5,23 @@ set -e
 # bug number:  6088 10124 10800
 ALWAYS_EXCEPT="8    15c   17    $REPLAY_DUAL_EXCEPT"
 
+SAVE_PWD=$PWD
 PTLDEBUG=${PTLDEBUG:--1}
 LUSTRE=${LUSTRE:-`dirname $0`/..}
+SETUP=${SETUP:-""}
+CLEANUP=${CLEANUP:-""}
+MOUNT_2=${MOUNT_2:-"yes"}
 . $LUSTRE/tests/test-framework.sh
 
 init_test_env $@
 
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
-SETUP=${SETUP:-"setup"}
-CLEANUP=${CLEANUP:-"cleanup"}
 
 build_test_filter
 
-cleanup() {
-    stopall
-}
-
-if [ "$ONLY" == "cleanup" ]; then
-    sysctl -w lnet.debug=0
-    cleanup
-    exit
-fi
-
-setup() {
-    cleanup
-    [ "$REFORMAT" ] && formatall
-    setupall
-    mount_client $MOUNT2
-}
+cleanup_and_setup_lustre
 
-$SETUP
 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
 
 test_1() {
@@ -156,9 +142,9 @@ test_9() {
     mcreate $MOUNT1/$tfile-1
     mcreate $MOUNT2/$tfile-2
     # drop first reint reply
-    sysctl -w lustre.fail_loc=0x80000119
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0x80000119
     fail $SINGLEMDS
-    sysctl -w lustre.fail_loc=0
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0
 
     rm $MOUNT1/$tfile-[1,2] || return 1
 
@@ -172,9 +158,9 @@ test_10() {
     munlink $MOUNT1/$tfile-1
     mcreate $MOUNT2/$tfile-2
     # drop first reint reply
-    sysctl -w lustre.fail_loc=0x80000119
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0x80000119
     fail $SINGLEMDS
-    sysctl -w lustre.fail_loc=0
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0
 
     checkstat $MOUNT1/$tfile-1 && return 1
     checkstat $MOUNT1/$tfile-2 || return 2
@@ -192,11 +178,12 @@ test_11() {
     mcreate $MOUNT2/$tfile-4
     mcreate $MOUNT1/$tfile-5
     # drop all reint replies for a while
-    sysctl -w lustre.fail_loc=0x0119
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0x0119
+    # note that with this fail_loc set, facet_failover df will fail
     facet_failover $SINGLEMDS
     #sleep for while, let both clients reconnect and timeout
     sleep $((TIMEOUT * 2))
-    sysctl -w lustre.fail_loc=0
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0
 
     rm $MOUNT1/$tfile-[1-5] || return 1
 
@@ -212,10 +199,10 @@ test_12() {
     sleep 5
 
 #define OBD_FAIL_LDLM_ENQUEUE            0x302
-    sysctl -w lustre.fail_loc=0x80000302
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0x80000302
     facet_failover $SINGLEMDS
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0
     df $MOUNT || return 1
-    sysctl -w lustre.fail_loc=0
 
     ls $DIR/$tfile
     kill -USR1 $MULTIPID || return 3
@@ -238,10 +225,10 @@ test_13() {
     wait $MULTIPID || return 4
 
     # drop close 
-    sysctl -w lustre.fail_loc=0x80000115
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0x80000115
     facet_failover $SINGLEMDS
+    do_facet $SINGLEMDS sysctl -w lustre.fail_loc=0
     df $MOUNT || return 1
-    sysctl -w lustre.fail_loc=0
 
     ls $DIR/$tfile
     $CHECKSTAT -t file $DIR/$tfile || return 2
@@ -259,14 +246,14 @@ test_14() {
     umount $MOUNT2
 
     facet_failover $SINGLEMDS
-    # expect failover to fail
+    # expect failover to fail due to missing client 2
     df $MOUNT && return 1
     sleep 1
 
     # first 25 files should have been replayed 
     unlinkmany $MOUNT1/$tfile- 25 || return 2
 
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail" 
     return 0
 }
 run_test 14 "timeouts waiting for lost client during replay"
@@ -283,7 +270,7 @@ test_15() {
     unlinkmany $MOUNT1/$tfile- 25 || return 2
     [ -e $MOUNT1/$tfile-2-0 ] && error "$tfile-2-0 exists"
 
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 }
 run_test 15 "timeout waiting for lost client during replay, 1 client completes"
@@ -332,7 +319,7 @@ test_15a() {
            }
     done
 
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 }
 #CROW run_test 15a "OST clear orphans - synchronize ids on MDS and OST"
@@ -348,7 +335,7 @@ test_15b() {
     df $MOUNT || return 1
     do_facet ost1 "sysctl -w lustre.fail_loc=0"
     
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 }
 #CROW run_test 15b "multiple delayed OST clear orphans"
@@ -364,7 +351,7 @@ test_15c() {
 
     df $MOUNT || return 1
     
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 }
 run_test 15c "remove multiple OST orphans"
@@ -382,7 +369,7 @@ test_16() {
 
     unlinkmany $MOUNT1/$tfile- 25 || return 2
 
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 
 }
@@ -403,7 +390,7 @@ test_17() {
 
     unlinkmany $MOUNT1/$tfile- 25 || return 2
 
-    zconf_mount `hostname` $MOUNT2
+    zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
     return 0
 
 }
@@ -444,10 +431,9 @@ test_19() { # Bug 10991 - resend of open request does not fail assertion.
 }
 run_test 19 "resend of open request"
 
-if [ "$ONLY" != "setup" ]; then
-   equals_msg test complete, cleaning up
-   SLEEP=$((`date +%s` - $NOW))
-   [ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
-   $CLEANUP
-fi
-echo "$0: completed"
+equals_msg `basename $0`: test complete, cleaning up
+SLEEP=$((`date +%s` - $NOW))
+[ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
+check_and_cleanup_lustre
+[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true
+