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
+
+ 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:
}
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;
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 != "") {
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;