local ruleset=ruleset2
local root=default
local failure_domain=host
+ ./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush rule create-simple","name":"'$ruleset'","root":"'$root'","type":"'$failure_domain'"}' | nc -U $dir/a/ceph-mon.a.asok | cut --bytes=5-)
test $result = true || return 1
function TEST_crush_rule_create_erasure_exists() {
local dir=$1
local ruleset=ruleset5
+ ./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush rule create-erasure","name":"'$ruleset'"}' | nc -U $dir/a/ceph-mon.a.asok | cut --bytes=5-)
test $result = true || return 1
function TEST_crush_rule_create_erasure_profile_default_exists() {
local dir=$1
local ruleset=ruleset6
+ ./ceph osd erasure-code-profile ls
./ceph osd erasure-code-profile rm default || return 1
! ./ceph osd erasure-code-profile ls | grep default || return 1
# add to the pending OSD map without triggering a paxos proposal
# try again if the profile is pending
local profile=profile
+ ./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd erasure-code-profile set","name":"'$profile'"}' | nc -U $dir/$id/ceph-mon.$id.asok | cut --bytes=5-)
test $result = true || return 1
# try again if the profile is pending
local profile=myprofile
+ ./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd erasure-code-profile set","name":"'$profile'"}' | nc -U $dir/$id/ceph-mon.$id.asok | cut --bytes=5-)
test $result = true || return 1
function TEST_erasure_crush_rule_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
+ ./ceph osd erasure-code-profile ls
# try again if the ruleset creation is pending
crush_ruleset=erasure_ruleset
# add to the pending OSD map without triggering a paxos proposal
function TEST_simple_crush_rule_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
+ ./ceph osd erasure-code-profile ls
# try again if the ruleset creation is pending
crush_ruleset=simple_ruleset
./ceph osd crush add-bucket host1 host
function TEST_erasure_code_profile_default_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
+ ./ceph osd erasure-code-profile ls
./ceph osd erasure-code-profile rm default || return 1
! ./ceph osd erasure-code-profile ls | grep default || return 1
# add to the pending OSD map without triggering a paxos proposal