ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+if [ "$FAILURE_MODE" = "HARD" ]; then
+ CONFIG_EXCEPTIONS="24a " && \
+ echo "Except the tests: $CONFIG_EXCEPTIONS for FAILURE_MODE=$FAILURE_MODE, bug 23573" && \
+ ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
+fi
+
SRCDIR=`dirname $0`
PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
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 --quiet --writeconf $dev" ||
+ { echo "tunefs failed, reformatting instead" && reformat_and_config && return 1; }
+ return 0
+}
+writeconf() {
+ # we need ldiskfs
+ load_modules
+ # if writeconf fails anywhere, we reformat everything
+ writeconf1 mds `mdsdevname 1` || return 0
+ writeconf1 ost1 `ostdevname 1` || return 0
+ writeconf1 ost2 `ostdevname 2` || return 0
}
gen_config() {
start_mgs () {
echo "start mgs"
- start mgs $MGSDEV $mgs_MOUNT_OPTS
+ start mgs $MGSDEV $MGS_MOUNT_OPTS
}
start_mds() {
local num=$(echo $facet | tr -d "mds")
local dev=$(mdsdevname $num)
echo "start mds service on `facet_active_host $facet`"
- start $facet ${dev} $MDS_MOUNT_OPTS || return 94
+ start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
+}
+
+start_mgsmds() {
+ if ! combined_mgs_mds ; then
+ start_mgs
+ fi
+ start_mds $@
}
stop_mds() {
start_ost() {
echo "start ost1 service on `facet_active_host ost1`"
- start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
+ start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
}
stop_ost() {
start_ost2() {
echo "start ost2 service on `facet_active_host ost2`"
- start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
+ start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
}
stop_ost2() {
}
cleanup_nocli() {
- stop_mds || return 201
stop_ost || return 202
+ stop_mds || return 201
unload_modules || return 203
}
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_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
fi
# check MDT too
- local MPROC="osc.$FSNAME-OST0001-osc-[M]*.active"
+ local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0001)
+ mdtosc=${mdtosc/-MDT*/-MDT\*}
+ local MPROC="osc.$mdtosc.active"
local MAX=30
local WAIT=0
while [ 1 ]; do
test_30b() {
setup
- NEW="1.2.3.4@tcp"
- TEST="lctl get_param -n osc.$FSNAME-OST0000-osc-????????*/import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
+ # 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-????????*/import | grep failover_nids)
- NIDCOUNT=$(echo "$NIDS" | wc -w)
- echo "only 1 final nid should remain: $NIDS"
- [ $NIDCOUNT -eq 2 ] || fail "Failover nids not removed"
- pass
+ 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
}
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 =========================="
[ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
setup
start_ost2 || error "Unable to start OST2"
+ wait_osc_import_state mds ost2 FULL
+ wait_osc_import_state client ost2 FULL
local PARAM="${FSNAME}-OST0001.osc.active"
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====================="
[ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
touch $TMP/modified_first
[ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
- do_node $ost1node "mkdir -p $ost1tmp && touch $ost1tmp/modified_first"
+ local mtime=$(stat -c %Y $TMP/modified_first)
+ do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
+
[ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
sleep 1
}
run_test 53b "check MDT thread count params"
-if ! combined_mgs_mds ; then
- stop mgs
-fi
-
run_llverfs()
{
local dir=$1
}
run_test 56 "check big indexes"
+test_57() { # bug 22656
+ local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
+ writeconf
+ do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
+ start_mgsmds
+ start_ost && error "OST registration from failnode should fail"
+ stop_mds
+ reformat
+}
+run_test 57 "initial registration from failnode should fail (should return errs)"
+
+count_osts() {
+ do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
+}
+
+test_59() {
+ start_mgsmds >> /dev/null
+ local C1=$(count_osts)
+ if [ $C1 -eq 0 ]; then
+ start_ost >> /dev/null
+ C1=$(count_osts)
+ fi
+ stopall
+ echo "original ost count: $C1 (expect > 0)"
+ [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
+ start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
+ local C2=$(count_osts)
+ echo "after mdt writeconf count: $C2 (expect 0)"
+ [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
+ echo "OST start without writeconf should fail:"
+ start_ost >> /dev/null && error "OST start without writeconf didn't fail"
+ echo "OST start with writeconf should succeed:"
+ start_ost -o writeconf >> /dev/null || error "OST1 start failed"
+ local C3=$(count_osts)
+ echo "after ost writeconf count: $C3 (expect 1)"
+ [ $C3 -eq 1 ] || error "new OST writeconf should add:"
+ start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
+ local C4=$(count_osts)
+ echo "after ost2 writeconf count: $C4 (expect 2)"
+ [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
+ stop_ost2 >> /dev/null
+ cleanup_nocli >> /dev/null
+}
+run_test 59 "writeconf mount option"
+
+
+if ! combined_mgs_mds ; then
+ stop mgs
+fi
cleanup_gss
equals_msg `basename $0`: test complete
[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true