. $LUSTRE/tests/test-framework.sh
init_test_env $@
-init_logging
+
+# 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
-# use small MDS + OST size to speed formatting time
-MDSSIZE=40000
-OSTSIZE=40000
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+init_logging
+
+#
require_dsh_mds || exit 0
require_dsh_ost || exit 0
+#
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a 45"
assert_DIR
formatall
}
-writeconf() {
- local facet=$SINGLEMDS
- local dev=${facet}_dev
- shift
+writeconf1() {
+ local facet=$1
+ local dev=$2
+
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_and_config
+ do_facet ${facet} "$TUNEFS --writeconf $dev" ||
+ { echo "tunefs failed, reformatting instead" && reformat_and_config && return 1; }
+ return 0
+}
+writeconf() {
+ # if writeconf failed, we reformatted
+ writeconf1 mds $MDSDEV || return 0
+ writeconf1 ost1 `ostdevname 1` || return 0
+ writeconf1 ost2 `ostdevname 2` || return 0
}
gen_config() {
}
setup() {
- start_ost
- start_mds
- mount_client $MOUNT
+ start_mds || error "MDT start failed"
+ start_ost || error "OST start failed"
+ mount_client $MOUNT || error "client start failed"
}
setup_noconfig() {
}
cleanup_nocli() {
- stop_mds || return 201
stop_ost || return 202
+ stop_mds || return 201
unload_modules || return 203
}
run_test 0 "single mount setup"
test_1() {
+ start_mds || error "MDT start failed"
start_ost
echo "start ost second time..."
- setup
+ start_ost && error "2nd OST start should fail"
+ mount_client $MOUNT || error "client start failed"
check_mount || return 42
cleanup || return $?
}
run_test 1 "start up ost twice (should return errors)"
test_2() {
- start_ost
start_mds
echo "start mds second time.."
- start_mds
+ start_mds && error "2nd MDT start should fail"
+ start_ost
mount_client $MOUNT
check_mount || return 43
cleanup || return $?
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 $?
}
run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
test_5c() {
- start_ost
start_mds
+ start_ost
[ -d $MOUNT ] || mkdir -p $MOUNT
grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
local oldfs="${FSNAME}"
run_test 5d "mount with ost down"
test_5e() {
- start_ost
start_mds
+ start_ost
#define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
do_facet client "lctl set_param fail_loc=0x80000506"
fi
stop_ost || return $?
}
-
run_test 9 "test ptldebug and subsystem for mkfs"
-# LOGS/PENDING do not exist anymore since CMD3
-test_16() {
- local TMPMTPT="${TMP}/conf16"
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
- if [ ! -e "$MDSDEV" ]; then
- log "no $MDSDEV existing, so mount Lustre to create one"
- setup
- check_mount || return 41
- cleanup || return $?
- fi
-
- [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
-
- log "change the mode of $MDSDEV/OBJECTS to 555"
- do_facet $SINGLEMDS "mkdir -p $TMPMTPT &&
- mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
- chmod 555 $TMPMTPT/OBJECTS &&
- umount $TMPMTPT" || return $?
-
- log "mount Lustre to change the mode of OBJECTS, then umount Lustre"
- setup
- check_mount || return 41
- cleanup || return $?
-
- log "read the mode of OBJECTS and check if they has been changed properly"
- EXPECTEDOBJECTSMODE=`do_facet $SINGLEMDS "$DEBUGFS -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
-
- if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
- log "Success:Lustre change the mode of OBJECTS correctly"
- else
- error "Lustre does not change mode of OBJECTS properly"
- fi
-}
-run_test 16 "verify that lustre will correct the mode of OBJECTS"
+#
+# Test 16 was to "verify that lustre will correct the mode of OBJECTS".
+# But with new MDS stack we don't care about the mode of local objects
+# anymore, so this test is removed. See bug 22944 for more details.
+#
test_17() {
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
if [ ! -e "$MDSDEV" ]; then
echo "no $MDSDEV existing, so mount Lustre to create one"
test_18() {
[ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
local MIN=2000000
test_20() {
# first format the ost/mdt
- start_ost
start_mds
+ start_ost
mount_client $MOUNT
check_mount || return 43
rm -f $DIR/$tfile
run_test 22 "start a client before osts (should return errs)"
test_23a() { # was test_23
- setup
- # fail mds
+ setup
+ # fail mds
stop $SINGLEMDS
# force down client so that recovering mds waits for reconnect
local running=$(grep -c $MOUNT /proc/mounts) || true
cleanup_nocli
test_23b() { # was test_23
- start_ost
start_mds
+ start_ost
# Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
lctl set_param fail_loc=0x80000313
mount_client $MOUNT
test_24a() {
#set up fs1
gen_config
+
#set up fs2
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+
[ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
run_test 24a "Multiple MDTs on a single node"
test_24b() {
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+
if [ -z "$fs2mds_DEV" ]; then
do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
skip_env "mixed loopback and real device not working" && return
}
run_test 29 "permanently remove an OST"
-test_30() {
+test_30a() {
setup
+ echo Big config llog
TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
ORIG=$($TEST)
LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
# make sure client restart still works
umount_client $MOUNT
mount_client $MOUNT || return 4
- [ "$($TEST)" -ne "$i" ] && return 5
- set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
+ [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
+ pass
+
+ echo Erase parameter setting
+ do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
+ umount_client $MOUNT
+ mount_client $MOUNT || return 6
+ FINAL=$($TEST)
+ echo "deleted (default) value=$FINAL, orig=$ORIG"
+ # assumes this parameter started at the default value
+ [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
+
cleanup
}
-run_test 30 "Big config llog"
+run_test 30a "Big config llog and conf_param deletion"
+
+test_30b() {
+ setup
+
+ # Make a fake nid. Use the OST nid, and add 20 to the least significant
+ # numerical part of it. Hopefully that's not already a failover address for
+ # the server.
+ OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
+ ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
+ NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
+ NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
+ echo "Using fake nid $NEW"
+
+ TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
+ set_and_check client "$TEST" "$FSNAME-OST0000.failover.node" $NEW || error "didn't add failover nid $NEW"
+ NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+ echo $NIDS
+ NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
+ echo "should have 2 failover nids: $NIDCOUNT"
+ [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
+ do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
+ umount_client $MOUNT
+ mount_client $MOUNT || return 3
+
+ NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+ echo $NIDS
+ NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
+ echo "only 1 final nid should remain: $NIDCOUNT"
+ [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
+
+ cleanup
+}
+run_test 30b "Remove failover nids"
test_31() { # bug 10734
# ipaddr must not exist
test_33a() { # bug 12333, was test_33
local rc=0
local FSNAME2=test-123
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+
[ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
}" $TMP/lustre-log-$TESTNAME.log`
[ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
cleanup
+ # remove nid settings
+ writeconf
}
run_test 35a "Reconnect to the last active server first"
return 5
cleanup
+ # remove nid settings
+ writeconf
}
run_test 35b "Continue reconnection retries, if the active server is busy"
local rc
local FSNAME2=test1234
local fs3ost_HOST=$ost_HOST
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
[ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
rc=0
log "rename lov_objid file on MDS"
rm -f $TMP/lov_objid.orig
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
test_41() { #bug 14134
local rc
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
start ost1 `ostdevname 1` $OST_MOUNT_OPTS
let count=count-1
done
stop_mds || rc=$?
- # writeconf is needed after the test, otherwise,
- # we might end up with extra OSTs
- writeconf || rc=$?
cleanup_nocli || rc=$?
+ #writeconf to remove all ost2 traces for subsequent tests
+ writeconf
return $rc
}
umount_client $MOUNT || error "Unable to unmount client"
stop_ost || error "Unable to stop OST1"
stop_mds || error "Unable to stop MDS"
+ #writeconf to remove all ost2 traces for subsequent tests
writeconf
}
run_test 50f "normal statfs one server in down =========================="
stop_ost2 || error "Unable to stop OST2"
stop_ost || error "Unable to stop OST1"
stop_mds || error "Unable to stop MDS"
+ #writeconf to remove all ost2 traces for subsequent tests
writeconf
}
run_test 50g "deactivated OST should not cause panic====================="
# Workaround a YALA bug where YALA expects that modules will remain
# loaded on the servers
LOAD_MODULES_REMOTE=false
+ load_modules
setup
cleanup
}
}
run_test 54b "llverfs"
+lov_objid_size()
+{
+ local max_ost_index=$1
+ echo -n $(((max_ost_index + 1) * 8))
+}
+
+test_55() {
+ local mdsdev=$(mdsdevname 1)
+ local ostdev=$(ostdevname 1)
+ local saved_opts=$OST_MKFS_OPTS
+
+ for i in 0 1023 2048
+ do
+ OST_MKFS_OPTS="$saved_opts --index $i"
+ reformat
+
+ setup_noconfig
+ stopall
+
+ setup
+ sync
+ echo checking size of lov_objid for ost index $i
+ LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
+ if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
+ error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
+ else
+ echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
+ fi
+ stopall
+ done
+
+ OST_MKFS_OPTS=$saved_opts
+ reformat
+}
+run_test 55 "check lov_objid size"
+
+test_56() {
+ add mds1 $MDS_MKFS_OPTS --mkfsoptions='\"-J size=16\"' --reformat $(mdsdevname 1)
+ add ost1 $OST_MKFS_OPTS --index=1000 --reformat $(ostdevname 1)
+ add ost2 $OST_MKFS_OPTS --index=10000 --reformat $(ostdevname 2)
+
+ start_mds
+ start_ost
+ start_ost2 || error "Unable to start second ost"
+ mount_client $MOUNT || error "Unable to mount client"
+ echo ok
+ $LFS osts
+ stopall
+ reformat
+}
+run_test 56 "check big indexes"
+
cleanup_gss
equals_msg `basename $0`: test complete
[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true