#
require_dsh_mds || exit 0
require_dsh_ost || exit 0
-#
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45 69"
+
+# 8 22 (min)"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
assert_DIR
[ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
ID1=${ID1:-501}
- USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1)
+ USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
[ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
return
df -h $MOUNT &
log "sleep 60 sec"
sleep 60
- #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
- do_facet client "$LCTL set_param fail_loc=0x50f"
+#define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
+ do_facet client "$LCTL set_param fail_loc=0x50f fail_val=0"
log "sleep 10 sec"
sleep 10
manual_umount_client --force || error "manual_umount_client failed"
echo
# backup files
- echo backup files to $TMP/files
+ echo backup files to $TMP/$tdir
local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
- copy_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+ copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
error "Unable to copy files"
umount_client $MOUNT || error "Unable to umount client"
error "Some entry under /lost+found should be repaired"
# compare files
- diff_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+ diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
error "Unable to diff files"
- rm -rf $TMP/files $TMP/file_xattrs ||
+ rm -rf $TMP/$tdir $TMP/file_xattrs ||
error "Unable to delete temporary files"
do_node $ost1node "rm -rf $ost1tmp" ||
error "Unable to delete temporary files"
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)
}
run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
+test_70e() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+ [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] ||
+ { skip "Need MDS version at least 2.7.62"; return 0; }
+
+ cleanup || error "cleanup failed with $?"
+
+ local mdsdev=$(mdsdevname 1)
+ local ostdev=$(ostdevname 1)
+ local mdsvdev=$(mdsvdevname 1)
+ local ostvdev=$(ostvdevname 1)
+ local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
+ local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
+
+ add mds1 $opts_mds || error "add mds1 failed"
+ start_mdt 1 || error "start mdt1 failed"
+ add ost1 $opts_ost || error "add ost1 failed"
+ start_ost || error "start ost failed"
+ mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
+
+ local soc=$(do_facet mds1 "$LCTL get_param -n \
+ mdt.*MDT0000.sync_lock_cancel")
+ [ $soc == "never" ] || error "SoC enabled on single MDS"
+
+ for i in $(seq 2 $MDSCOUNT); do
+ mdsdev=$(mdsdevname $i)
+ mdsvdev=$(mdsvdevname $i)
+ opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
+ $mdsvdev"
+ add mds$i $opts_mds || error "add mds$i failed"
+ start_mdt $i || error "start mdt$i fail"
+ done
+
+ wait_dne_interconnect
+
+ for i in $(seq $MDSCOUNT); do
+ soc=$(do_facet mds$i "$LCTL get_param -n \
+ mdt.*MDT000$((i - 1)).sync_lock_cancel")
+ [ $soc == "blocking" ] || error "SoC not enabled on DNE"
+ done
+
+ for i in $(seq 2 $MDSCOUNT); do
+ stop_mdt $i || error "stop mdt$i fail"
+ done
+ soc=$(do_facet mds1 "$LCTL get_param -n \
+ mdt.*MDT0000.sync_lock_cancel")
+ [ $soc == "never" ] || error "SoC enabled on single MDS"
+
+ cleanup || error "cleanup failed with $?"
+}
+run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
+
test_71a() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
if combined_mgs_mds; then
}
run_test 76b "verify params log setup correctly"
+test_76c() {
+ [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
+ { skip "Need MDS version at least 2.4.52" && return 0; }
+ setupall
+ local MASK_PARAM="mdd.*.changelog_mask"
+ echo "Change changelog_mask"
+ do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
+ error "Can't change changlog_mask"
+ wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
+ grep 'CLOSE'" ""
+
+ echo "Check the value is stored after mds remount"
+ stop_mds || error "Failed to stop MDS"
+ start_mds || error "Failed to start MDS"
+ local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
+ echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
+ error "changelog_mask is not changed"
+
+ stopall
+}
+run_test 76c "verify changelog_mask is applied with set_param -P"
+
test_77() { # LU-3445
local server_version=$(lustre_version_code $SINGLEMDS)
skip "only applicable to ldiskfs-based MDTs and OSTs" && return
# reformat the Lustre filesystem with a smaller size
+ local saved_MDSCOUNT=$MDSCOUNT
local saved_MDSSIZE=$MDSSIZE
+ local saved_OSTCOUNT=$OSTCOUNT
local saved_OSTSIZE=$OSTSIZE
+ MDSCOUNT=1
+ OSTCOUNT=1
MDSSIZE=$((MDSSIZE - 20000))
OSTSIZE=$((OSTSIZE - 20000))
reformat || error "(1) reformat Lustre filesystem failed"
local i
local file
local num_files=100
+
mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
+ $LFS df; $LFS df -i
for i in $(seq $num_files); do
file=$MOUNT/$tdir/$tfile-$i
- dd if=/dev/urandom of=$file count=1 bs=1M ||
+ dd if=/dev/urandom of=$file count=1 bs=1M || {
+ $LCTL get_param osc.*.cur*grant*
+ $LFS df; $LFS df -i;
+ # stop creating files if there is no more space
+ if [ ! -e $file ]; then
+ num_files=$((i - 1))
+ break
+ fi
+
+ $LFS getstripe -v $file
+ local ost_idx=$(LFS getstripe -i $file)
+ do_facet ost$((ost_idx + 1)) \
+ $LCTL get_param obdfilter.*.*grant*
error "(4) create $file failed"
+ }
done
# unmount the Lustre filesystem
# unmount and reformat the Lustre filesystem
cleanup || error "(12) cleanup Lustre filesystem failed"
combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
+
+ MDSCOUNT=$saved_MDSCOUNT
+ OSTCOUNT=$saved_OSTCOUNT
reformat || error "(14) reformat Lustre filesystem failed"
}
run_test 78 "run resize2fs on MDT and OST filesystems"
run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
Busy inodes after unmount ..."
-recovery_time_min() {
- local CONNECTION_SWITCH_MIN=5
- local CONNECTION_SWITCH_INC=5
- local CONNECTION_SWITCH_MAX
- local RECONNECT_DELAY_MAX
- local INITIAL_CONNECT_TIMEOUT
- local max
- local TO_20
-
- #CONNECTION_SWITCH_MAX=min(50, max($CONNECTION_SWITCH_MIN,$TIMEOUT)
- (($CONNECTION_SWITCH_MIN>$TIMEOUT)) && \
- max=$CONNECTION_SWITCH_MIN || max=$TIMEOUT
- (($max<50)) && CONNECTION_SWITCH_MAX=$max || CONNECTION_SWITCH_MAX=50
-
- #INITIAL_CONNECT_TIMEOUT = max(CONNECTION_SWITCH_MIN, \
- #obd_timeout/20)
- TO_20=$(($TIMEOUT/20))
- (($CONNECTION_SWITCH_MIN>$TO_20)) && \
- INITIAL_CONNECT_TIMEOUT=$CONNECTION_SWITCH_MIN || \
- INITIAL_CONNECT_TIMEOUT=$TO_20
-
- RECONNECT_DELAY_MAX=$(($CONNECTION_SWITCH_MAX+$CONNECTION_SWITCH_INC+ \
- $INITIAL_CONNECT_TIMEOUT))
- echo $((2*$RECONNECT_DELAY_MAX))
-}
-
test_84() {
local facet=$SINGLEMDS
local num=$(echo $facet | tr -d "mds")
}
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
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)" |
[[ $FOUNDSIZE == $NEWSIZE ]] ||
error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
- return 0
+
+ cleanup_86
}
run_test 86 "Replacing mkfs.lustre -G option"
}
run_test 91 "evict-by-nid support"
+generate_ldev_conf() {
+ # generate an ldev.conf file
+ local ldevconfpath=$1
+ local fstype=
+ local fsldevformat=""
+ touch $ldevconfpath
+
+ fstype=$(facet_fstype mgs)
+ if [ "$fstype" == "zfs" ]; then
+ fsldevformat="$fstype:"
+ else
+ fsldevformat=""
+ fi
+
+ printf "%s\t-\t%s-MGS0000\t%s%s\n" \
+ $mgs_HOST \
+ $FSNAME \
+ $fsldevformat \
+ $(mgsdevname) > $ldevconfpath
+
+ local mdsfo_host=$mdsfailover_HOST;
+ if [ -z "$mdsfo_host" ]; then
+ mdsfo_host="-"
+ fi
+
+ for num in $(seq $MDSCOUNT); do
+ fstype=$(facet_fstype mds$num)
+ if [ "$fstype" == "zfs" ]; then
+ fsldevformat="$fstype:"
+ else
+ fsldevformat=""
+ fi
+
+ printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
+ $mds_HOST \
+ $mdsfo_host \
+ $FSNAME \
+ $num \
+ $fsldevformat \
+ $(mdsdevname $num) >> $ldevconfpath
+ done
+
+ local ostfo_host=$ostfailover_HOST;
+ if [ -z "$ostfo_host" ]; then
+ ostfo_host="-"
+ fi
+
+ for num in $(seq $OSTCOUNT); do
+ fstype=$(facet_fstype ost$num)
+ if [ "$fstype" == "zfs" ]; then
+ fsldevformat="$fstype:"
+ else
+ fsldevformat=""
+ fi
+
+ printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
+ $ost_HOST \
+ $ostfo_host \
+ $FSNAME \
+ $num \
+ $fsldevformat \
+ $(ostdevname $num) >> $ldevconfpath
+ done
+
+ echo "----- $ldevconfpath -----"
+ cat $ldevconfpath
+ echo "--- END $ldevconfpath ---"
+
+}
+
+generate_nids() {
+ # generate a nids file (mapping between hostname to nid)
+ # looks like we only have the MGS nid available to us
+ # so just echo that to a file
+ local nidspath=$1
+ echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
+
+ echo "----- $nidspath -----"
+ cat $nidspath
+ echo "--- END $nidspath ---"
+}
+
+compare_ldev_output() {
+ ldev_output=$1
+ expected_output=$2
+
+ sort $expected_output -o $expected_output
+ sort $ldev_output -o $ldev_output
+
+ echo "-- START OF LDEV OUTPUT --"
+ cat $ldev_output
+ echo "--- END OF LDEV OUTPUT ---"
+
+ echo "-- START OF EXPECTED OUTPUT --"
+ cat $expected_output
+ echo "--- END OF EXPECTED OUTPUT ---"
+
+ diff $expected_output $ldev_output
+ return $?
+}
+
+test_92() {
+ if [ -z "$LDEV" ]; then
+ error "ldev is missing!"
+ fi
+
+ local LDEVCONFPATH=$TMP/ldev.conf
+ local NIDSPATH=$TMP/nids
+
+ echo "Host is $(hostname)"
+
+ generate_ldev_conf $LDEVCONFPATH
+ generate_nids $NIDSPATH
+
+ # echo the mgs nid and compare it to environment variable MGSNID
+ # also, ldev.conf and nids is a server side thing, use the OSS
+ # hostname
+ local output
+ output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
+
+ echo "-- START OF LDEV OUTPUT --"
+ echo -e "$output"
+ echo "--- END OF LDEV OUTPUT ---"
+
+ # ldev failed, error
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev failed to execute!"
+ fi
+
+ # need to process multiple lines because of combined MGS and MDS
+ echo -e $output | awk '{ print $2 }' | while read -r line ; do
+ if [ "$line" != "$MGSNID" ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev failed mgs nid '$line', expected '$MGSNID'"
+ fi
+ done
+
+ rm $LDEVCONFPATH $NIDSPATH
+}
+run_test 92 "ldev returns MGS NID correctly in command substitution"
+
+test_93() {
+ [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
+
+ reformat
+ #start mgs or mgs/mdt0
+ if ! combined_mgs_mds ; then
+ start_mgs
+ start_mdt 1
+ else
+ start_mdt 1
+ fi
+
+ start_ost || error "OST0 start fail"
+
+ #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
+ do_facet mgs "$LCTL set_param fail_val = 10 fail_loc=0x8000090e"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num &
+ done
+
+ mount_client $MOUNT || error "mount client fails"
+ wait_osc_import_state mds ost FULL
+ wait_osc_import_state client ost FULL
+ check_mount || error "check_mount failed"
+
+ cleanup || error "cleanup failed with $?"
+}
+run_test 93 "register mulitple MDT at the same time"
+
+test_94() {
+ 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
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
+
+ # ldev failed, error
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
+ error "ldev failed to execute!"
+ fi
+
+ # expected output
+ local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
+
+ printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
+
+ for num in $(seq $MDSCOUNT); do
+ printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
+ done
+
+ 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 hostlist!"
+ fi
+
+ rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+}
+run_test 94 "ldev outputs correct labels for file system name query"
+
+test_95() {
+ 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
+
+ # SUCCESS CASES
+ # file sys filter
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -F failed!"
+ fi
+
+ # local filter
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -l failed!"
+ fi
+
+ # foreign filter
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -f failed!"
+ fi
+
+ # all filter
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -a failed!"
+ fi
+
+ # FAILURE CASES
+ # all & file sys
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -a and -F incorrectly succeeded"
+ fi
+
+ # all & foreign
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -a and -f incorrectly succeeded"
+ fi
+
+ # all & local
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -a and -l incorrectly succeeded"
+ fi
+
+ # foreign & local
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -f and -l incorrectly succeeded"
+ fi
+
+ # file sys & local
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -F and -l incorrectly succeeded"
+ fi
+
+ # file sys & foreign
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
+ if [ $? -eq 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH
+ error "ldev label filtering w/ -F and -f incorrectly succeeded"
+ fi
+
+ rm $LDEVCONFPATH $NIDSPATH
+}
+run_test 95 "ldev should only allow one label filter"
+
+test_96() {
+ 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
+ $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
+ echo %H-%b | \
+ awk '{print $2}' > $LDEV_OUTPUT
+
+ # ldev failed, error
+ if [ $? -ne 0 ]; then
+ rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
+ error "ldev failed to execute!"
+ fi
+
+ # expected output
+ local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
+
+ echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
+
+ if [ "$mgs_HOST" == "$mds_HOST" ]; then
+ for num in $(seq $MDSCOUNT); do
+ echo "$mds_HOST-$(facet_fstype mds$num)" \
+ >> $EXPECTED_OUTPUT
+ done
+ fi
+
+ if [ "$mgs_HOST" == "$ost_HOST" ]; then
+ for num in $(seq $OSTCOUNT); do
+ echo "$ost_HOST-$(facet_fstype ost$num)" \
+ >> $EXPECTED_OUTPUT
+ done
+ fi
+
+ 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!"
+ fi
+
+ rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
+}
+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