Skip to content

Commit

Permalink
LU-2416 test: Some test using wrong lctl params
Browse files Browse the repository at this point in the history
With the move of obdfilter to ofd some of the lctl
parameters got moved around. For the test suite a function
{get,set}_obdfilter_param was written to handle this change so
this patch updates a few more test to use this api.

Signed-off-by: James Simmons <[email protected]>
Change-Id: I05ca4711b198061de1378b79d2f7f35d5a1c75af
Reviewed-on: http://review.whamcloud.com/4726
Reviewed-by: Li Wei <[email protected]>
Reviewed-by: Jian Yu <[email protected]>
Tested-by: Hudson
Tested-by: Maloo <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
  • Loading branch information
jasimmons1973 authored and Oleg Drokin committed Jan 26, 2013
1 parent cdd0743 commit dce5dfc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lustre/tests/lfsck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ get_ost_dev() {
local ost_dev

ost_name=$(ostname_from_index $obdidx)
ost_dev=$(get_obdfilter_param $node $ost_name mntdev)
ost_dev=$(get_osd_param $node $ost_name mntdev)
if [ $? -ne 0 ]; then
printf "unable to find OST%04x on $facet\n" $obdidx
return 1
Expand Down
29 changes: 16 additions & 13 deletions lustre/tests/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3641,15 +3641,18 @@ test_53() {
local mds_last
local ost_last
local ostnum
local node

# only test MDT0000
local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS)
for value in $(do_facet $SINGLEMDS lctl get_param osc.$mdtosc.prealloc_last_id) ; do
param=`echo ${value[0]} | cut -d "=" -f1`
ostname=`echo $param | cut -d "." -f2 | cut -d - -f 1-2`
mds_last=$(do_facet $SINGLEMDS lctl get_param -n $param)
ostnum=$(echo $ostname | sed "s/${FSNAME}-OST//g" | awk '{print ($1+1)}' )
ost_last=$(do_facet ost$ostnum lctl get_param -n obdfilter.$ostname.last_id | head -n 1)
ostnum=$(index_from_ostuuid ${ostname}_UUID)
node=$(facet_active_host ost$((ostnum+1)))
param="obdfilter.$ostname.last_id"
ost_last=$(do_node $node lctl get_param -n $param | head -n 1)
echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
if [ $ost_last != $mds_last ]; then
error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
Expand Down Expand Up @@ -5531,8 +5534,8 @@ setup_test101bc() {
STRIPE_OFFSET=0

local list=$(comma_list $(osts_nodes))
do_nodes $list $LCTL set_param -n obdfilter.*.read_cache_enable=0
do_nodes $list $LCTL set_param -n obdfilter.*.writethrough_cache_enable=0
set_osd_param $list '' read_cache_enable 0
set_osd_param $list '' writethrough_cache_enable 0

trap cleanup_test101bc EXIT
# prepare the read-ahead file
Expand All @@ -5547,8 +5550,8 @@ cleanup_test101bc() {
rm -f $DIR/$tfile

local list=$(comma_list $(osts_nodes))
do_nodes $list $LCTL set_param -n obdfilter.*.read_cache_enable=1
do_nodes $list $LCTL set_param -n obdfilter.*.writethrough_cache_enable=1
set_osd_param $list '' read_cache_enable 1
set_osd_param $list '' writethrough_cache_enable 1
}

calc_total() {
Expand Down Expand Up @@ -8304,7 +8307,7 @@ run_test 150 "truncate/append tests"
function roc_hit() {
local list=$(comma_list $(osts_nodes))

echo $(get_obdfilter_param $list '' stats |
echo $(get_osd_param $list '' stats |
awk '/'cache_hit'/ {sum+=$2} END {print sum}')
}

Expand All @@ -8315,7 +8318,7 @@ function set_cache() {
on=0;
fi
local list=$(comma_list $(osts_nodes))
set_obdfilter_param $list '' $1_cache_enable $on
set_osd_param $list '' $1_cache_enable $on

cancel_lru_locks osc
}
Expand All @@ -8328,18 +8331,18 @@ test_151() {
local list=$(comma_list $(osts_nodes))

# check whether obdfilter is cache capable at all
if ! get_obdfilter_param $list '' read_cache_enable >/dev/null; then
if ! get_osd_param $list '' read_cache_enable >/dev/null; then
echo "not cache-capable obdfilter"
return 0
fi

# check cache is enabled on all obdfilters
if get_obdfilter_param $list '' read_cache_enable | grep 0; then
if get_osd_param $list '' read_cache_enable | grep 0; then
echo "oss cache is disabled"
return 0
fi

set_obdfilter_param $list '' writethrough_cache_enable 1
set_osd_param $list '' writethrough_cache_enable 1

# pages should be in the case right after write
dd if=/dev/urandom of=$DIR/$tfile bs=4k count=$CPAGES || error "dd failed"
Expand All @@ -8353,7 +8356,7 @@ test_151() {

# the following read invalidates the cache
cancel_lru_locks osc
set_obdfilter_param $list '' read_cache_enable 0
set_osd_param $list '' read_cache_enable 0
cat $DIR/$tfile >/dev/null

# now data shouldn't be found in the cache
Expand All @@ -8365,7 +8368,7 @@ test_151() {
error "IN CACHE: before: $BEFORE, after: $AFTER"
fi

set_obdfilter_param $list '' read_cache_enable 1
set_osd_param $list '' read_cache_enable 1
rm -f $DIR/$tfile
}
run_test 151 "test cache on oss and controls ==============================="
Expand Down
8 changes: 4 additions & 4 deletions lustre/tests/sanityn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@ test_19() { # bug3811
local node=$(facet_active_host ost1)

# check whether obdfilter is cache capable at all
if ! get_obdfilter_param $node '' read_cache_enable >/dev/null; then
if ! get_osd_param $node '' read_cache_enable >/dev/null; then
echo "not cache-capable obdfilter"
return 0
fi

local MAX=$(get_obdfilter_param $node '' readcache_max_filesize | \
local MAX=$(get_osd_param $node '' readcache_max_filesize | \
head -n 1)
set_obdfilter_param $node '' readcache_max_filesize 4096
set_osd_param $node '' readcache_max_filesize 4096
dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
cp $TMP/$tfile $DIR1/$tfile
Expand All @@ -450,7 +450,7 @@ test_19() { # bug3811
[ "$(cat $TMP/sum2)" = "$SUM" ] || \
error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
done
set_obdfilter_param $node '' readcache_max_filesize $MAX
set_osd_param $node '' readcache_max_filesize $MAX
rm $DIR1/$tfile
}
run_test 19 "test concurrent uncached read races ==============="
Expand Down
8 changes: 4 additions & 4 deletions lustre/tests/test-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -793,15 +793,15 @@ ostdevlabel() {
}

#
# This and set_obdfilter_param() shall be used to access OSD parameters
# This and set_osd_param() shall be used to access OSD parameters
# once existed under "obdfilter":
#
# mntdev
# stats
# read_cache_enable
# writethrough_cache_enable
#
get_obdfilter_param() {
get_osd_param() {
local nodes=$1
local device=${2:-$FSNAME-OST*}
local name=$3
Expand All @@ -810,7 +810,7 @@ get_obdfilter_param() {
osd-*.$device.$name 2>&1" | grep -v 'Found no match'
}

set_obdfilter_param() {
set_osd_param() {
local nodes=$1
local device=${2:-$FSNAME-OST*}
local name=$3
Expand Down Expand Up @@ -3453,7 +3453,7 @@ get_mnt_devs() {
local dev

if [ "$type" == ost ]; then
devs=$(get_obdfilter_param $node "" mntdev)
devs=$(get_osd_param $node "" mntdev)
else
devs=$(do_node $node \
"lctl get_param -n osd-*.$FSNAME-M*.mntdev")
Expand Down

0 comments on commit dce5dfc

Please sign in to comment.