Whamcloud - gitweb
b=17931
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 7c5dd43..9a9b8fa 100644 (file)
@@ -50,19 +50,20 @@ reformat() {
 }
 
 writeconf() {
-    local facet=$SINGLEMDS
-    local dev=${facet}_dev
-    shift
-    stop ${facet} -f
-    rm -f ${facet}active
-    # who knows if/where $TUNEFS is installed?  Better reformat if it fails...
-    do_facet ${facet} "$TUNEFS --writeconf ${!dev}" || echo "tunefs failed, reformatting instead" && reformat
+       local facet=$SINGLEMDS
+       local dev=${facet}_dev
+       shift
+       stop ${facet} -f
+       rm -f ${facet}active
+       # who knows if/where $TUNEFS is installed?  Better reformat if it fails...
+       do_facet ${facet} "$TUNEFS --writeconf ${!dev}" || echo "tunefs failed, reformatting instead" && reformat
+
+       gen_config
 }
 
 gen_config() {
-        reformat
-        # The MGS must be started before the OSTs for a new fs, so start
-        # and stop to generate the startup logs. 
+       # The MGS must be started before the OSTs for a new fs, so start
+       # and stop to generate the startup logs. 
        start_mds
        start_ost
        sleep 5
@@ -70,6 +71,11 @@ gen_config() {
        stop_mds
 }
 
+reformat_and_config() {
+       reformat
+       gen_config
+}
+
 start_mds() {
        local facet=$SINGLEMDS
        # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
@@ -193,7 +199,7 @@ init_gss
 
 #create single point mountpoint
 
-gen_config
+reformat_and_config
 
 test_0() {
         setup
@@ -452,7 +458,7 @@ test_17() {
 
         start_ost
        start_mds && return 42
-       gen_config
+       reformat_and_config
 }
 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
 
@@ -495,7 +501,7 @@ test_18() {
 
         MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
 
-        gen_config
+        reformat_and_config
         echo "mount lustre system..."
        setup
         check_mount || return 41
@@ -511,7 +517,7 @@ test_18() {
         cleanup || return $?
 
         MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
-        gen_config
+        reformat_and_config
 }
 run_test 18 "check mkfs creates large journals"
 
@@ -895,10 +901,6 @@ test_29() {
        cleanup_nocli
        #writeconf to remove all ost2 traces for subsequent tests
        writeconf
-       start_mds
-       start_ost
-       sleep 5
-       cleanup
 }
 run_test 29 "permanently remove an OST"
 
@@ -1113,7 +1115,7 @@ test_33a() { # bug 12333, was test_33
 
         local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
         local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
-        add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
+        add fs2mds $MDS_MKFS_OPTS --mkfsoptions='\"-J size=8\"' --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
         add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
 
         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
@@ -1659,8 +1661,14 @@ test_47() { #17674
 }
 run_test 47 "server restart does not make client loss lru_resize settings"
 
-# reformat after this test must need - if test will failed
-# we will have unkillable file at FS
+cleanup_48() {
+       trap 0
+
+       # reformat after this test is needed - if test will failed
+       # we will have unkillable file at FS
+       reformat_and_config
+}
+
 test_48() { # bug 17636
        reformat
        setup_noconfig
@@ -1671,22 +1679,79 @@ test_48() { # bug 17636
 
        echo "ok" > $MOUNT/widestripe
        $LFS getstripe $MOUNT/widestripe || return 11
+
+       trap cleanup_48 EXIT ERR
+
        # fill acl buffer for avoid expand lsm to them
-       awk -F : '{ print "u:"$1":rwx" }' /etc/passwd | while read acl; do  
-           setfacl -m $acl $MOUNT/widestripe
-       done
-       awk -F : '{ print "g:"$1":rwx" }' /etc/groups | while read acl; do  
+       getent passwd | awk -F : '{ print "u:"$1":rwx" }' |  while read acl; do
            setfacl -m $acl $MOUNT/widestripe
        done
 
-
        stat $MOUNT/widestripe || return 12
-       
-       cleanup || error "can't cleanup"
+
+       cleanup_48
        return 0
 }
 run_test 48 "too many acls on file"
 
+# check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
+test_49() { # bug 17710
+       local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
+       local OLD_OST_MKFS_OPTS=$OST_MKFS_OPTS
+       local LOCAL_TIMEOUT=20
+
+
+       OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$LOCAL_TIMEOUT $MKFSOPT $OSTOPT"
+
+       reformat
+       start_mds
+       start_ost
+       mount_client $MOUNT
+       check_mount || return 1
+
+       echo "check ldlm_timout..."
+       LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
+       LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
+       LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+
+       if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+               error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
+       fi
+
+       if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
+               error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+       fi
+
+       umount_client $MOUNT
+       stop_ost || return 2
+       stop_mds || return 3
+
+       OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$((LOCAL_TIMEOUT - 1)) $MKFSOPT $OSTOPT"
+       
+       reformat
+       start_mds || return 4
+       start_ost || return 5
+       mount_client $MOUNT || return 6
+       check_mount || return 7
+
+       LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
+       LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
+       LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+
+       if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+               error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
+       fi
+       
+       if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
+               error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+       fi
+               
+       cleanup || return $?
+
+       MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
+       OST_MKFS_OPTS=$OLD_OST_MKFS_OPTS
+}
+run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
 
 cleanup_gss
 equals_msg `basename $0`: test complete