]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: test LRC pool, profile and crush ruleset
authorLoic Dachary <loic@dachary.org>
Sun, 8 Jun 2014 15:25:41 +0000 (17:25 +0200)
committerLoic Dachary <loic-201408@dachary.org>
Fri, 29 Aug 2014 17:39:57 +0000 (19:39 +0200)
Using the command line to create an LRC pool validates that the plugin
can be loaded and the ruleset created immediately after the crush table
is populated with the default rulesets.

Add a test that takes out the first OSD holding data for an object and
checks the recovery is effective by retrieving the object content and
checking it is as expected.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/test/erasure-code/test-erasure-code.sh
src/test/mon/osd-pool-create.sh

index 8ad52a09045c440ca4cc4f93ea893b0cc0826093..6c438e616c3d56e57467fdbb7c994b2c9f7ada47 100755 (executable)
@@ -30,7 +30,7 @@ function run() {
     # check that erasure code plugins are preloaded
     CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1
     grep 'load: jerasure' $dir/a/log || return 1
-    for id in $(seq 0 4) ; do
+    for id in $(seq 0 10) ; do
         run_osd $dir $id || return 1
     done
     # check that erasure code plugins are preloaded
@@ -67,15 +67,32 @@ function rados_put_get() {
     local dir=$1
     local poolname=$2
 
-    local payload=ABC
-    echo "$payload" > $dir/ORIGINAL
+    for marker in AAA BBB CCCC DDDD ; do
+        printf "%*s" 1024 $marker
+    done > $dir/ORIGINAL
 
+    #
+    # get and put an object, compare they are equal
+    #
     ./rados --pool $poolname put SOMETHING $dir/ORIGINAL || return 1
     ./rados --pool $poolname get SOMETHING $dir/COPY || return 1
+    diff $dir/ORIGINAL $dir/COPY || return 1
+    rm $dir/COPY
 
+    #
+    # take out the first OSD used to store the object and
+    # check the object can still be retrieved, which implies
+    # recovery
+    #
+    local -a initial_osds=($(get_osds $poolname SOMETHING))
+    local last=$((${#initial_osds[@]} - 1))
+    ./ceph osd out ${initial_osds[$last]} || return 1
+    ! get_osds $poolname SOMETHING | grep '\<'${initial_osds[$last]}'\>' || return 1
+    ./rados --pool $poolname get SOMETHING $dir/COPY || return 1
     diff $dir/ORIGINAL $dir/COPY || return 1
+    ./ceph osd in ${initial_osds[$last]} || return 1
 
-    rm $dir/ORIGINAL $dir/COPY
+    rm $dir/ORIGINAL
 }
 
 function plugin_exists() {
@@ -94,6 +111,43 @@ function plugin_exists() {
     return $status
 }
 
+function TEST_rados_put_get_LRC_advanced() {
+    local dir=$1
+    local poolname=pool-LRC
+    local profile=profile-LRC
+
+    ./ceph osd erasure-code-profile set $profile \
+        plugin=LRC \
+        mapping=DD_ \
+        ruleset-steps='[ [ "chooseleaf", "osd", 0 ] ]' \
+        layers='[ [ "DDc", "" ] ]'  || return 1
+    ./ceph osd pool create $poolname 12 12 erasure $profile \
+        || return 1
+
+    rados_put_get $dir $poolname || return 1
+
+    delete_pool $poolname
+    ./ceph osd erasure-code-profile rm $profile
+}
+
+function TEST_rados_put_get_LRC_kml() {
+    local dir=$1
+    local poolname=pool-LRC
+    local profile=profile-LRC
+
+    ./ceph osd erasure-code-profile set $profile \
+        plugin=LRC \
+        k=4 m=2 l=3 \
+        ruleset-failure-domain=osd || return 1
+    ./ceph osd pool create $poolname 12 12 erasure $profile \
+        || return 1
+
+    rados_put_get $dir $poolname || return 1
+
+    delete_pool $poolname
+    ./ceph osd erasure-code-profile rm $profile
+}
+
 function TEST_rados_put_get_isa() {
     if ! plugin_exists isa ; then
         echo "SKIP because plugin isa has not been built"
@@ -117,6 +171,21 @@ function TEST_rados_put_get_jerasure() {
     local dir=$1
 
     rados_put_get $dir ecpool || return 1
+
+    local poolname=pool-jerasure
+    local profile=profile-jerasure
+
+    ./ceph osd erasure-code-profile set $profile \
+        plugin=jerasure \
+        k=4 m=2 \
+        ruleset-failure-domain=osd || return 1
+    ./ceph osd pool create $poolname 12 12 erasure $profile \
+        || return 1
+
+    rados_put_get $dir $poolname || return 1
+
+    delete_pool $poolname
+    ./ceph osd erasure-code-profile rm $profile
 }
 
 function TEST_alignment_constraints() {
@@ -190,8 +259,10 @@ function TEST_chunk_mapping() {
     verify_chunk_mapping $dir ecpool 0 1 || return 1
 
     ./ceph osd erasure-code-profile set remap-profile \
-        ruleset-failure-domain=osd \
-        mapping='_DD' || return 1
+        plugin=LRC \
+        layers='[ [ "_DD", "" ] ]' \
+        mapping='_DD' \
+        ruleset-steps='[ [ "choose", "osd", 0 ] ]' || return 1
     ./ceph osd erasure-code-profile get remap-profile
     ./ceph osd pool create remap-pool 12 12 erasure remap-profile \
         || return 1
@@ -204,6 +275,7 @@ function TEST_chunk_mapping() {
     verify_chunk_mapping $dir remap-pool 1 2 || return 1
 
     delete_pool remap-pool
+    ./ceph osd erasure-code-profile rm remap-profile
 }
 
 main test-erasure-code
index d9489904342c1ff36beda59b5d59deb39351af25..311fc2b8c456dd19cca58d036b1bc6d07e758adf 100755 (executable)
@@ -214,6 +214,25 @@ function TEST_replicated_pool_with_ruleset() {
         grep "doesn't exist" || return 1
 }
 
+function TEST_erasure_code_pool_LRC() {
+    local dir=$1
+    run_mon $dir a --public-addr 127.0.0.1
+
+    ./ceph osd erasure-code-profile set LRCprofile \
+             plugin=LRC \
+             mapping=DD_ \
+             layers='[ [ "DDc", "" ] ]' || return 1
+
+    ./ceph --format json osd dump > $dir/osd.json
+    local expected='"erasure_code_profile":"LRCprofile"'
+    local poolname=erasurecodes
+    ! grep "$expected" $dir/osd.json || return 1
+    ./ceph osd pool create $poolname 12 12 erasure LRCprofile
+    ./ceph --format json osd dump | tee $dir/osd.json
+    grep "$expected" $dir/osd.json > /dev/null || return 1
+    ./ceph osd crush rule ls | grep $poolname || return 1
+}
+
 function TEST_replicated_pool() {
     local dir=$1
     run_mon $dir a --public-addr 127.0.0.1