Whamcloud - gitweb
LU-4175 tests: fix obdecho_test() to calculate write count 89/8089/3
authorJian Yu <jian.yu@intel.com>
Tue, 29 Oct 2013 13:45:21 +0000 (21:45 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Dec 2013 13:28:31 +0000 (13:28 +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: Ibff44bf1f6a932e99c565eeda2f1edaf80962dbf
Reviewed-on: http://review.whamcloud.com/8089
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@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 97fed43..2831fde 100644 (file)
@@ -9970,6 +9970,15 @@ obdecho_test() {
        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; }
@@ -9981,7 +9990,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 "                 \
-                          "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 "    \
index a807c6b..675e311 100644 (file)
@@ -6442,6 +6442,32 @@ min_ost_size () {
 }
 
 #
+# 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 count of the filesystem.
 #
 get_block_count() {