]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: remove racy tests from osd-pool-create.sh 1222/head
authorLoic Dachary <loic@dachary.org>
Wed, 12 Feb 2014 15:58:23 +0000 (16:58 +0100)
committerLoic Dachary <loic@dachary.org>
Thu, 13 Feb 2014 09:14:11 +0000 (10:14 +0100)
Use the admin socket to create the conditions by which a pool creation
is made to wait for the next paxos proposal because the required crush
ruleset is pending.

It replaces a fragile time sensitive workaround that could fail because
of race conditions. It also has the benefit of increase the speed of the
test because there is no need to wait for a long time just to accomodate
the slowest machines.

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

index 7d8cceb18c000e0d8edb1e9e5b270d95d32301f8..39c6918da3a4f3e192d5f9ab929e0cd2b2902332 100755 (executable)
@@ -17,9 +17,6 @@
 set -xe
 PS4='$LINENO: '
 
-# must be larger than the time it takes for osd pool create to perform
-# on the slowest http://ceph.com/gitbuilder.cgi machine
-TIMEOUT=${TIMEOUT:-30}
 DIR=osd-pool-create
 rm -fr $DIR
 trap "test \$? = 0 || cat $DIR/log ; set +x ; kill_mon || true && rm -fr $DIR" EXIT
@@ -101,11 +98,12 @@ grep 'EINVAL' $DIR/out
 kill_mon
 
 # try again if the ruleset creation is pending
-run_mon --paxos-propose-interval=200 --debug-mon=20 --debug-paxos=20 
+run_mon --mon-advanced-debug-mode --debug-mon=20 --debug-paxos=20 
 crush_ruleset=erasure_ruleset
-./ceph osd crush rule create-erasure nevermind # the first modification ignores the propose interval, get past it
-! timeout $TIMEOUT ./ceph osd crush rule create-erasure $crush_ruleset || exit 1
-! timeout $TIMEOUT ./ceph osd pool create pool_erasure 12 12 erasure crush_ruleset=$crush_ruleset
+# add to the pending OSD map without triggering a paxos proposal
+result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush rule create-erasure","name":"'$crush_ruleset'"}' | nc -U $DIR/ceph-mon.a.asok | cut --bytes=5-)
+test $result = true || exit 1
+./ceph osd pool create pool_erasure 12 12 erasure crush_ruleset=$crush_ruleset
 grep "$crush_ruleset try again" $DIR/log
 kill_mon
 
@@ -184,5 +182,5 @@ grep "erasure-code-directory" $DIR/osd.json > /dev/null
 kill_mon
 
 # Local Variables:
-# compile-command: "cd ../.. ; make -j4 && TIMEOUT=1 test/mon/osd-pool-create.sh"
+# compile-command: "cd ../.. ; make -j4 && test/mon/osd-pool-create.sh"
 # End: