Whamcloud - gitweb
- run config in production
[fs/lustre-release.git] / lustre / tests / common.sh
index 6357dee..a97bfcb 100644 (file)
@@ -6,6 +6,7 @@ export PATH=$PATH:/sbin:/usr/sbin
 # check if running in source directory
 # will probably need to create variable for each module.
 if [ -f $SRCDIR/Makefile.am ]; then
+    USEDEV=yes
     PORTALS=$SRCDIR/../../portals
     LUSTRE=$SRCDIR/..
 
@@ -15,6 +16,7 @@ if [ -f $SRCDIR/Makefile.am ]; then
 
     OBDCTL=$LUSTRE/utils/obdctl
 else
+    USEDEV=no
     # should have configure set the paths here
     BINDIR=/usr/sbin
     PORTALS=/lib/modules
@@ -137,6 +139,19 @@ list_mods() {
        [ "$DEBUG_WAIT" = "yes" ] && echo -n "Press ENTER to continue" && read
 }
 
+# start acceptor for a given network and port.
+# not all networks need an acceptor
+start_acceptor() {
+    case $NETWORK in
+    elan)   [ "$PORT" ] && fail "$0: NETWORK is elan but PORT is set"
+       ;;
+    tcp)    [ "$PORT" ] || fail "$0: NETWORK is tcp but PORT is not set"
+       $ACCEPTOR $PORT
+       ;;
+    *)         fail "$0: unknown NETWORK '$NETWORK'" ;;
+
+}
+
 # We need at least one setup file to be given.  It can be passed on
 # the command-line, or it can be found in the home directory, or it
 # can even be sourced into the current shell environment.
@@ -182,19 +197,19 @@ setup_portals() {
 
        [ -c /dev/portals ] || mknod /dev/portals c 10 240
 
-       do_insmod $PORTALS/linux/oslib/portals.o || exit -1
+       if [  "$USEDEV" = "yes ]; then
+           do_insmod $PORTALS/linux/oslib/portals.o || exit -1
 
-       case $NETWORK in
-       elan)   [ "$PORT" ] && fail "$0: NETWORK is elan but PORT is set"
-               do_insmod $PORTALS/linux/qswnal/kqswnal.o || exit -1
-               ;;
-       tcp)    [ "$PORT" ] || fail "$0: NETWORK is tcp but PORT is not set"
-               do_insmod $PORTALS/linux/socknal/ksocknal.o || exit -1
-               $ACCEPTOR $PORT
-               ;;
-       *)      fail "$0: unknown NETWORK '$NETWORK'" ;;
+           case $NETWORK in
+           elan)  do_insmod $PORTALS/linux/qswnal/kqswnal.o || exit -1
+                   ;;
+           tcp)   do_insmod $PORTALS/linux/socknal/ksocknal.o || exit -1
+                  ;;
+           *)  fail "$0: unknown NETWORK '$NETWORK'" ;;
        esac
 
+       start_acceptor
+
        $PTLCTL <<- EOF
        setup $NETWORK
        mynid $LOCALHOST
@@ -212,24 +227,26 @@ setup_portals() {
 setup_lustre() {
        [ -c /dev/obd ] || mknod /dev/obd c 10 241
 
-       do_insmod $LUSTRE/obdclass/obdclass.o || exit -1
-       do_insmod $LUSTRE/ptlrpc/ptlrpc.o || exit -1
-       do_insmod $LUSTRE/ldlm/ldlm.o || exit -1
-       do_insmod $LUSTRE/extN/extN.o || \
+       if [ "$USEDEV" = "yes" ]; then
+           do_insmod $LUSTRE/obdclass/obdclass.o || exit -1
+           do_insmod $LUSTRE/ptlrpc/ptlrpc.o || exit -1
+           do_insmod $LUSTRE/ldlm/ldlm.o || exit -1
+           do_insmod $LUSTRE/extN/extN.o || \
                echo "info: can't load extN.o module, not fatal if using ext3"
-       do_insmod $LUSTRE/mds/mds.o || exit -1
-       #do_insmod $LUSTRE/mds/mds_ext2.o || exit -1
-       #do_insmod $LUSTRE/mds/mds_ext3.o || exit -1
-       do_insmod $LUSTRE/mds/mds_extN.o || \
+           do_insmod $LUSTRE/mds/mds.o || exit -1
+           #do_insmod $LUSTRE/mds/mds_ext2.o || exit -1
+           #do_insmod $LUSTRE/mds/mds_ext3.o || exit -1
+           do_insmod $LUSTRE/mds/mds_extN.o || \
                echo "info: can't load mds_extN.o module, needs extN.o"
-       do_insmod $LUSTRE/obdecho/obdecho.o || exit -1
-       #do_insmod $LUSTRE/obdext2/obdext2.o || exit -1
-       do_insmod $LUSTRE/obdfilter/obdfilter.o || exit -1
-       do_insmod $LUSTRE/ost/ost.o || exit -1
-       do_insmod $LUSTRE/osc/osc.o || exit -1
-       do_insmod $LUSTRE/mdc/mdc.o || exit -1
-       do_insmod $LUSTRE/lov/lov.o || exit -1
-       do_insmod $LUSTRE/llite/llite.o || exit -1
+           do_insmod $LUSTRE/obdecho/obdecho.o || exit -1
+           #do_insmod $LUSTRE/obdext2/obdext2.o || exit -1
+           do_insmod $LUSTRE/obdfilter/obdfilter.o || exit -1
+               do_insmod $LUSTRE/ost/ost.o || exit -1
+           do_insmod $LUSTRE/osc/osc.o || exit -1
+           do_insmod $LUSTRE/mdc/mdc.o || exit -1
+               do_insmod $LUSTRE/lov/lov.o || exit -1
+           do_insmod $LUSTRE/llite/llite.o || exit -1
+       fi 
 
         echo "$R/tmp/lustre-log" > /proc/sys/portals/debug_path
        list_mods