From: Loic Dachary Date: Tue, 4 Feb 2014 11:55:19 +0000 (+0100) Subject: mon: s/ENOSYS/ENOTSUP/ X-Git-Tag: v0.78~176^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=302fc924fe201cbbea2144ae2531a24959c38f78;p=ceph.git mon: s/ENOSYS/ENOTSUP/ On Linux ENOTSUP is remapped /usr/include/x86_64-linux-gnu/bits/errno.h /* Linux has no ENOTSUP error code. */ # define ENOTSUP EOPNOTSUPP and should have different values on other operating systems. On Ubuntu precise the string returned when translating the error value of ENOTSUP or EOPNOTSUPP is always EOPNOTSUPP but on Ubuntu saucy it is always ENOTSUP. Replace ENOSYS with ENOTSUP because the expected semantic is very similar and modify the test to not check on the string translation of the error. Rework the check_response shell function to optionaly check the return code. The erasure coded pool size change test verifies the error message only but not the error code. Signed-off-by: Loic Dachary --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 58d0e94a521..0e87c811bc2 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -4,7 +4,7 @@ set -e set -o functrace PS4=' ${FUNCNAME[0]}: $LINENO: ' -get_pg() +function get_pg() { local pool obj map_output pg pool=$1 @@ -21,7 +21,7 @@ get_pg() echo $pg } -expect_false() +function expect_false() { set -x if "$@"; then return 1; else return 0; fi @@ -35,16 +35,16 @@ TMPFILE=$TMPDIR/test_invalid.$$ function check_response() { - retcode=$1 - expected_retcode=$2 - expected_stderr_string=$3 - if [ $1 != $2 ] ; then - echo "return code invalid: got $1, expected $2" >&2 + expected_stderr_string=$1 + retcode=$2 + expected_retcode=$3 + if [ "$expected_retcode" -a $retcode != $expected_retcode ] ; then + echo "return code invalid: got $retcode, expected $expected_retcode" >&2 exit 1 fi - if ! grep "$3" $TMPFILE >/dev/null 2>&1 ; then - echo "Didn't find $3 in stderr output" >&2 + if ! grep "$expected_stderr_string" $TMPFILE >/dev/null 2>&1 ; then + echo "Didn't find $expected_stderr_string in stderr output" >&2 echo "Stderr: " >&2 cat $TMPFILE >&2 exit 1 @@ -369,6 +369,13 @@ ceph osd pool set data size $new_size ceph osd pool get data size | grep "size: $new_size" ceph osd pool set data size $old_size +ceph osd crush rule create-erasure ec_ruleset +ceph osd pool create pool_erasure 12 12 erasure crush_ruleset=ec_ruleset +set +e +ceph osd pool set pool_erasure size 4444 2>$TMPFILE +check_response $? 38 'can not change the size' +set -e + ceph osd pool set data hashpspool true ceph osd pool set data hashpspool false ceph osd pool set data hashpspool 0 @@ -391,16 +398,16 @@ ceph osd thrash 10 set +e # expect error about missing 'pool' argument -ceph osd map 2>$TMPFILE; check_response $? 22 'pool' +ceph osd map 2>$TMPFILE; check_response 'pool' $? 22 # expect error about unused argument foo -ceph osd ls foo 2>$TMPFILE; check_response $? 22 'unused' +ceph osd ls foo 2>$TMPFILE; check_response 'unused' $? 22 # expect "not in range" for invalid full ratio -ceph pg set_full_ratio 95 2>$TMPFILE; check_response $? 22 'not in range' +ceph pg set_full_ratio 95 2>$TMPFILE; check_response 'not in range' $? 22 # expect "not in range" for invalid overload percentage -ceph osd reweight-by-utilization 80 2>$TMPFILE; check_response $? 22 'not in range' +ceph osd reweight-by-utilization 80 2>$TMPFILE; check_response 'not in range' $? 22 # expect 'heap' commands to be correctly parsed ceph heap stats diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 0834e371a4b..43e97a96cc0 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3078,7 +3078,7 @@ int OSDMonitor::prepare_command_pool_set(map &cmdmap, if (var == "size") { if (p.type == pg_pool_t::TYPE_ERASURE) { ss << "can not change the size of an erasure-coded pool"; - return -ENOSYS; + return -ENOTSUP; } if (interr.length()) { ss << "error parsing integer value '" << val << "': " << interr;