Whamcloud - gitweb
Branch HEAD
[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 get_mpiuser_id $MPI_USER
35 MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"}
36 $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS
37
38 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
39
40 test_3a() {
41     assert_env CLIENTS MDSRATE MPIRUN
42
43     local -a nodes=(${CLIENTS//,/ })
44
45     # INCREMENT is a number of clients 
46     # a half of clients by default
47     increment=${INCREMENT:-$(( CLIENTCOUNT / 2 ))}
48
49     machinefile=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
50     local LOG=$TMP/${TESTSUITE}_$tfile
51
52     local var=${SINGLEMDS}_svc
53     local procfile="*.${!var}.recovery_status"
54     local iters=${ITERS:-3}
55     local nfiles=${NFILES:-50000}
56     local nthreads=${THREADS_PER_CLIENT:-3}
57
58     local IFree=$(inodes_available)
59     [ $IFree -gt $nfiles ] || nfiles=$IFree
60
61     local dir=$DIR/$tdir
62     mkdir -p $dir
63     chmod 0777 $dir
64
65     local pid
66     local list
67     local -a res
68
69     local num=$increment
70
71     while [ $num -le $CLIENTCOUNT ]; do
72         list=$(comma_list ${nodes[@]:0:$num}) 
73
74         generate_machine_file $list $machinefile ||
75             { error "can not generate machinefile"; exit 1; }
76
77         for i in $(seq $iters); do
78             mdsrate_cleanup $num $machinefile $nfiles $dir 'f%%d' --ignore
79
80             COMMAND="${MDSRATE} --create --nfiles $nfiles --dir $dir --filefmt 'f%%d'"
81             mpi_run -np $((num * nthreads)) -machinefile $machinefile ${COMMAND} | tee ${LOG} &
82
83             pid=$!
84             echo "pid=$pid"
85
86             # 2 threads 100000 creates 117 secs
87             sleep 20
88
89             log "$i : Starting failover on $SINGLEMDS"
90             facet_failover $SINGLEMDS
91             if ! wait_recovery_complete $SINGLEMDS $((TIMEOUT * 10)); then
92                 echo "$SINGLEMDS recovery is not completed!"
93                 kill -9 $pid
94                 exit 7
95             fi
96
97             duration=$(do_facet $SINGLEMDS lctl get_param -n $procfile | grep recovery_duration)
98             
99             res=( "${res[@]}" "$num" )
100             res=( "${res[@]}" "$duration" )
101             echo "RECOVERY TIME: NFILES=$nfiles number of clients: $num  $duration"
102             wait $pid
103
104         done
105         num=$((num + increment))
106     done
107
108     mdsrate_cleanup $num $machinefile $nfiles $dir 'f%%d' --ignore
109
110     i=0
111     while [ $i -lt ${#res[@]} ]; do
112         echo "RECOVERY TIME: NFILES=$nfiles number of clients: ${res[i]}  ${res[i+1]}"
113         i=$((i+2))
114     done
115 }
116
117 run_test 3a "recovery time, $CLIENTCOUNT clients"
118
119 equals_msg `basename $0`: test complete, cleaning up
120 check_and_cleanup_lustre
121 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true