Whamcloud - gitweb
LU-4175 tests: fix obdecho_test() to calculate write count 88/8388/2
authorJian Yu <jian.yu@intel.com>
Mon, 25 Nov 2013 08:35:32 +0000 (16:35 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Dec 2013 03:38:11 +0000 (03:38 +0000)
This patch fixes obdecho_test() in sanity.sh to calculate
write count so as to avoid out of space failure while the
page number is large but the obd target size is small.

Signed-off-by: Jian Yu <jian.yu@intel.com>
Change-Id: Ifcd055c587570d3f0e3ca22d763f9478e9bee3fa
Reviewed-on: http://review.whamcloud.com/8388
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 9ba8d32..9e9fdfd 100644 (file)
@@ -9774,6 +9774,15 @@ obdecho_test() {
        local pages=${3:-64}
         local rc=0
         local id
        local pages=${3:-64}
         local rc=0
         local id
+
+       local count=10
+       local obd_size=$(get_obd_size $node $OBD)
+       local page_size=$(get_page_size $node)
+       if [[ -n "$obd_size" ]]; then
+               local new_count=$((obd_size / (pages * page_size / 1024)))
+               [[ $new_count -ge $count ]] || count=$new_count
+       fi
+
         do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1
         [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec setup $OBD" ||
                            rc=2; }
         do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1
         [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec setup $OBD" ||
                            rc=2; }
@@ -9785,7 +9794,7 @@ obdecho_test() {
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec getattr $id" ||
                           rc=4; }
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec "                 \
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec getattr $id" ||
                           rc=4; }
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec "                 \
-                          "test_brw 10 w v $pages $id" || rc=4; }
+                          "test_brw $count w v $pages $id" || rc=4; }
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" ||
                           rc=4; }
        [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec "    \
        [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" ||
                           rc=4; }
        [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec "    \
index 0423c83..34044d0 100644 (file)
@@ -6245,6 +6245,32 @@ min_ost_size () {
     $LCTL get_param -n osc.*.kbytesavail | sort -n | head -n1
 }
 
     $LCTL get_param -n osc.*.kbytesavail | sort -n | head -n1
 }
 
+#
+# Get the available size (KB) of a given obd target.
+#
+get_obd_size() {
+       local facet=$1
+       local obd=$2
+       local size
+
+       [[ $facet != client ]] || return 0
+
+       size=$(do_facet $facet $LCTL get_param -n *.$obd.kbytesavail | head -n1)
+       echo -n $size
+}
+
+#
+# Get the page size (bytes) on a given facet node.
+#
+get_page_size() {
+       local facet=$1
+       local size
+
+       size=$(do_facet $facet getconf PAGE_SIZE)
+       [[ ${PIPESTATUS[0]} = 0 && -n "$size" ]] || size=4096
+       echo -n $size
+}
+
 # Get the block size of the filesystem.
 get_block_size() {
     local facet=$1
 # Get the block size of the filesystem.
 get_block_size() {
     local facet=$1