Whamcloud - gitweb
b=15255
[fs/lustre-release.git] / lustre / tests / replay-single.sh
index 13ee927..e7e716a 100755 (executable)
@@ -1408,6 +1408,76 @@ test_61c() {
 }
 run_test 61c "test race mds llog sync vs llog cleanup"
 
+# start multi-client tests
+test_70a () {
+       [ -z "$CLIENTS" ] && \
+               { skip "Need two or more clients." && return; }
+       [ $CLIENTCOUNT -lt 2 ] && \
+               { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
+
+       echo "mount clients $CLIENTS ..."
+       zconf_mount_clients $CLIENTS $DIR
+
+       local clients=${CLIENTS//,/ }
+       echo "Write/read files on $DIR ; clients $CLIENTS ... "
+       for CLIENT in $clients; do
+               do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
+                       of=$DIR/${tfile}_${CLIENT} 2>/dev/null || \
+                               error "dd failed on $CLIENT"
+       done
+
+       local prev_client=$(echo $clients | sed 's/^.* \(\w\+\)$/\1/') 
+       for C in ${CLIENTS//,/ }; do
+               do_node $prev_client dd if=$DIR/${tfile}_${C} of=/dev/null 2>/dev/null || \
+                       error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
+               prev_client=$C
+       done
+       
+       ls $DIR
+
+       zconf_umount_clients $CLIENTS $DIR
+}
+run_test 70a "check multi client t-f"
+
+test_70b () {
+       [ -z "$CLIENTS" ] && \
+               { skip "Need two or more clients." && return; }
+       [ $CLIENTCOUNT -lt 2 ] && \
+               { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
+
+       zconf_mount_clients $CLIENTS $DIR
+       
+       local duration="-t 60"
+       local cmd="rundbench 1 $duration "
+       local PID=""
+       for CLIENT in ${CLIENTS//,/ }; do
+               $PDSH $CLIENT "set -x; PATH=:$PATH:$LUSTRE/utils:$LUSTRE/tests/:${DBENCH_LIB} DBENCH_LIB=${DBENCH_LIB} $cmd" &
+               PID=$!
+               echo $PID >pid.$CLIENT
+               echo "Started load PID=`cat pid.$CLIENT`"
+       done
+
+       replay_barrier $SINGLEMDS 
+       sleep 3 # give clients a time to do operations
+
+       log "$TESTNAME fail mds 1"
+       fail $SINGLEMDS
+
+# wait for client to reconnect to MDS
+       sleep $TIMEOUT
+
+       for CLIENT in ${CLIENTS//,/ }; do
+               PID=`cat pid.$CLIENT`
+               wait $PID
+               rc=$?
+               echo "load on ${CLIENT} returned $rc"
+       done
+
+       zconf_umount_clients $CLIENTS $DIR 
+}
+run_test 70b "mds recovery; $CLIENTCOUNT clients"
+# end multi-client tests
+
 equals_msg `basename $0`: test complete, cleaning up
 check_and_cleanup_lustre
 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true