From: Xinze Chi Date: Wed, 25 Nov 2015 12:19:03 +0000 (+0800) Subject: test: add pg_scrub for ceph-helpers.sh X-Git-Tag: v10.0.2~145^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce2d3c73baeb9dd6369bb37bd2c1dc20404ff78f;p=ceph.git test: add pg_scrub for ceph-helpers.sh Signed-off-by: Xinze Chi --- diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index 39eb54023ef7..3c7bc2e5287c 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -17,7 +17,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library Public License for more details. # -TIMEOUT=120 +TIMEOUT=300 PG_NUM=4 if type xmlstarlet > /dev/null 2>&1; then @@ -1043,6 +1043,37 @@ function test_repair() { ! TIMEOUT=1 repair 1.0 || return 1 teardown $dir || return 1 } +####################################################################### + +## +# Run scrub on **pgid** and wait until it completes. The pg_scrub +# function will fail if repair does not complete within $TIMEOUT +# seconds. The pg_scrub is complete whenever the +# **get_last_scrub_stamp** function reports a timestamp different from +# the one stored before starting the scrub. +# +# @param pgid the id of the PG +# @return 0 on success, 1 on error +# +function pg_scrub() { + local pgid=$1 + local last_scrub=$(get_last_scrub_stamp $pgid) + ceph pg scrub $pgid + wait_for_scrub $pgid "$last_scrub" +} + +function test_pg_scrub() { + local dir=$1 + + setup $dir || return 1 + run_mon $dir a --osd_pool_default_size=1 || return 1 + run_osd $dir 0 || return 1 + wait_for_clean || return 1 + pg_scrub 1.0 || return 1 + kill_daemons $dir KILL osd || return 1 + ! TIMEOUT=1 pg_scrub 1.0 || return 1 + teardown $dir || return 1 +} #######################################################################