Whamcloud - gitweb
b=22671 Check for modules directly instead of keeping state
authorNathan Rutman <nathan.rutman@oracle.com>
Fri, 7 May 2010 19:29:07 +0000 (12:29 -0700)
committerRobert Read <robert.read@oracle.com>
Mon, 10 May 2010 18:13:03 +0000 (11:13 -0700)
i=nico
i=rread

lustre/tests/conf-sanity.sh
lustre/tests/test-framework.sh

index 448aa09..54f27ba 100644 (file)
@@ -26,17 +26,20 @@ RLUSTRE=${RLUSTRE:-$LUSTRE}
 
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
-init_logging
-# STORED_MDSSIZE is used in test_18
-if [ -n "$MDSSIZE" ]; then
-    STORED_MDSSIZE=$MDSSIZE
-fi
+
 # use small MDS + OST size to speed formatting time
 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
 MDSSIZE=200000
 OSTSIZE=200000
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
+# STORED_MDSSIZE is used in test_18
+if [ -n "$MDSSIZE" ]; then
+    STORED_MDSSIZE=$MDSSIZE
+fi
+
+init_logging
+
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
@@ -151,9 +154,9 @@ manual_umount_client(){
 }
 
 setup() {
-       start_ost
-       start_mds
-       mount_client $MOUNT
+       start_ost || error "OST start failed"
+       start_mds || error "MDT start failed"
+       mount_client $MOUNT || error "client start failed"
 }
 
 setup_noconfig() {
@@ -222,7 +225,9 @@ run_test 0 "single mount setup"
 test_1() {
        start_ost
        echo "start ost second time..."
-       setup
+       start_ost && error "2nd OST start should fail"
+       start_mds || error "MDT start failed"
+       mount_client $MOUNT || error "client start failed"
        check_mount || return 42
        cleanup || return $?
 }
@@ -232,7 +237,7 @@ test_2() {
        start_ost
        start_mds
        echo "start mds second time.."
-       start_mds
+       start_mds && error "2nd MDT start should fail"
        mount_client $MOUNT
        check_mount || return 43
        cleanup || return $?
@@ -242,7 +247,7 @@ run_test 2 "start up mds twice (should return err)"
 test_3() {
        setup
        #mount.lustre returns an error if already in mtab
-       mount_client $MOUNT && return $?
+       mount_client $MOUNT && error "2nd client mount should fail"
        check_mount || return 44
        cleanup || return $?
 }
@@ -2303,6 +2308,7 @@ thread_sanity() {
         # Workaround a YALA bug where YALA expects that modules will remain
         # loaded on the servers
         LOAD_MODULES_REMOTE=false
+        load_modules
         setup
         cleanup
 }
index 2b97ab0..82d9c90 100644 (file)
@@ -248,6 +248,8 @@ load_module() {
     shift
     BASE=`basename $module $EXT`
 
+    module_loaded ${BASE} && return
+
     # If no module arguments were passed, get them from $MODOPTS_<MODULE>, else from
     # modprobe.conf
     if [ $# -eq 0 ]; then
@@ -275,8 +277,6 @@ load_module() {
 
     [ $# -gt 0 ] && echo "${module} options: '$*'"
 
-    module_loaded ${BASE} && return
-
     # Note that insmod will ignore anything in modprobe.conf, which is why we're
     # passing options on the command-line.
     if [ "$BASE" == "lnet_selftest" ] && \
@@ -301,12 +301,6 @@ load_modules_local() {
         echo "Using modprobe to load modules"
         return 0
     fi
-    if [ "$HAVE_MODULES" = true ]; then
-        # we already loaded
-        echo "Modules already loaded"
-        return 0
-    fi
-    HAVE_MODULES=true
 
     echo Loading modules from $LUSTRE
     load_module ../libcfs/libcfs/libcfs
@@ -392,8 +386,6 @@ unload_modules() {
         fi
     fi
 
-    HAVE_MODULES=false
-
     check_mem_leak || return 254
 
     echo "modules unloaded."
@@ -3942,6 +3934,9 @@ run_llverdev()
         local dev=$1
         local devname=$(basename $1)
         local size=$(grep "$devname"$ /proc/partitions | awk '{print $3}')
+       # loop devices aren't in /proc/partitions
+       [ "x$size" == "x" ] && local size=$(ls -l $dev | awk '{print $5}')
+
         size=$(($size / 1024 / 1024)) # Gb
 
         local partial_arg=""