From 5c69f5e15fec2bbf65ab5680bc912ad436d5923a Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 21 May 2015 16:39:30 +0200 Subject: [PATCH] tests: ceph create may consume more than one id When CEPH_CLI_TEST_DUP_COMMAND=1 is set, ceph osd create will consume two osd id and return the later. Fix the test to account for that and not assume the osd id being allocated by osd create is always the next available osd id. The other osd create tests do not suffer from the same variation because they provide a UUID argument that guarantees the same osd id is going to be returned every time. http://tracker.ceph.com/issues/11618 Fixes: #11618 Signed-off-by: Loic Dachary --- qa/workunits/cephtool/test.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 15d4e733d90..e3343bdcfc9 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -1036,17 +1036,26 @@ function test_mon_osd() ceph osd create $uuid $gap_start 2>&1 | grep 'EINVAL' + # + # When CEPH_CLI_TEST_DUP_COMMAND is set, osd create + # is repeated and consumes two osd id, not just one. + # + local next_osd + if test "$CEPH_CLI_TEST_DUP_COMMAND" ; then + next_osd=$((gap_start + 1)) + else + next_osd=$gap_start + fi id=`ceph osd create` - [ "$id" = "$gap_start" ] - gap_start=$((gap_start + 1)) + [ "$id" = "$next_osd" ] + next_osd=$((id + 1)) id=`ceph osd create $(uuidgen)` - [ "$id" = "$gap_start" ] - gap_start=$((gap_start + 1)) + [ "$id" = "$next_osd" ] - id=`ceph osd create $(uuidgen) $gap_start` - [ "$id" = "$gap_start" ] - gap_start=$((gap_start + 1)) + next_osd=$((id + 1)) + id=`ceph osd create $(uuidgen) $next_osd` + [ "$id" = "$next_osd" ] local new_osds=$(echo $(ceph osd ls)) for id in $(echo $new_osds | sed -e "s/$old_osds//") ; do -- 2.47.3