Whamcloud - gitweb
bcf0d170685dec27abbf37e3a0971e179fab708c
[fs/lustre-release.git] / lustre / tests / mcr-routed-config.sh
1 #!/bin/bash
2
3 config=${1:-mcr2.xml}
4
5 LMC="save_cmd"
6 LMC_REAL="../../lustre/utils/lmc -m $config"
7
8 # TCP/IP servers
9 SERVER_START=1
10 SERVER_CNT=62
11 GW_START=1
12 GW_CNT=31
13 MDS=mcr23
14 UUIDLIST=${UUIDLIST:-/home/bluearc/UUID.0920}
15
16 # THis is needed for to create route for elan network
17 CLIENT_LO=mcr40
18 CLIENT_HI=mcr96
19
20 PORT=2432
21 TCPBUF=1048576
22  
23
24 h2elan () {
25     echo $1 | sed 's/[^0-9]*//g'
26 }
27
28 h2ip () {
29     echo "${1}"
30 }
31 # map gwNN to mcrNN
32 # assumes /etc/hosts looks like this:
33 # 192.168.40.11 emcr10  mcr10-eth0      emcr-r2-s1      gw10
34 gw2mcr() {
35     awk '$5 = /'$1'$/ {print substr($2,2)}'  /etc/hosts
36 }
37 BATCH=/tmp/lmc-batch.$$
38 save_cmd() {
39     echo "$@" >> $BATCH
40 }
41
42 [ -f $config ] && rm $config
43
44 ${LMC} --node $MDS --net `h2elan $MDS` elan || exit 1
45 ${LMC} --node $MDS --mds mds1 /tmp/mds1 100000 || exit 1
46 ${LMC} --lov lov1 mds1 65536 0 0
47
48 # Client node
49 #${LMC} --node client --tcpbuf $TCPBUF --net '*' tcp $PORT || exit 1
50 ${LMC} --node client --net '*' elan || exit 1
51 ${LMC} --node client --mtpt /mnt/lustre mds1 lov1
52
53 # this is crude, but effective
54 let server_per_gw=($SERVER_CNT / $GW_CNT )
55 let tot_server=$server_per_gw*$GW_CNT
56 echo "Allocating $server_per_gw per gateway."
57 echo "For a total of $tot_server Blue Arcs"
58
59 let gw=$GW_START
60 let server=$SERVER_START
61 while (( $gw < $GW_CNT + GW_START ));
62 do 
63    echo "gw$gw"
64    gwnode=`gw2mcr gw$gw`
65    ${LMC} --router --node $gwnode --tcpbuf $TCPBUF --net `h2ip $gwnode`  tcp $PORT || exit 1
66    ${LMC} --node $gwnode --net `h2elan $gwnode` elan|| exit 1
67    ${LMC} --node $gwnode --route elan `h2elan $gwnode` `h2elan $CLIENT_LO` `h2elan $CLIENT_HI` || exit 2
68
69    let  i=0
70    while (( $i < $server_per_gw ));
71    do
72       echo "server: $server"
73       ba=ba$server
74       OBD_UUID=`awk "/$OST / { print \\$3 }" $UUIDLIST`
75       [ "$OBD_UUID" ] && OBD_UUID="--obduuid=$OBD_UUID" || echo "$OST: no UUID"
76       # server node
77       ${LMC} --node $ba --tcpbuf $TCPBUF --net $ba tcp $PORT || exit 1
78       # the device on the server
79       ${LMC} --lov lov1 --node $ba $OBD_UUID --ost bluearc || exit 3
80       # route to server
81       ${LMC} --node $gwnode --route tcp `h2ip $gwnode` $ba || exit 2
82       let server=$server+1 
83       let i=$i+1
84    done
85
86    let gw=$gw+1
87 done
88
89 $LMC_REAL --batch $BATCH
90 rm -f $BATCH