Whamcloud - gitweb
LU-2309 config: ignore unknown configuration param
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 0f0e47d..63c9aaa 100644 (file)
@@ -2231,15 +2231,23 @@ test_41b() {
 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
 
 test_42() { #bug 14693
-        setup
-        check_mount || return 2
-        do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
-        umount_client $MOUNT
-        mount_client $MOUNT || return 1
-        cleanup
-        return 0
+       setup
+       check_mount || error "client was not mounted"
+
+       do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
+       umount_client $MOUNT ||
+               error "unmounting client failed with invalid llite param"
+       mount_client $MOUNT ||
+               error "mounting client failed with invalid llite param"
+
+       do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
+       cleanup || error "stopping $FSNAME failed with invalid sys param"
+       setup
+       check_mount || "client was not mounted with invalid sys param"
+       cleanup || error "stopping $FSNAME failed with invalid sys param"
+       return 0
 }
-run_test 42 "invalid config param should not prevent client from mounting"
+run_test 42 "allow client/server mount/unmount with invalid config param"
 
 test_43() {
        [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
@@ -3386,9 +3394,118 @@ test_64() {
        echo "$LFS df"
        $LFS df --lazy || error "lfs df failed"
        cleanup || return $?
+       #writeconf to remove all ost2 traces for subsequent tests
+       writeconf_or_reformat
 }
 run_test 64 "check lfs df --lazy "
 
+test_65() { # LU-2237
+       # Currently, the test is only valid for ldiskfs backend
+       [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
+               skip "non-ldiskfs backend" && return
+
+       local devname=$(mdsdevname ${SINGLEMDS//mds/})
+       local brpt=$(facet_mntpt brpt)
+       local opts=""
+
+       if ! do_facet $SINGLEMDS "test -b $devname"; then
+               opts="-o loop"
+       fi
+
+       stop_mds
+       local obj=$(do_facet $SINGLEMDS \
+                   "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
+                   grep Inode)
+       if [ -z "$obj" ]; then
+               # The MDT may be just re-formatted, mount the MDT for the
+               # first time to guarantee the "last_rcvd" file is there.
+               start_mds || error "fail to mount the MDS for the first time"
+               stop_mds
+       fi
+
+       # remove the "last_rcvd" file
+       do_facet $SINGLEMDS "mkdir -p $brpt"
+       do_facet $SINGLEMDS \
+               "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
+       do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
+       do_facet $SINGLEMDS "umount $brpt"
+
+       # restart MDS, the "last_rcvd" file should be recreated.
+       start_mds || error "fail to restart the MDS"
+       stop_mds
+       obj=$(do_facet $SINGLEMDS \
+             "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
+       [ -n "$obj" ] || error "fail to re-create the last_rcvd"
+}
+run_test 65 "re-create the lost last_rcvd file when server mount"
+
+test_66() {
+       setup
+       local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
+       local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
+
+       echo "replace_nids should fail if MDS, OSTs and clients are UP"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
+               error "replace_nids fail"
+
+       umount_client $MOUNT || error "unmounting client failed"
+       echo "replace_nids should fail if MDS and OSTs are UP"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
+               error "replace_nids fail"
+
+       stop_ost
+       echo "replace_nids should fail if MDS is UP"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
+               error "replace_nids fail"
+
+       stop_mds || error "stopping mds failed"
+
+       if combined_mgs_mds; then
+               start_mds "-o nosvc" ||
+                       error "starting mds with nosvc option failed"
+       fi
+
+       echo "command should accept two parameters"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
+               error "command should accept two params"
+
+       echo "correct device name should be passed"
+       do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
+               error "wrong devname"
+
+       echo "wrong nids list should not destroy the system"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
+               error "wrong parse"
+
+       echo "replace OST nid"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
+               error "replace nids failed"
+
+       echo "command should accept two parameters"
+       do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
+               error "command should accept two params"
+
+       echo "wrong nids list should not destroy the system"
+       do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
+               error "wrong parse"
+
+       echo "replace MDS nid"
+       do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
+               error "replace nids failed"
+
+       if ! combined_mgs_mds ; then
+               stop_mgs
+       else
+               stop_mds
+       fi
+
+       setup_noconfig
+       check_mount || error "error after nid replace"
+       cleanup
+       reformat
+}
+run_test 66 "replace nids"
+
 test_70a() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local MDTIDX=1