From: Loic Dachary Date: Thu, 21 May 2015 14:39:30 +0000 (+0200) Subject: tests: ceph create may consume more than one id X-Git-Tag: v9.0.2~130^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5c69f5e15fec2bbf65ab5680bc912ad436d5923a;p=ceph.git 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 --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 15d4e733d90c..e3343bdcfc9e 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