From 274c307de60a246f7df3e65f146a61c61cb12759 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 16 Nov 2016 10:18:02 +0100 Subject: [PATCH] tests: osd-crush.sh must retry crush dump After ceph osd setcrushmap, the script must retry because ceph osd crush dump races against the update of the crushmap. Fixes: http://tracker.ceph.com/issues/17919 Signed-off-by: Loic Dachary --- src/test/mon/osd-crush.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/mon/osd-crush.sh b/src/test/mon/osd-crush.sh index 4fecd4a4d516..982ec904b25f 100755 --- a/src/test/mon/osd-crush.sh +++ b/src/test/mon/osd-crush.sh @@ -271,8 +271,19 @@ function TEST_crush_repair_faulty_crushmap() { ceph osd setcrushmap -i $empty_map.map || return 1 # should be an empty crush map without any buckets - ! test $(ceph osd crush dump --format=xml | \ - $XMLSTARLET sel -t -m "//buckets/bucket" -v .) || return 1 + success=false + for delay in 1 2 4 8 16 32 64 128 256 ; do + if ! test $(ceph osd crush dump --format=xml | \ + $XMLSTARLET sel -t -m "//buckets/bucket" -v .) ; then + success=true + break + fi + sleep $delay + done + if ! $success ; then + ceph osd crush dump --format=xml + return 1 + fi # bring them down, the "ceph" commands will try to hunt for other monitor in # vain, after mon.a is offline kill_daemons $dir || return 1 -- 2.47.3