X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre-iokit%2Fobdfilter-survey%2Fcreate-echoclient;fp=lustre-iokit%2Fobdfilter-survey%2Fcreate-echoclient;h=822f061029bc31bd5a442d8a3fb8e1e7313539f3;hb=2afdf3499344737d70737ec2fa4e19575ca3203c;hp=0000000000000000000000000000000000000000;hpb=74be41ac38aaa1d04169cb7873c60ddf7c1caaf1;p=fs%2Flustre-release.git diff --git a/lustre-iokit/obdfilter-survey/create-echoclient b/lustre-iokit/obdfilter-survey/create-echoclient new file mode 100755 index 0000000..822f061 --- /dev/null +++ b/lustre-iokit/obdfilter-survey/create-echoclient @@ -0,0 +1,82 @@ +#!/bin/bash + +# This script will create a Lustre .xml configuration consisting +# of echo client/servers for use with the obdfilter-survey test + +####################################################################### +# Customisation variables +####################################################################### + +config=$(basename $0 .sh).xml + +SERVERS=${SERVERS:-$(uname -n)} + +NETS=${NETS:-tcp} + +LMC=lmc +VERBOSE=1 +BATCH=/tmp/lmc-batch.$$ + +####################################################################### +# some helpers: actual config below +####################################################################### + +h2elan () { + echo $1 | sed 's/[^0-9]*//g' +} + +_LMC="${LMC} -m $config" + +_lmc () { + if [ $VERBOSE ]; then echo "$@"; fi + if [ -n "$BATCH" ]; then + echo "$@" >> $BATCH + else + $_LMC "$@" + fi +} + +config_end () { + [ -n "$BATCH" ] && $_LMC --batch $BATCH + cleanup +} + +cleanup () { + [ -n "$BATCH" ] && rm -f $BATCH +} + +ABORT_ON="ERR QUIT INT HUP" + +abort () { + trap - EXIT $ABORT_ON + echo "Error/Interrupt creating $config" + cleanup + exit 1 +} + +trap config_end EXIT +trap abort $ABORT_ON + +[ -f $config ] && rm $config + +#################################################################### +# the actual config +#################################################################### + +# client net +_lmc --node client --add net --nettype lnet --nid '*' + +for srv in $SERVERS; do + for net in $NETS; do + case $net in + elan*) nid=`h2elan $srv`;; + gm*) nid=`gmnalnid -n $srv`;; + *) nid=$srv;; + esac + _lmc --node $srv --add net --nettype lnet --nid ${nid}@${net} + done + + _lmc --node $srv --add ost --ost ost_$srv --osdtype=obdecho + + _lmc --node client --add echo_client --ost ost_$srv +done