From: Loic Dachary Date: Wed, 25 Jun 2014 16:07:47 +0000 (+0200) Subject: osd: workaround race condition in tests X-Git-Tag: v0.83~58^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2024%2Fhead;p=ceph.git osd: workaround race condition in tests Trying to "ceph tell" a newly created OSD sometime triggers an ENXIO. The OSD creation function used for test scripts waits for the OSD to report that it is up (according to ceph osd tree) before returning. That reduces (maybe close ?) the condition that triggers the error so that the tests do not randomly fail. http://tracker.ceph.com/issues/8630 refs: #8630 Signed-off-by: Loic Dachary --- diff --git a/src/test/osd/osd-test-helpers.sh b/src/test/osd/osd-test-helpers.sh index 5117ae38b50a..fd0551576735 100644 --- a/src/test/osd/osd-test-helpers.sh +++ b/src/test/osd/osd-test-helpers.sh @@ -51,4 +51,17 @@ function run_osd() { [ "$id" = "$(cat $osd_data/whoami)" ] || return 1 ./ceph osd crush create-or-move "$id" 1 root=default host=localhost + + status=1 + # Workaround for http://tracker.ceph.com/issues/8630 + for ((i=0; i < 60; i++)); do + if ! ceph osd dump | grep "osd.$id up"; then + sleep 1 + else + status=0 + break + fi + done + + return $status }