Whamcloud - gitweb
b=19139
[fs/lustre-release.git] / lustre / tests / large-scale.sh
1 #!/bin/bash
2
3 set -e
4
5 # bug number:
6 ALWAYS_EXCEPT="$LARGE_SCALE_EXCEPT"
7
8 SAVE_PWD=$PWD
9 PTLDEBUG=${PTLDEBUG:--1}
10 LUSTRE=${LUSTRE:-`dirname $0`/..}
11 SETUP=${SETUP:-""}
12 CLEANUP=${CLEANUP:-""}
13 . $LUSTRE/tests/test-framework.sh
14
15 init_test_env $@
16
17 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
18
19 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
20
21 [ -n "$CLIENTS" ] || { skip "$0: Need two or more clients" && exit 0; }
22 [ $CLIENTCOUNT -ge 2 ] || \
23     { skip "$0: Need two or more clients, have $CLIENTCOUNT" && exit 0; }
24
25 #
26 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
27
28 MOUNT_2=""
29 build_test_filter
30
31 check_and_setup_lustre
32 rm -rf $DIR/[df][0-9]*
33
34 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
35
36 test_3a() {
37     assert_env CLIENTS MDSRATE MPIRUN
38
39     local -a nodes=(${CLIENTS//,/ })
40
41     # INCREMENT is a number of clients 
42     # a half of clients by default
43     increment=${INCREMENT:-$(( CLIENTCOUNT / 2 ))}
44
45     machinefile=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
46     local LOG=$TMP/${TESTSUITE}_$tfile
47
48     local var=${SINGLEMDS}_svc
49     local procfile="*.${!var}.recovery_status"
50     local iters=${ITERS:-3}
51     local nfiles=${NFILES:-50000}
52     local nthreads=${THREADS_PER_CLIENT:-3}
53
54     local IFree=$(inodes_available)
55     [ $IFree -gt $nfiles ] || nfiles=$IFree
56
57     local dir=$DIR/$tdir
58     mkdir -p $dir
59     chmod 0777 $dir
60
61     local pid
62     local list
63     local -a res
64
65     local num=$increment
66
67     while [ $num -le $CLIENTCOUNT ]; do
68         list=$(comma_list ${nodes[@]:0:$num}) 
69
70         generate_machine_file $list $machinefile ||
71             { error "can not generate machinefile"; exit 1; }
72
73         for i in $(seq $iters); do
74             mdsrate_cleanup $num $machinefile $nfiles $dir 'f%%d' --ignore
75
76             COMMAND="${MDSRATE} --create --nfiles $nfiles --dir $dir --filefmt 'f%%d'"
77             mpi_run -np $((num * nthreads)) -machinefile $machinefile ${COMMAND} | tee ${LOG} &
78
79             pid=$!
80             echo "pid=$pid"
81
82             # 2 threads 100000 creates 117 secs
83             sleep 20
84
85             log "$i : Starting failover on $SINGLEMDS"
86             facet_failover $SINGLEMDS
87             if ! wait_recovery_complete $SINGLEMDS $((TIMEOUT * 10)); then
88                 echo "$SINGLEMDS recovery is not completed!"
89                 kill -9 $pid
90                 exit 7
91             fi
92
93             duration=$(do_facet $SINGLEMDS lctl get_param -n $procfile | grep recovery_duration)
94             
95             res=( "${res[@]}" "$num" )
96             res=( "${res[@]}" "$duration" )
97             echo "RECOVERY TIME: NFILES=$nfiles number of clients: $num  $duration"
98             wait $pid
99
100         done
101         num=$((num + increment))
102     done
103
104     mdsrate_cleanup $num $machinefile $nfiles $dir 'f%%d' --ignore
105
106     i=0
107     while [ $i -lt ${#res[@]} ]; do
108         echo "RECOVERY TIME: NFILES=$nfiles number of clients: ${res[i]}  ${res[i+1]}"
109         i=$((i+2))
110     done
111 }
112
113 run_test 3a "recovery time, $CLIENTCOUNT clients"
114
115 equals_msg `basename $0`: test complete, cleaning up
116 check_and_cleanup_lustre
117 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true