return
fi
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+ combined_mgs_mds ||
+ { skip "needs combined MGT and MDT device" && return 0; }
start_mdt 1 -o nosvc -n
if [ $MDSCOUNT -ge 2 ]; then
test_41c() {
local server_version=$(lustre_version_code $SINGLEMDS)
+ local oss_list=$(comma_list $(osts_nodes))
[[ $server_version -ge $(version_code 2.6.52) ]] ||
[[ $server_version -ge $(version_code 2.5.26) &&
cleanup
# MDT concurrent start
+
+ LOAD_MODULES_REMOTE=true load_modules
+ do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
+ error "MDT concurrent start: libcfs module not loaded"
+
#define OBD_FAIL_TGT_MOUNT_RACE 0x716
do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x716"
start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS &
# OST concurrent start
+ do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
+ error "OST concurrent start: libcfs module not loaded"
+
#define OBD_FAIL_TGT_MOUNT_RACE 0x716
do_facet ost1 "$LCTL set_param fail_loc=0x716"
start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &
for i in 1023 2048
do
+ if ! combined_mgs_mds; then
+ stop_mgs || error "stopping MGS service failed"
+ format_mgs || error "formatting MGT failed"
+ fi
add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
$mdsvdev || exit 10
add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
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)
}
test_58() { # bug 22658
+ combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
setup_noconfig
mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
createmany -o $DIR/$tdir/$tfile-%d 100
done
fi
+ combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
setup_noconfig || error "setting up the filesystem failed"
client_up || error "starting client failed"
test_77() { # LU-3445
local server_version=$(lustre_version_code $SINGLEMDS)
-
- [[ $server_version -ge $(version_code 2.2.60) ]] &&
- [[ $server_version -le $(version_code 2.4.0) ]] &&
- skip "Need MDS version < 2.2.60 or > 2.4.0" && return
+ [[ $server_version -ge $(version_code 2.8.55) ]] ||
+ { skip "Need MDS version 2.8.55+ "; return; }
if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
error "start fs2mds failed"
mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
- [[ $mgsnid = *,* ]] || mgsnid+=",$mgsnid"
+ mgsnid="$mgsnid,$mgsnid:$mgsnid"
add fs2ost $(mkfs_opts ost1 $fs2ostdev) --mgsnode=$mgsnid \
--failnode=$failnid --fsname=$fsname \
}
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() {
+ local server_version=$(lustre_version_code $SINGLEMDS)
[ "$(facet_fstype ost1)" = "zfs" ] &&
skip "LU-6442: no such mkfs params for ZFS OSTs" && return
+ [[ $server_version -ge $(version_code 2.7.56) ]] ||
+ { skip "Need server version newer than 2.7.55"; return 0; }
local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
--reformat $(ostdevname 1) $(ostvdevname 1)"
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"
generate_ldev_conf() {
# generate an ldev.conf file
local ldevconfpath=$1
+ local fstype=
+ local fsldevformat=""
touch $ldevconfpath
- printf "%s\t-\t%s-MGS0000\t%s\n" \
+
+ 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 \
- $(mgsdevname) >> $ldevconfpath
+ $fsldevformat \
+ $(mgsdevname) > $ldevconfpath
local mdsfo_host=$mdsfailover_HOST;
if [ -z "$mdsfo_host" ]; then
fi
for num in $(seq $MDSCOUNT); do
- printf "%s\t%s\t%s-MDT%04d\t%s\n" \
+ 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
fi
for num in $(seq $OSTCOUNT); do
- printf "%s\t%s\t%s-OST%04d\t%s\n" \
+ 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() {
# looks like we only have the MGS nid available to us
# so just echo that to a file
local nidspath=$1
- touch $nidspath
- echo -e "${mgs_HOST}\t${MGSNID}" >> $nidspath
+ 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
generate_ldev_conf $LDEVCONFPATH
generate_nids $NIDSPATH
- echo "----- ldev.conf -----"
- cat $LDEVCONFPATH
- echo "--- END ldev.conf ---"
-
- echo "----- /etc/nids -----"
- cat $NIDSPATH
- echo "--- END /etc/nids ---"
-
- # ldev can be in our build tree and if we aren't in a
- # build tree, use 'which' to try and find it
- local LDEV=$LUSTRE/scripts/ldev
- [ ! -f "$LDEV" ] && local LDEV=$(which ldev 2> /dev/null)
-
- echo "ldev path is $LDEV"
-
- if [ ! -f "$LDEV" ]; then
- rm $LDEVCONFPATH $NIDSPATH
- error "failed to find ldev!"
- fi
-
# 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=$(perl $LDEV -c $LDEVCONFPATH -H \
- $ost_HOST -n $NIDSPATH echo %m)
+ output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
echo "-- START OF LDEV OUTPUT --"
echo -e "$output"
}
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"
+
+test_99()
+{
+ [[ $(facet_fstype ost1) != ldiskfs ]] &&
+ { skip "Only applicable to ldiskfs-based OSTs" && return; }
+
+ local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
+ --reformat $(ostdevname 1) $(ostvdevname 1)"
+ do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
+ skip "meta_bg already set" && return
+
+ local opts=ost_opts
+ if [[ ${!opts} != *mkfsoptions* ]]; then
+ eval opts=\"${!opts} \
+ --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
+ else
+ local val=${!opts//--mkfsoptions=\\\"/ \
+ --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
+ eval opts='${val}'
+ fi
+
+ echo "params: $opts"
+
+ add ost1 $opts || error "add ost1 failed with new params"
+
+ do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
+ error "meta_bg is not set"
+
+ return 0
+}
+run_test 99 "Adding meta_bg option"
+
if ! combined_mgs_mds ; then
stop mgs
fi