}
bool implicit_ruleset_creation = false;
+ int64_t expected_num_objects = 0;
string ruleset_name;
cmd_getval(g_ceph_context, cmdmap, "ruleset", ruleset_name);
string erasure_code_profile;
ruleset_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 ruleset_name to erasure_code_profile field
- ruleset_name = erasure_code_profile;
+ if (erasure_code_profile != "") { // cmd is from CLI
+ if (ruleset_name != "") {
+ string interr;
+ expected_num_objects = strict_strtoll(ruleset_name.c_str(), 10, &interr);
+ if (interr.length()) {
+ ss << "error parsing integer value '" << ruleset_name << "': " << interr;
+ err = -EINVAL;
+ goto reply;
+ }
+ }
+ ruleset_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_ruleset_creation && ruleset_name != "") {
goto reply;
}
- int64_t expected_num_objects;
- cmd_getval(g_ceph_context, 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;
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
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
+
+ local expected_num_objects=100000
+ ceph osd pool create rep_expected_num_objects 64 64 replicated replicated_ruleset $expected_num_objects || return 1
+ # wait for pg dir creating
+ sleep 5
+ local ret=$(ceph osd pool ls detail --format=xml -c td/osd-pool-create/ceph.conf | \
+ xmlstarlet sel -t -m "//pool[./pool_name='rep_expected_num_objects']/expected_num_objects" -v .)
+ if [ "$ret" -eq $expected_num_objects ];
+ then
+ echo "TEST_pool_create_rep_expected_num_objects PASS"
+ else
+ return 1
+ fi
+}
+
main osd-pool-create "$@"
# Local Variables: