Whamcloud - gitweb
Upaating the kit to use autoconf, and to build RPMs. Thanks and praise
[fs/lustre-release.git] / lustre-iokit / obdfilter-survey / echo.sh
1 #!/bin/bash
2
3 # This script will create a Lustre .xml configuration consisting
4 # of echo client/servers for use with the obdfilter-survey test
5
6 #######################################################################
7 # Customisation variables
8 #######################################################################
9
10 config=$(basename $0 .sh).xml
11
12 SERVERS=${SERVERS:-$(uname -n)}
13
14 NETS=${NETS:-tcp}
15
16 LMC=lmc
17 VERBOSE=1
18 BATCH=/tmp/lmc-batch.$$
19
20 #######################################################################
21 # some helpers: actual config below
22 #######################################################################
23
24 h2elan () {
25      echo $1 | sed 's/[^0-9]*//g'
26 }
27
28 _LMC="${LMC} -m $config"
29
30 _lmc () {
31      if [ $VERBOSE ]; then echo "$@"; fi
32      if [ -n "$BATCH" ]; then
33         echo "$@" >> $BATCH
34      else
35         $_LMC "$@"
36      fi
37 }
38
39 config_end () {
40      [ -n "$BATCH" ] && $_LMC --batch $BATCH
41      cleanup
42 }
43
44 cleanup () {
45      [ -n "$BATCH" ] && rm -f $BATCH
46 }
47
48 ABORT_ON="ERR QUIT INT HUP"
49
50 abort () {
51      trap - EXIT $ABORT_ON
52      echo "Error/Interrupt creating $config"
53      cleanup
54      exit 1
55 }
56
57 trap config_end EXIT
58 trap abort      $ABORT_ON
59
60 [ -f $config ] && rm $config
61
62 ####################################################################
63 # the actual config
64 ####################################################################
65
66 # client net
67 _lmc --node client --add net --nettype lnet --nid '*'
68
69 for srv in $SERVERS; do
70      for net in $NETS; do
71         case $net in
72             elan*) nid=`h2elan $srv`;;
73             gm*)   nid=`gmnalnid -n $srv`;;
74             *)     nid=$srv;;
75         esac
76         _lmc --node $srv --add net --nettype lnet --nid ${nid}@${net}
77      done
78
79      _lmc --node $srv --add ost --ost ost_$srv --osdtype=obdecho
80
81      _lmc --node client --add echo_client --ost ost_$srv
82 done