From: Yang Honggang Date: Mon, 22 Jan 2018 02:00:17 +0000 (-0500) Subject: mon/OSDMonitor.cc: fix expected_num_objects interpret error X-Git-Tag: wip-pdonnell-testing-20180317.202121~481^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c24f2baec968ff66e792991d829591505ffba3ae;p=ceph-ci.git mon/OSDMonitor.cc: fix expected_num_objects interpret error Fixes: http://tracker.ceph.com/issues/22530 Signed-off-by: Yang Honggang --- diff --git a/qa/standalone/mon/osd-pool-create.sh b/qa/standalone/mon/osd-pool-create.sh index eb2a21b4e38..1ef1e9c4606 100755 --- a/qa/standalone/mon/osd-pool-create.sh +++ b/qa/standalone/mon/osd-pool-create.sh @@ -22,9 +22,9 @@ function run() { shift export CEPH_MON="127.0.0.1:7105" # git grep '\<7105\>' : there must be only one - export CEPH_ARGS CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " CEPH_ARGS+="--mon-host=$CEPH_MON " + export CEPH_ARGS local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} for func in $funcs ; do @@ -208,6 +208,28 @@ function TEST_utf8_cli() { ceph osd pool delete 黄 黄 --yes-i-really-really-mean-it } +function TEST_pool_create_rep_expected_num_objects() { + local dir=$1 + setup $dir || return 1 + + # disable pg dir merge + CEPH_ARGS+="--filestore-merge-threshold=-10 " + export CEPH_ARGS + run_mon $dir a || return 1 + run_osd $dir 0 || return 1 + + ceph osd pool create rep_expected_num_objects 64 64 replicated replicated_rule 100000 || return 1 + # wait for pg dir creating + sleep 5 + ret=$(find ${dir}/0/current/1.0_head/ | grep DIR | wc -l) + if [ "$ret" -le 2 ]; + then + return 1 + else + echo "TEST_pool_create_rep_expected_num_objects PASS" + fi +} + main osd-pool-create "$@" # Local Variables: diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 52c5afbb480..d7426e40f86 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -10154,6 +10154,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, } bool implicit_rule_creation = false; + int64_t expected_num_objects = 0; string rule_name; cmd_getval(cct, cmdmap, "rule", rule_name); string erasure_code_profile; @@ -10191,9 +10192,26 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, rule_name = poolstr; } } + cmd_getval(g_ceph_context, cmdmap, "expected_num_objects", + expected_num_objects, int64_t(0)); } else { //NOTE:for replicated pool,cmd_map will put rule_name to erasure_code_profile field - rule_name = erasure_code_profile; + // and put expected_num_objects to rule field + if (erasure_code_profile != "") { // cmd is from CLI + if (rule_name != "") { + string interr; + expected_num_objects = strict_strtoll(rule_name.c_str(), 10, &interr); + if (interr.length()) { + ss << "error parsing integer value '" << rule_name << "': " << interr; + err = -EINVAL; + goto reply; + } + } + rule_name = erasure_code_profile; + } else { // cmd is well-formed + cmd_getval(g_ceph_context, cmdmap, "expected_num_objects", + expected_num_objects, int64_t(0)); + } } if (!implicit_rule_creation && rule_name != "") { @@ -10207,8 +10225,6 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } - int64_t expected_num_objects; - cmd_getval(cct, cmdmap, "expected_num_objects", expected_num_objects, int64_t(0)); if (expected_num_objects < 0) { ss << "'expected_num_objects' must be non-negative"; err = -EINVAL; diff --git a/src/pybind/mgr/localpool/module.py b/src/pybind/mgr/localpool/module.py index 0abdbfbc741..fac3d1c7f6c 100644 --- a/src/pybind/mgr/localpool/module.py +++ b/src/pybind/mgr/localpool/module.py @@ -54,7 +54,6 @@ class Module(MgrModule): "format": "json", "pool": pool_name, 'rule': pool_name, - 'erasure_code_profile': pool_name, "pool_type": 'replicated', 'pg_num': str(pg_num), }), "")