]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add pg_scrub for ceph-helpers.sh
authorXinze Chi <xinze@xsky.com>
Wed, 25 Nov 2015 12:19:03 +0000 (20:19 +0800)
committerXinze Chi <xinze@xsky.com>
Tue, 1 Dec 2015 03:10:10 +0000 (11:10 +0800)
Signed-off-by: Xinze Chi <xinze@xsky.com>
qa/workunits/ceph-helpers.sh

index 39eb54023ef7cb2afcac32c12adf92b254df77b6..3c7bc2e5287c950d3facde28d1f7a9719683a001 100755 (executable)
@@ -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
+}
 
 #######################################################################