Whamcloud - gitweb
LU-2416 test: Some test using wrong lctl params
authorJames Simmons <uja.ornl@gmail.com>
Mon, 7 Jan 2013 17:55:42 +0000 (12:55 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 26 Jan 2013 03:30:38 +0000 (22:30 -0500)
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 <uja.ornl@gmail.com>
Change-Id: I05ca4711b198061de1378b79d2f7f35d5a1c75af
Reviewed-on: http://review.whamcloud.com/4726
Reviewed-by: Li Wei <wei.g.li@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/lfsck.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh

index d8b95cf..7ade8bc 100644 (file)
@@ -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
index 495570f..f9d6c3d 100644 (file)
@@ -3641,6 +3641,7 @@ test_53() {
        local mds_last
        local ost_last
        local ostnum
+       local node
 
        # only test MDT0000
         local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS)
@@ -3648,8 +3649,10 @@ test_53() {
                 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"
@@ -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
@@ -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() {
@@ -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}')
 }
 
@@ -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
 }
@@ -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"
@@ -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
@@ -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 ==============================="
index 3a84dd4..20179d9 100644 (file)
@@ -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
@@ -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 ==============="
index 6aad0c4..f571ca8 100644 (file)
@@ -793,7 +793,7 @@ 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
@@ -801,7 +801,7 @@ ostdevlabel() {
 #   read_cache_enable
 #   writethrough_cache_enable
 #
-get_obdfilter_param() {
+get_osd_param() {
        local nodes=$1
        local device=${2:-$FSNAME-OST*}
        local name=$3
@@ -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
@@ -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")