"name=bulk,type=CephBool,req=false "
"name=target_size_bytes,type=CephInt,range=0,req=false "
"name=target_size_ratio,type=CephFloat,range=0.0,req=false "\
- "name=yes_i_really_mean_it,type=CephBool,req=false",
+ "name=yes_i_really_mean_it,type=CephBool,req=false"
+ "name=crimson,type=CephBool,req=false",
"create pool", "osd", "rw")
COMMAND_WITH_FLAG("osd pool delete "
"name=pool,type=CephPoolname "
0, 0, 0, 0, 0, 0, 0.0,
erasure_code_profile,
pg_pool_t::TYPE_REPLICATED, 0, FAST_READ_OFF, {}, bulk,
+ cct->_conf.get_val<bool>("osd_pool_default_crimson"),
&ss);
if (ret < 0) {
* @param pool_type TYPE_ERASURE, or TYPE_REP
* @param expected_num_objects expected number of objects on the pool
* @param fast_read fast read type.
+ * @param pg_autoscale_mode autoscale mode, one of on, off, warn
+ * @param bool bulk indicates whether pool should be a bulk pool
+ * @param bool crimson indicates whether pool is a crimson pool
* @param ss human readable error message, if any.
*
* @return 0 on success, negative errno on failure.
const unsigned pool_type,
const uint64_t expected_num_objects,
FastReadType fast_read,
- const string& pg_autoscale_mode,
+ string pg_autoscale_mode,
bool bulk,
+ bool crimson,
ostream *ss)
{
+ if (crimson && pg_autoscale_mode.empty()) {
+ // default pg_autoscale_mode to off for crimson, we'll error out below if
+ // the user tried to actually set pg_autoscale_mode to something other than
+ // "off"
+ pg_autoscale_mode = "off";
+ }
+
if (name.length() == 0)
return -EINVAL;
+
if (pg_num == 0) {
auto pg_num_from_mode =
[pg_num=g_conf().get_val<uint64_t>("osd_pool_default_pg_num")]
<< ", which in this case is " << pg_num;
return -ERANGE;
}
+
+ if (crimson) {
+ /* crimson-osd requires that the pool be replicated and that pg_num/pgp_num
+ * be static. User must also have specified set-allow-crimson */
+ const auto *suffix = " (--crimson specified or osd_pool_default_crimson set)";
+ if (pool_type != pg_pool_t::TYPE_REPLICATED) {
+ *ss << "crimson-osd only supports replicated pools" << suffix;
+ return -EINVAL;
+ } else if (pg_autoscale_mode != "off") {
+ *ss << "crimson-osd does not support changing pg_num or pgp_num, "
+ << "pg_autoscale_mode must be set to 'off'" << suffix;
+ return -EINVAL;
+ } else if (!osdmap.get_allow_crimson()) {
+ *ss << "set-allow-crimson must be set to create a pool with the "
+ << "crimson flag" << suffix;
+ return -EINVAL;
+ }
+ }
+
if (pool_type == pg_pool_t::TYPE_REPLICATED && fast_read == FAST_READ_ON) {
*ss << "'fast_read' can only apply to erasure coding pool";
return -EINVAL;
pi->use_gmt_hitset = true;
else
pi->use_gmt_hitset = false;
+ if (crimson)
+ pi->set_flag(pg_pool_t::FLAG_CRIMSON);
pi->size = size;
pi->min_size = min_size;
cmd_getval(cmdmap, "autoscale_mode", pg_autoscale_mode);
bool bulk = cmd_getval_or<bool>(cmdmap, "bulk", 0);
+
+ bool crimson = cmd_getval_or<bool>(cmdmap, "crimson", false) ||
+ cct->_conf.get_val<bool>("osd_pool_default_crimson");
+
err = prepare_new_pool(poolstr,
-1, // default crush rule
rule_name,
fast_read,
pg_autoscale_mode,
bulk,
+ crimson,
&ss);
if (err < 0) {
switch(err) {