Whamcloud - gitweb
LU-17452 tests: fix interop sanityn tests with b2_15
[fs/lustre-release.git] / lustre / tests / llmount.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # This file is part of Lustre, http://www.lustre.org/
6 #
7 # lustre/tests/llmount.sh
8 #
9 # Create a simple lustre filesystem and client for
10 # testing
11 #
12
13 usage() {
14         less -F <<EOF
15 Usage: ${0##*/} [options]
16 Helper for creating, formatting, and mounting a simple lustre filesystem.
17         -S, --server-only   Do not setup up a client
18         -n, --no-format     Do not reformat the test filesystem
19         -s, --skip-setup    Do not setup the test filesystem
20         -l, --load-modules  Load the lustre modules
21         -h, --help          This help
22
23 Environment variables
24 See lustre/tests/cfg/local.sh to see more variables.
25         FSTYPE    ldiskfs,zfs  Type of backing filesystem
26         MDSCOUNT  number       Number of MDS
27         OSSCOUNT  number       Number of OSS
28         MOUNTOPT  string       Options passed to client mount command
29
30 Example usage:
31 Create a simple lustre filesystem.
32
33         ./llmount.sh --server-only
34
35 Create a ZFS backed lustre filesystem with a client.
36
37         FSTYPE=zfs ./llmount.sh
38
39 EOF
40         exit
41 }
42
43 setup_client=true
44
45 # Replace long option with corresponding short option
46 for arg in "$@"; do
47         shift
48         case "$arg" in
49                 --server-only) set -- "$@" '-S';;
50                 --no-format) set -- "$@" '-n';;
51                 --skip-setup) set -- "$@" '-s';;
52                 --load-modules) set -- "$@" '-l';;
53                 --help) set -- "$@" '-h';;
54                 *) set -- "$@" "$arg";;
55         esac
56 done
57
58 while getopts "Snslh" opt
59 do
60         case "$opt" in
61                 S) setup_client=false;;
62                 n) NOFORMAT=true;;
63                 s) NOSETUP=true;;
64                 l) LOAD=true;;
65                 h|\?) usage;;
66         esac
67 done
68
69 LUSTRE=${LUSTRE:-$(dirname "$0")/..}
70 . "$LUSTRE/tests/test-framework.sh"
71 init_test_env "$@"
72
73 [ -n "$LOAD" ] && load_modules && exit 0
74 [ -z "$NOFORMAT" ] && formatall
75
76 if $setup_client; then
77         [ -z "$NOSETUP" ] && setupall
78 else
79         [ -z "$NOSETUP" ] && setupall server_only
80 fi