Whamcloud - gitweb
LU-1538 tests: standardize test script init dne-part-1
[fs/lustre-release.git] / lustre / tests / parallel-scale-nfs.sh
1 #!/bin/bash
2 #
3 #set -vx
4
5 NFSVERSION=${1:-"3"}
6 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
7 . $LUSTRE/tests/test-framework.sh
8 # only call init_test_env if this script is called directly
9 if [[ -z "$TESTSUITE" || "$TESTSUITE" = "$(basename $0 .sh)" ]]; then
10         init_test_env $@
11 fi
12 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
13 init_logging
14
15 racer=$LUSTRE/tests/racer/racer.sh
16 . $LUSTRE/tests/setup-nfs.sh
17
18 # lustre client used as nfs server (default is mds node)
19 LUSTRE_CLIENT_NFSSRV=${LUSTRE_CLIENT_NFSSRV:-$(facet_active_host $SINGLEMDS)}
20 NFS_SRVMNTPT=${NFS_SRVMNTPT:-$MOUNT}
21 NFS_CLIENTS=${NFS_CLIENTS:-$CLIENTS}
22 NFS_CLIENTS=$(exclude_items_from_list $NFS_CLIENTS $LUSTRE_CLIENT_NFSSRV)
23 NFS_CLIMNTPT=${NFS_CLIMNTPT:-$MOUNT}
24
25 [ -z "$NFS_CLIENTS" ] &&
26         skip_env "need at least two nodes: nfs server and nfs client"
27
28 [ "$NFSVERSION" = "4" ] && cl_mnt_opt="${MOUNT_OPTS:+$MOUNT_OPTS,}32bitapi" ||
29         cl_mnt_opt=""
30
31 check_and_setup_lustre
32 $LFS df
33 TESTDIR=$NFS_CLIMNTPT/d0.$(basename $0 .sh)
34 mkdir -p $TESTDIR
35 $LFS setstripe -c -1 $TESTDIR
36
37 # first unmount all the lustre clients
38 cleanup_mount $MOUNT
39
40 cleanup_exit () {
41         trap 0
42         cleanup
43         check_and_cleanup_lustre
44         exit
45 }
46
47 cleanup () {
48         cleanup_nfs "$NFS_CLIMNTPT" "$LUSTRE_CLIENT_NFSSRV" "$NFS_CLIENTS" ||
49                 error_noexit false "failed to cleanup nfs"
50         zconf_umount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT force ||
51                 error_noexit false "failed to umount lustre on"\
52                         "$LUSTRE_CLIENT_NFSSRV"
53         # restore lustre mount
54         restore_mount $MOUNT ||
55                 error_noexit false "failed to mount lustre"
56 }
57
58 trap cleanup_exit EXIT SIGHUP SIGINT
59
60 zconf_mount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT "$cl_mnt_opt" ||
61         error "mount lustre on $LUSTRE_CLIENT_NFSSRV failed"
62
63 # setup the nfs
64 setup_nfs "$NFSVERSION" "$NFS_SRVMNTPT" "$LUSTRE_CLIENT_NFSSRV" \
65                 "$NFS_CLIENTS" "$NFS_CLIMNTPT" ||
66         error false "setup nfs failed!"
67
68 NFSCLIENT=true
69 FAIL_ON_ERROR=false
70
71 # common setup
72 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
73 clients=${NFS_CLIENTS:-$HOSTNAME}
74 generate_machine_file $clients $MACHINEFILE ||
75         error "Failed to generate machine file"
76 num_clients=$(get_node_count ${clients//,/ })
77
78 # compilbench
79 # Run short iteration in nfs mode
80 cbench_IDIRS=${cbench_IDIRS:-2}
81 cbench_RUNS=${cbench_RUNS:-2}
82
83 # metabench
84 # Run quick in nfs mode
85 mbench_NFILES=${mbench_NFILES:-10000}
86
87 # connectathon
88 [ "$SLOW" = "no" ] && cnt_NRUN=2
89
90 # IOR
91 ior_DURATION=${ior_DURATION:-30}
92
93 # source the common file after all parameters are set to take affect
94 . $LUSTRE/tests/functions.sh
95
96 build_test_filter
97
98 get_mpiuser_id $MPI_USER
99 MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"}
100 $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS
101
102 test_compilebench() {
103         run_compilebench $TESTDIR
104 }
105 run_test compilebench "compilebench"
106
107 test_metabench() {
108         run_metabench $TESTDIR $NFS_CLIMNTPT
109 }
110 run_test metabench "metabench"
111
112 test_connectathon() {
113         run_connectathon $TESTDIR
114 }
115 run_test connectathon "connectathon"
116
117 test_iorssf() {
118         run_ior "ssf" $TESTDIR $NFS_SRVMNTPT
119 }
120 run_test iorssf "iorssf"
121
122 test_iorfpp() {
123         run_ior "fpp" $TESTDIR $NFS_SRVMNTPT
124 }
125 run_test iorfpp "iorfpp"
126
127 test_racer_on_nfs() {
128         local racer_params="MDSCOUNT=$MDSCOUNT OSTCOUNT=$OSTCOUNT LFS=$LFS"
129
130         do_nodes $CLIENTS "$racer_params $racer $TESTDIR"
131 }
132 run_test racer_on_nfs "racer on NFS client"
133
134 complete $SECONDS
135 exit_status