Whamcloud - gitweb
LU-8055 ldev: Introduced role filtering
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index c5d4ee3..6702d6c 100755 (executable)
@@ -4069,7 +4069,7 @@ test_56() {
        MDSJOURNALSIZE=16
 
        for num in $(seq 1 $MDSCOUNT); do
-               reformat_mdt $num
+               format_mdt $num
        done
        add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
                $(ostdevname 1) $(ostvdevname 1)
@@ -5839,6 +5839,15 @@ test_85() {
 }
 run_test 85 "osd_ost init: fail ea_fid_set"
 
+cleanup_86() {
+       trap 0
+
+       # ost1 has already registered to the MGS before the reformat.
+       # So after reformatting it with option "-G", it could not be
+       # mounted to the MGS. Cleanup the system for subsequent tests.
+       reformat_and_config
+}
+
 test_86() {
        [ "$(facet_fstype ost1)" = "zfs" ] &&
                skip "LU-6442: no such mkfs params for ZFS OSTs" && return
@@ -5862,6 +5871,9 @@ test_86() {
 
        echo "params: $opts"
 
+       trap cleanup_86 EXIT ERR
+
+       stopall
        add ost1 $opts || error "add ost1 failed with new params"
 
        local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
@@ -5869,7 +5881,8 @@ test_86() {
 
        [[ $FOUNDSIZE == $NEWSIZE ]] ||
                error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
-       return 0
+
+       cleanup_86
 }
 run_test 86 "Replacing mkfs.lustre -G option"
 
@@ -6692,6 +6705,80 @@ test_96() {
 }
 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
 
+test_97() {
+       if [ -z "$LDEV" ]; then
+               error "ldev is missing!"
+       fi
+
+       local LDEVCONFPATH=$TMP/ldev.conf
+       local NIDSPATH=$TMP/nids
+
+       generate_ldev_conf $LDEVCONFPATH
+       generate_nids $NIDSPATH
+
+       local LDEV_OUTPUT=$TMP/ldev-output.txt
+       local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
+
+       echo -e "\nMDT role"
+       $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
+               error "ldev failed to execute for mdt role!"
+       fi
+
+       for num in $(seq $MDSCOUNT); do
+               printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
+       done
+
+       compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+               error "ldev failed to produce the correct output for mdt role!"
+       fi
+
+       echo -e "\nOST role"
+       $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
+               error "ldev failed to execute for ost role!"
+       fi
+
+       rm $EXPECTED_OUTPUT
+       for num in $(seq $OSTCOUNT); do
+               printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
+       done
+
+       compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+               error "ldev failed to produce the correct output for ost role!"
+       fi
+
+       echo -e "\nMGS role"
+       $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
+               error "ldev failed to execute for mgs role!"
+       fi
+
+       printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
+
+       compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
+
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+               error "ldev failed to produce the correct output for mgs role!"
+       fi
+
+       rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+}
+run_test 97 "ldev returns correct ouput when querying based on role"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi