Whamcloud - gitweb
4188c3b23bc164e487c34bd6c37ec2bb52a1b33d
[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 check_and_setup_lustre
19
20 # first unmount all the lustre clients
21 cleanup_mount $MOUNT
22 # lustre client used as nfs server (default is mds node)
23 LUSTRE_CLIENT_NFSSRV=${LUSTRE_CLIENT_NFSSRV:-$(facet_active_host $SINGLEMDS)}
24 NFS_SRVMNTPT=${NFS_SRVMNTPT:-$MOUNT}
25 NFS_CLIENTS=${NFS_CLIENTS:-$CLIENTS}
26 NFS_CLIENTS=$(exclude_items_from_list $NFS_CLIENTS $LUSTRE_CLIENT_NFSSRV)
27 NFS_CLIMNTPT=${NFS_CLIMNTPT:-$MOUNT}
28
29 [ -z "$NFS_CLIENTS" ] &&
30         skip_env "need at least two nodes: nfs server and nfs client" && exit 0
31
32 [ "$NFSVERSION" = "4" ] && cl_mnt_opt="${MOUNT_OPTS:+$MOUNT_OPTS,}32bitapi" ||
33     cl_mnt_opt=""
34
35 cleanup_exit () {
36         trap 0
37         cleanup
38         check_and_cleanup_lustre
39         exit
40 }
41
42 cleanup () {
43         cleanup_nfs "$NFS_CLIMNTPT" "$LUSTRE_CLIENT_NFSSRV" "$NFS_CLIENTS" ||
44                 error_noexit false "failed to cleanup nfs"
45         zconf_umount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT force ||
46                 error_noexit false "failed to umount lustre on"\
47                         "$LUSTRE_CLIENT_NFSSRV"
48         # restore lustre mount
49         restore_mount $MOUNT ||
50                 error_noexit false "failed to mount lustre"
51 }
52
53 trap cleanup_exit EXIT SIGHUP SIGINT
54
55 zconf_mount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT "$cl_mnt_opt" ||
56     error "mount lustre on $LUSTRE_CLIENT_NFSSRV failed"
57
58 # setup the nfs
59 setup_nfs "$NFSVERSION" "$NFS_SRVMNTPT" "$LUSTRE_CLIENT_NFSSRV" \
60                 "$NFS_CLIENTS" "$NFS_CLIMNTPT" ||
61         error false "setup nfs failed!"
62
63 NFSCLIENT=true
64 FAIL_ON_ERROR=false
65
66 # common setup
67 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
68 clients=${NFS_CLIENTS:-$HOSTNAME}
69 generate_machine_file $clients $MACHINEFILE || \
70     error "Failed to generate machine file"
71 num_clients=$(get_node_count ${clients//,/ })
72
73 # compilbench
74 # Run short iteration in nfs mode
75 cbench_IDIRS=${cbench_IDIRS:-2}
76 cbench_RUNS=${cbench_RUNS:-2}
77
78 # metabench
79 # Run quick in nfs mode
80 mbench_NFILES=${mbench_NFILES:-10000}
81
82 # connectathon
83 [ "$SLOW" = "no" ] && cnt_NRUN=2
84
85 # IOR
86 ior_DURATION=${ior_DURATION:-30}
87
88 # source the common file after all parameters are set to take affect
89 . $LUSTRE/tests/functions.sh
90
91 build_test_filter
92
93 get_mpiuser_id $MPI_USER
94 MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"}
95 $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS
96
97 test_compilebench() {
98         run_compilebench $NFS_CLIMNTPT
99 }
100 run_test compilebench "compilebench"
101
102 test_metabench() {
103         run_metabench $NFS_CLIMNTPT
104 }
105 run_test metabench "metabench"
106
107 test_connectathon() {
108         run_connectathon $NFS_CLIMNTPT
109 }
110 run_test connectathon "connectathon"
111
112 test_iorssf() {
113         run_ior "ssf" $NFS_CLIMNTPT $NFS_SRVMNTPT
114 }
115 run_test iorssf "iorssf"
116
117 test_iorfpp() {
118         run_ior "fpp" $NFS_CLIMNTPT $NFS_SRVMNTPT
119 }
120 run_test iorfpp "iorfpp"
121
122 test_racer_on_nfs() {
123         $racer $CLIENTS
124 }
125 run_test racer_on_nfs "racer on NFS client"
126
127 complete $SECONDS
128 exit_status