]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add integration test for the auto repair feature
authorGuang Yang <yguang@yahoo-inc.com>
Fri, 16 Oct 2015 15:51:51 +0000 (15:51 +0000)
committerGuang Yang <yguang@yahoo-inc.com>
Fri, 16 Oct 2015 20:29:48 +0000 (20:29 +0000)
Signed-off-by: Guang Yang <yguang@yahoo-inc.com>
src/test/osd/osd-scrub-repair.sh

index 13fac7c2a8ee471049a8c21d56620b873b3214ed..4690bec128e9cd36d1838bda986757092436722c 100755 (executable)
@@ -144,6 +144,49 @@ function corrupt_and_repair_erasure_coded() {
 
 }
 
+function TEST_auto_repair_erasure_coded() {
+    local dir=$1
+    local poolname=ecpool
+
+    # Launch a cluster with 5 seconds scrub interval
+    setup $dir || return 1
+    run_mon $dir a || return 1
+    for id in $(seq 0 2) ; do
+        run_osd $dir $id \
+            --osd-scrub-auto-repair=true \
+            --osd-deep-scrub-interval=5 \
+            --osd-scrub-max-interval=5 \
+            --osd-scrub-min-interval=5 \
+            --osd-scrub-interval-randomize-ratio=0
+    done
+    wait_for_clean || return 1
+
+    # Create an EC pool
+    ceph osd erasure-code-profile set myprofile \
+        k=2 m=1 ruleset-failure-domain=osd || return 1
+    ceph osd pool create $poolname 8 8 erasure myprofile || return 1
+    wait_for_clean || return 1
+
+    # Put an object
+    local payload=ABCDEF
+    echo $payload > $dir/ORIGINAL
+    rados --pool $poolname put SOMETHING $dir/ORIGINAL || return 1
+
+    # Remove the object from one shard physically
+    objectstore_tool $dir $(get_not_primary $poolname SOMETHING) SOMETHING remove || return 1
+
+    # Give some time for auto repair
+    sleep 20
+
+    # Verify - the file should be back
+    objectstore_tool $dir $(get_not_primary $poolname SOMETHING) SOMETHING list-attrs || return 1
+    rados --pool $poolname get SOMETHING $dir/COPY || return 1
+    diff $dir/ORIGINAL $dir/COPY || return 1
+
+    # Tear down
+    teardown $dir || return 1
+}
+
 function TEST_corrupt_and_repair_jerasure() {
     local dir=$1
     local poolname=ecpool