# 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
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() {
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"
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() {
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
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
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