Have lmv return -EAGAIN instead of -ENODATA for unconfigured MDTs.
That avoids "lfs df -v" from printing a long list of invalid MDTs
when trying to get the target state for non-rotational devices.
Add test for "lfs df -v" printing nonrotational state, as well as
limiting the reported OST and MDT to configured devices.
Fixes:
4c76eb64a9ff ("LU-8920 utils: don't print deactivated OSTs in 'lfs df')
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ia3dcf85f4cf52caa39848f0f6ed8d47d42ce7057
Reviewed-on: https://review.whamcloud.com/38165
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
RETURN(-ENODEV);
tgt = lmv_tgt(lmv, index);
RETURN(-ENODEV);
tgt = lmv_tgt(lmv, index);
- if (!tgt || !tgt->ltd_active)
+ if (!tgt)
+ RETURN(-EAGAIN);
+
+ if (!tgt->ltd_active)
RETURN(-ENODATA);
mdc_obd = class_exp2obd(tgt->ltd_exp);
RETURN(-ENODATA);
mdc_obd = class_exp2obd(tgt->ltd_exp);
local ost_idx=0
local ost_name=$(ostname_from_index $ost_idx)
local old_status=$(ost_dev_status $ost_idx)
local ost_idx=0
local ost_name=$(ostname_from_index $ost_idx)
local old_status=$(ost_dev_status $ost_idx)
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
[[ -z "$old_status" ]] ||
skip_env "OST $ost_name is in $old_status status"
do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
[[ -z "$old_status" ]] ||
skip_env "OST $ost_name is in $old_status status"
do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
- [[ $OST1_VERSION -ge $(version_code 2.12.55) ]] && do_facet ost1 \
+ [[ $OST1_VERSION -lt $(version_code 2.12.55) ]] || do_facet ost1 \
$LCTL set_param -n obdfilter.$ost_name.no_precreate=1
$LCTL set_param -n obdfilter.$ost_name.no_precreate=1
+ if [[ $OST1_VERSION -ge $(version_code 2.12.57) ]]; then
+ save_lustre_params ost1 osd-*.$ost_name.nonrotational > $p
+ do_facet ost1 $LCTL set_param -n osd-*.$ost_name.nonrotational=1
+ fi
+
+ [[ $($LFS df -v $MOUNT |& grep -c "inactive device") -eq 0 ]] ||
+ error "$LFS df -v showing inactive devices"
- local new_status=$(ost_dev_status $ost_idx)
+ local new_status=$(ost_dev_status $ost_idx $MOUNT -v)
[[ "$new_status" =~ "D" ]] ||
error "$ost_name status is '$new_status', missing 'D'"
[[ "$new_status" =~ "D" ]] ||
error "$ost_name status is '$new_status', missing 'D'"
[[ "$new_status" =~ "N" ]] ||
error "$ost_name status is '$new_status', missing 'N'"
fi
[[ "$new_status" =~ "N" ]] ||
error "$ost_name status is '$new_status', missing 'N'"
fi
+ if [[ $OST1_VERSION -ge $(version_code 2.12.57) ]]; then
+ [[ "$new_status" =~ "f" ]] ||
+ error "$ost_name status is '$new_status', missing 'f'"
+ fi
do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=0
do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=0
- [[ $OST1_VERSION -ge $(version_code 2.12.55) ]] && do_facet ost1 \
+ [[ $OST1_VERSION -lt $(version_code 2.12.55) ]] || do_facet ost1 \
$LCTL set_param -n obdfilter.$ost_name.no_precreate=0
$LCTL set_param -n obdfilter.$ost_name.no_precreate=0
+ [[ -z "$p" ]] && restore_lustre_params < $p || true
sleep_maxage
new_status=$(ost_dev_status $ost_idx)
[[ ! "$new_status" =~ "D" && ! "$new_status" =~ "N" ]] ||
error "$ost_name status is '$new_status', has 'D' and/or 'N'"
sleep_maxage
new_status=$(ost_dev_status $ost_idx)
[[ ! "$new_status" =~ "D" && ! "$new_status" =~ "N" ]] ||
error "$ost_name status is '$new_status', has 'D' and/or 'N'"
+ # can't check 'f' as devices may actually be on flash
}
run_test 56c "check 'lfs df' showing device status"
}
run_test 56c "check 'lfs df' showing device status"
+test_56d() {
+ local mdts=$($LFS df -v $MOUNT | grep -c MDT)
+ local osts=$($LFS df -v $MOUNT | grep -c OST)
+
+ $LFS df $MOUNT
+
+ (( mdts == MDSCOUNT )) ||
+ error "lfs df -v showed $mdts MDTs, not $MDSCOUNT"
+ (( osts == OSTCOUNT )) ||
+ error "lfs df -v showed $osts OSTs, not $OSTCOUNT"
+}
+run_test 56d "'lfs df -v' prints only configured devices"
+
NUMFILES=3
NUMDIRS=3
setup_56() {
NUMFILES=3
NUMDIRS=3
setup_56() {
ost_dev_status() {
local ost_idx=$1
local mnt_pnt=${2:-$MOUNT}
ost_dev_status() {
local ost_idx=$1
local mnt_pnt=${2:-$MOUNT}
local ost_uuid
ost_uuid=$(ostuuid_from_index $ost_idx $mnt_pnt)
local ost_uuid
ost_uuid=$(ostuuid_from_index $ost_idx $mnt_pnt)
- lfs_df $mnt_pnt | awk '/'$ost_uuid'/ { print $7 }'
+ lfs_df $opts $mnt_pnt | awk '/'$ost_uuid'/ { print $7 }'