Allow the autoscale mode to be set atomically with pool creation.
Fixes: https://tracker.ceph.com/issues/42638
Signed-off-by: Sage Weil <sage@redhat.com>
ceph osd crush rule rm foo
ceph osd erasure-code-profile rm foo
+ # autoscale mode
+ ceph osd pool create modeon --autoscale-mode=on
+ ceph osd dump | grep modeon | grep 'autoscale_mode on'
+ ceph osd pool create modewarn --autoscale-mode=warn
+ ceph osd dump | grep modewarn | grep 'autoscale_mode warn'
+ ceph osd pool create modeoff --autoscale-mode=off
+ ceph osd dump | grep modeoff | grep 'autoscale_mode off'
+ ceph osd pool delete modeon modeon --yes-i-really-really-mean-it
+ ceph osd pool delete modewarn modewarn --yes-i-really-really-mean-it
+ ceph osd pool delete modeoff modeoff --yes-i-really-really-mean-it
}
function test_mon_osd_pool_quota()
"name=expected_num_objects,type=CephInt,range=0,req=false "
"name=size,type=CephInt,range=0,req=false "
"name=pg_num_min,type=CephInt,range=0,req=false "
+ "name=autoscale_mode,type=CephChoices,strings=on|off|warn,req=false "
"name=target_size_bytes,type=CephInt,range=0,req=false "
"name=target_size_ratio,type=CephFloat,range=0|1,req=false",\
"create pool", "osd", "rw")
ret = prepare_new_pool(m->name, m->crush_rule, rule_name,
0, 0, 0, 0, 0, 0.0,
erasure_code_profile,
- pg_pool_t::TYPE_REPLICATED, 0, FAST_READ_OFF, &ss);
+ pg_pool_t::TYPE_REPLICATED, 0, FAST_READ_OFF, {},
+ &ss);
if (ret < 0) {
dout(10) << __func__ << " got " << ret << " " << ss.str() << dendl;
const unsigned pool_type,
const uint64_t expected_num_objects,
FastReadType fast_read,
+ const string& pg_autoscale_mode,
ostream *ss)
{
if (name.length() == 0)
pg_num_min) {
pi->opts.set(pool_opts_t::PG_NUM_MIN, static_cast<int64_t>(pg_num_min));
}
+ if (auto m = pg_pool_t::get_pg_autoscale_mode_by_name(
+ pg_autoscale_mode); m != pg_pool_t::pg_autoscale_mode_t::UNKNOWN) {
+ pi->pg_autoscale_mode = m;
+ }
pi->last_change = pending_inc.epoch;
pi->auid = 0;
cmd_getval(cmdmap, "target_size_bytes", target_size_bytes);
cmd_getval(cmdmap, "target_size_ratio", target_size_ratio);
+ string pg_autoscale_mode;
+ cmd_getval(cmdmap, "autoscale_mode", pg_autoscale_mode);
+
err = prepare_new_pool(poolstr,
-1, // default crush rule
rule_name,
erasure_code_profile, pool_type,
(uint64_t)expected_num_objects,
fast_read,
+ pg_autoscale_mode,
&ss);
if (err < 0) {
switch(err) {
const unsigned pool_type,
const uint64_t expected_num_objects,
FastReadType fast_read,
+ const string& pg_autoscale_mode,
ostream *ss);
int prepare_new_pool(MonOpRequestRef op);