Whamcloud - gitweb
* llecho.sh reimplemnted to use lmc/lconf
authorrread <rread>
Wed, 28 Aug 2002 01:19:35 +0000 (01:19 +0000)
committerrread <rread>
Wed, 28 Aug 2002 01:19:35 +0000 (01:19 +0000)
* llechocleanup.sh added for completeness
* small changes to tools to support llecho.sh

lustre/tests/llecho.sh
lustre/tests/llechocleanup.sh [new file with mode: 0755]
lustre/utils/lconf
lustre/utils/lmc

index 7296f0d..95d40f8 100644 (file)
@@ -1,13 +1,20 @@
 #!/bin/sh
 
-SRCDIR="`dirname $0`/"
-. $SRCDIR/common.sh
+config=echo.xml
+lmc=../utils/lmc
+lconf=../utils/lconf
 
-export DEBUG_WAIT=yes
-. $SRCDIR/llsetup.sh $SRCDIR/net-local.cfg $SRCDIR/obdecho.cfg $SRCDIR/client-echo.cfg
+# create nodes
+$lmc -o $config --node localhost --net localhost tcp 
+$lmc -m $config --node localhost --obdtype=obdecho --ost
+# force the osc to be configured (this is normally done when it is mounted)
+$lmc -m $config --node localhost --osc OSC_localhost
+
+$lconf --gdb $config
 
 cat <<EOF
 
 run getattr tests as:
-$OBDCTL --device `$OBDCTL name2dev OSCDEV` test_getattr 1000000
+../utils/lctl --device '\$OSC_localhost' test_getattr 1000000
 EOF
+
diff --git a/lustre/tests/llechocleanup.sh b/lustre/tests/llechocleanup.sh
new file mode 100755 (executable)
index 0000000..de4b35d
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+LCONF=../utils/lconf
+
+if [ -f echo.xml ]; then
+   ${LCONF} --cleanup echo.xml
+else
+   echo "no echo.xml found"
+fi
+
index ee8d558..0c8db8b 100755 (executable)
@@ -575,7 +575,10 @@ class Module:
             log('unloading module:', mod)
             if config.noexec():
                 continue
-            run('/sbin/rmmod', mod)
+            (rc, out) = run('/sbin/rmmod', mod)
+            if rc:
+                log('! unable to unload module:', mod)
+                logall(out)
         
 
 class Network(Module):
@@ -706,6 +709,9 @@ class MDC(Module):
         srv = Network(net)
         try:
             lctl.disconnect(srv.net_type, srv.nid, srv.port, srv.uuid)
+        except CommandError:
+            print "disconnect failed: ", self.name
+        try:
             lctl.cleanup(self.name, self.uuid)
         except CommandError:
             print "cleanup failed: ", self.name
@@ -726,15 +732,16 @@ class OBD(Module):
     # FIXME: check if device is already formatted.
     def prepare(self):
         self.info(self.obdtype, self.devname, self.size, self.fstype, self.format)
-        if not self.obdtype == 'obdecho':
-            blkdev = block_dev(self.devname, self.size, self.fstype, self.format)
-        else:
+        if self.obdtype == 'obdecho':
             blkdev = ''
+        else:
+            blkdev = block_dev(self.devname, self.size, self.fstype, self.format)
         lctl.newdev(attach="%s %s %s" % (self.obdtype, self.name, self.uuid),
                     setup ="%s %s" %(blkdev, self.fstype))
     def cleanup(self):
         Module.cleanup(self)
-        clean_loop(self.devname)
+        if not self.obdtype == 'obdecho':
+            clean_loop(self.devname)
 
 class OST(Module):
     def __init__(self,node):
@@ -771,6 +778,9 @@ class OSC(Module):
         srv = Network(net_uuid)
         try:
             lctl.disconnect(srv.net_type, srv.nid, srv.port, srv.uuid)
+        except CommandError:
+            print "disconnect failed: ", self.name
+        try:
             lctl.cleanup(self.name, self.uuid)
         except CommandError:
             print "cleanup failed: ", self.name
index ac53913..b49be8c 100755 (executable)
@@ -391,6 +391,20 @@ def add_ost(gen, lustre, options, args):
     lustre.appendChild(osc)
     lustre.appendChild(ost)
                    
+# this is generally only used by llecho.sh
+def add_osc(gen, lustre, options, args):
+    """ add the osc to the profile for this node. """
+    if len(args) < 1:
+        usage()
+    osc_name = args[0]
+    if options.has_key('node'):
+        node_name = options['node']
+    else:
+        error("--osc requires a --node argument")
+    osc_uuid = name2uuid(lustre, osc_name)
+    node = findByName(lustre, node_name, "node")
+    node_add_profile(gen, node, 'osc', osc_uuid)
+
 def add_net(gen, lustre, options, args):
     """ create a node with a network config """
     if len(args) < 2:
@@ -561,7 +575,7 @@ def add_mds(gen, lustre, options, args):
 
 def parse_cmdline(argv):
     short_opts = "ho:i:m:"
-    long_opts = ["ost", "mtpt", "lov=", "node=", "mds=", "net",
+    long_opts = ["ost", "osc", "mtpt", "lov=", "node=", "mds=", "net",
                  "mdc", "merge=", "format", "reformat", "output=",
                  "obdtype=", "in=", "help"]
     opts = []
@@ -580,6 +594,8 @@ def parse_cmdline(argv):
             options['output'] = a
         if o == "--ost":
             options['ost'] = 1
+        if o == "--osc":
+            options['osc'] = 1
         if o == "--mds":
             options['mds'] = a
         if o == "--mdc":
@@ -649,6 +665,8 @@ def main():
     gen = GenConfig(doc)
     if options.has_key('ost'):
         add_ost(gen, lustre, options, args)
+    elif options.has_key('osc'):
+        add_osc(gen, lustre, options, args)
     elif options.has_key('mtpt'):
         add_mtpt(gen, lustre, options, args)
     elif options.has_key('mds'):