From: rread Date: Thu, 29 Aug 2002 19:54:51 +0000 (+0000) Subject: * clean up mcr config script X-Git-Tag: 0.5.5~10 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=59ce5263e2274a1fdf74a24c8b2f9c8e5be31cc7;p=fs%2Flustre-release.git * clean up mcr config script --- diff --git a/lustre/tests/mcr.sh b/lustre/tests/mcr.sh index 7407049..baee3fa 100755 --- a/lustre/tests/mcr.sh +++ b/lustre/tests/mcr.sh @@ -2,20 +2,45 @@ config=${1:-mcr.xml} -LMC=../utils/lmc +LMC="../utils/lmc -m $config" -# create nodes -${LMC} -o $config --node client --net '*' elan || exit 1 -${LMC} -m $config --node mdev2 --net mdev2 tcp || exit 1 -${LMC} -m $config --router --node mdev3 --net mdev3 tcp || exit 1 -${LMC} -m $config --node mdev3 --net 3 elan || exit 1 +# TCP/IP servers +SERVERS="ba-ost-1 ba-ost-2" +ROUTER=mdev3 -${LMC} -m $config --node mdev3 --route elan 3 2 25 || exit 2 -${LMC} -m $config --node mdev3 --route tcp mdev3 mdev2 || exit 2 +# Elan clients +CLIENT_LO=mdev2 +CLIENT_HI=mdev25 +PORT=2432 +TCPBUF=1048576 + -# configure ost -${LMC} -m $config --format --node mdev2 --obdtype=obdecho --ost || exit 3 +h2elan () { + echo $1 | sed 's/[^0-9]*//g' +} -# create client config -${LMC} -m $config --node client --osc OSC_mdev2 || exit 4 +h2ip () { + echo "${1}" +} + +[ -f $config ] && rm $config + +# Client node +${LMC} --node client --net '*' elan || exit 1 +# Router node +${LMC} --router --node $ROUTER --net `h2ip $ROUTER` tcp $PORT || exit 1 +${LMC} --node $ROUTER --net `h2elan $ROUTER` elan|| exit 1 +${LMC} --node $ROUTER --route elan `h2elan $ROUTER` `h2elan $CLIENT_LO` `h2elan $CLIENT_HI` || exit 2 + +for s in $SERVERS + do + # server node + ${LMC} --node $s --net $s tcp $PORT || exit 1 + # route to server + ${LMC} --node $ROUTER --route tcp `h2ip $ROUTER` $s || exit 2 + # the device on the server + ${LMC} --format --node $s --obdtype=obdecho --ost || exit 3 + # attach to the device on the client (this would normally be a moun) + ${LMC} --node client --osc OSC_$s || exit 4 +done \ No newline at end of file diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 6b758de..1e34a8b 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -151,6 +151,8 @@ def panic(*args): msg = string.join(map(str,args)) if not config.noexec(): raise LconfError(msg) + else: + print "! " + msg def log(*args): msg = string.join(map(str,args)) @@ -276,18 +278,18 @@ class LCTLInterface: # add a route to a range def add_route(self, net, gw, lo, hi): cmds = """ - network %s - add_route %s %s %s - """ % (net, gw, lo, hi) + network %s + add_route %s %s %s + quit """ % (net, gw, lo, hi) self.run(cmds) # add a route to a host def add_route_host(self, net, uuid, gw, tgt): cmds = """ - network %s - add_uuid %s %s - add_route %s %s - """ % (net, uuid, tgt, gw, tgt) + network %s + add_uuid %s %s + add_route %s %s + quit """ % (net, uuid, tgt, gw, tgt) self.run(cmds) # disconnect one connection @@ -805,7 +807,10 @@ class OSC(Module): lctl.connect(srv.net_type, srv.nid, srv.port, srv.uuid, srv.send_buf, srv.read_buf) else: r = find_route(srv) - lctl.add_route_host(r[0], srv.uuid, r[1], r[2]) + if r: + lctl.add_route_host(r[0], srv.uuid, r[1], r[2]) + else: + panic ("no route to", srv.nid) lctl.newdev(attach="osc %s %s" % (self.name, self.uuid), setup ="%s %s" %(self.obd_uuid, srv.uuid)) diff --git a/lustre/utils/lmc b/lustre/utils/lmc index 857674f..d280452 100755 --- a/lustre/utils/lmc +++ b/lustre/utils/lmc @@ -47,7 +47,7 @@ lmc - lustre configurtion data manager """ -import sys, getopt, string +import sys, os, getopt, string import xml.dom.minidom from xml.dom.ext import PrettyPrint @@ -736,7 +736,10 @@ def main(): if options.has_key('merge'): outFile = options['merge'] - doc = xml.dom.minidom.parse(outFile) + if os.access(outFile, os.R_OK): + doc = xml.dom.minidom.parse(outFile) + else: + doc = new_lustre(xml.dom.minidom) elif options.has_key('in'): doc = xml.dom.minidom.parse(options['in']) else: