Whamcloud - gitweb
Merge b_md into HEAD
[fs/lustre-release.git] / lustre / tests / uml.sh
1 #!/bin/bash
2
3 config=${1-uml.xml}
4 LMC=${LMC-../utils/lmc}
5 TMP=${TMP:-/tmp}
6
7 MDSDEV=${MDSDEV:-$TMP/mds1}
8 MDSSIZE=${MDSSIZE:-50000}
9
10 OSTDEV1=${OSTDEV1:-$TMP/ost1}
11 OSTDEV2=${OSTDEV2:-$TMP/ost2}
12 OSTSIZE=${OSTSIZE:-100000}
13
14 NETTYPE=${NETTYPE:-tcp}
15
16 # NOTE - You can't have different MDS/OST nodes and also have clients on the
17 #        MDS/OST nodes without using --endlevel and --startlevel during lconf.
18 #        You can put both MDS/OST on one node and client can be there too.
19 #        CLIENTS is a space-separated list of client nodes.
20 #
21 #        The rule is that both the MDS and the OST must be set up before any
22 #        of the clients can be started, so plan accordingly.
23
24 # Three separate systems
25 MDSNODE=${MDSNODE:-uml1}
26 OSTNODES=${OSTNODES:-"uml2 uml2"}
27 CLIENTS=${CLIENTS:-"uml3"}
28
29 # Single system with additional clients
30 #MDSNODE=uml1
31 #OSTNODES="uml1 uml1"
32 #CLIENTS="$MDSNODE client"
33
34 # Two systems with client on MDS, and additional clients (set up OST first)
35 #MDSNODE=uml1
36 #OSTNODES="uml2 uml2"
37 #CLIENTS="$MDSNODE client"
38
39 # Two systems with client on OST, and additional clients (set up MDS first)
40 #MDSNODE=uml1
41 #OSTNODES="uml2 uml2"
42 #CLIENTS="$OSTNODES client"
43
44 rm -f $config
45
46 h2tcp () {
47         case $1 in
48         client) echo '\*' ;;
49         *) echo $1 ;;
50         esac
51 }
52
53 h2elan () {
54         case $1 in
55         client) echo '\*' ;;
56         *) echo $1 | sed "s/[^0-9]*//" ;;
57         esac
58 }
59
60 # create nodes
61 echo -n "adding NET for:"
62 for NODE in `echo $MDSNODE $OSTNODES $CLIENTS | sort -u`; do
63         echo -n " $NODE"
64         ${LMC} -m $config --add net --node $NODE --nid `h2$NETTYPE $NODE` --nettype elan || exit 1
65 done
66
67 # configure mds server
68 echo; echo "adding MDS on: $MDSNODE"
69 ${LMC} -m $config --add mds --format --node $MDSNODE --mds mds1 --dev $MDSDEV --size $MDSSIZE ||exit 10
70
71 # configure ost
72 ${LMC} -m $config --add lov --lov lov1 --mds mds1 --stripe_sz 65536 --stripe_cnt 1 --stripe_pattern 0 || exit 20
73 COUNT=1
74 echo -n "adding OST on:"
75 for NODE in $OSTNODES; do
76         eval OSTDEV=\$OSTDEV$COUNT
77         echo -n " $NODE"
78         OSTDEV=${OSTDEV:-$OSTDEV1}
79         ${LMC} -m $config --add ost --node $NODE --lov lov1 --dev $OSTDEV --size $OSTSIZE || exit 21
80         COUNT=`expr $COUNT + 1`
81 done
82
83 # create client config(s)
84 echo; echo -n "adding CLIENT on:"
85 for NODE in $CLIENTS; do
86         echo -n " $NODE"
87         ${LMC} -m $config --add mtpt --node $NODE --path /mnt/lustre --mds mds1 --lov lov1 || exit 30
88 done
89 echo