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