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