From 152bbd6a580e299704b71c3818b6236249813ce8 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 25 Jun 2014 18:07:47 +0200 Subject: [PATCH] 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 --- src/test/osd/osd-test-helpers.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/osd/osd-test-helpers.sh b/src/test/osd/osd-test-helpers.sh index 5117ae38b50ae..fd05515767359 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 } -- 2.39.5