From 6ad6b092dfed397889db0241193ae441cdf59115 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 12 Feb 2014 16:58:23 +0100 Subject: [PATCH] mon: remove racy tests from osd-pool-create.sh 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 --- src/test/mon/osd-pool-create.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/test/mon/osd-pool-create.sh b/src/test/mon/osd-pool-create.sh index 7d8cceb18c000..39c6918da3a4f 100755 --- a/src/test/mon/osd-pool-create.sh +++ b/src/test/mon/osd-pool-create.sh @@ -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: -- 2.39.5