From e440fb496caa08737de34fbe1506bc7db9061945 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 28 Aug 2014 10:59:18 -0700 Subject: [PATCH] test/mon/*: prime mon with initial command before injection The osdmonitor_prepare_command is very fragile. Send an initial command to the mon beforehand. This seems to prevent the initial command from getting combined into an early mon proposal with some other stuff. Alternatively, we could remove these tests and this mechanism entirely as it is likely to great in the future when the next set of mon changes are made, but they have shown themselves to be useful it catching other regressions, so we'll patch them up for a bit longer. Signed-off-by: Sage Weil --- src/test/mon/osd-crush.sh | 3 +++ src/test/mon/osd-erasure-code-profile.sh | 2 ++ src/test/mon/osd-pool-create.sh | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 8f39a1a923a..219c2613b99 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -79,6 +79,7 @@ function TEST_crush_rule_create_simple_exists() { 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 @@ -124,6 +125,7 @@ function TEST_crush_rule_create_erasure() { 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 @@ -135,6 +137,7 @@ function TEST_crush_rule_create_erasure_exists() { 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 diff --git a/src/test/mon/osd-erasure-code-profile.sh b/src/test/mon/osd-erasure-code-profile.sh index 32bca9bed0e..66d1868119b 100755 --- a/src/test/mon/osd-erasure-code-profile.sh +++ b/src/test/mon/osd-erasure-code-profile.sh @@ -64,6 +64,7 @@ function SHARE_MON_TEST_set_pending() { # 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 @@ -115,6 +116,7 @@ function SHARE_MON_TEST_rm_pending() { # 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 diff --git a/src/test/mon/osd-pool-create.sh b/src/test/mon/osd-pool-create.sh index 0e4811b41d7..d9489904342 100755 --- a/src/test/mon/osd-pool-create.sh +++ b/src/test/mon/osd-pool-create.sh @@ -100,6 +100,7 @@ function TEST_erasure_crush_rule() { 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 @@ -112,6 +113,7 @@ function TEST_erasure_crush_rule_pending() { 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 @@ -135,6 +137,7 @@ function TEST_erasure_code_profile_default() { 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