]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: more options in new-style 18397/head
authorKefu Chai <kchai@redhat.com>
Thu, 19 Oct 2017 11:28:49 +0000 (19:28 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 24 Oct 2017 07:14:09 +0000 (15:14 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/mon/OSDMonitor.cc
src/test/erasure-code/TestErasureCodeLrc.cc

index 15154dd8039de8a605d8f32101987409a54d0b0a..2099b4013547acd8aaa5abf242284fb8b108475c 100644 (file)
@@ -345,7 +345,6 @@ OPTION(mon_client_ping_timeout, OPT_DOUBLE)   // fail if we don't hear back
 OPTION(mon_client_hunt_interval_backoff, OPT_DOUBLE) // each time we reconnect to a monitor, double our timeout
 OPTION(mon_client_hunt_interval_max_multiple, OPT_DOUBLE) // up to a max of 10*default (30 seconds)
 OPTION(mon_client_max_log_entries_per_message, OPT_INT)
-OPTION(mon_max_pool_pg_num, OPT_INT)
 OPTION(mon_pool_quota_warn_threshold, OPT_INT) // percent of quota at which to issue warnings
 OPTION(mon_pool_quota_crit_threshold, OPT_INT) // percent of quota at which to issue errors
 OPTION(client_cache_size, OPT_INT)
@@ -604,7 +603,6 @@ OPTION(osd_pool_use_gmt_hitset, OPT_BOOL) // try to use gmt for hitset archive n
 OPTION(osd_crush_update_on_start, OPT_BOOL)
 OPTION(osd_class_update_on_start, OPT_BOOL) // automatically set device class on start
 OPTION(osd_crush_initial_weight, OPT_DOUBLE) // if >=0, the initial weight is for newly added osds.
-OPTION(osd_pool_erasure_code_stripe_unit, OPT_U32) // in bytes
 OPTION(osd_erasure_code_plugins, OPT_STR) // list of erasure code plugins
 
 // Allows the "peered" state for recovery and backfill below min_size
@@ -630,14 +628,6 @@ OPTION(osd_hit_set_namespace, OPT_STR) // rados namespace for hit_set tracking
 OPTION(osd_tier_promote_max_objects_sec, OPT_U64)
 OPTION(osd_tier_promote_max_bytes_sec, OPT_U64)
 
-OPTION(osd_tier_default_cache_mode, OPT_STR)
-OPTION(osd_tier_default_cache_hit_set_count, OPT_INT)
-OPTION(osd_tier_default_cache_hit_set_period, OPT_INT)
-OPTION(osd_tier_default_cache_hit_set_type, OPT_STR)
-OPTION(osd_tier_default_cache_min_read_recency_for_promote, OPT_INT) // number of recent HitSets the object must appear in to be promoted (on read)
-OPTION(osd_tier_default_cache_min_write_recency_for_promote, OPT_INT) // number of recent HitSets the object must appear in to be promoted (on write)
-OPTION(osd_tier_default_cache_hit_set_grade_decay_rate, OPT_INT)
-OPTION(osd_tier_default_cache_hit_set_search_last_n, OPT_INT)
 OPTION(osd_objecter_finishers, OPT_INT)
 
 OPTION(osd_map_dedup, OPT_BOOL)
index a973ba0fe0c06fd29ea6aaa6c2789de2d456bc63..22f749f79291098d28a4b072eec15f67af94c42f 100644 (file)
@@ -1503,7 +1503,7 @@ std::vector<Option> get_global_options() {
     .set_default(1000)
     .set_description(""),
 
-    Option("mon_max_pool_pg_num", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("mon_max_pool_pg_num", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(65536)
     .set_description(""),
 
@@ -1715,7 +1715,8 @@ std::vector<Option> get_global_options() {
 
     Option("osd_pool_erasure_code_stripe_unit", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(4_K)
-    .set_description(""),
+    .set_description("the amount of data (in bytes) in a data chunk, per stripe")
+    .add_service("mon"),
 
     Option("osd_pool_default_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(3)
@@ -1743,7 +1744,8 @@ std::vector<Option> get_global_options() {
     Option("osd_pool_default_type", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("replicated")
     .set_enum_allowed({"replicated", "erasure"})
-    .set_description(""),
+    .set_description("")
+    .add_service("mon"),
 
     Option("osd_pool_default_erasure_code_profile", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("plugin=jerasure technique=reed_sol_van k=2 m=1")
@@ -1783,7 +1785,8 @@ std::vector<Option> get_global_options() {
 
     Option("osd_pool_default_hit_set_bloom_fpp", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(.05)
-    .set_description(""),
+    .set_description("")
+    .add_see_also("osd_tier_default_cache_hit_set_type"),
 
     Option("osd_pool_default_cache_target_dirty_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(.4)
@@ -1831,33 +1834,36 @@ std::vector<Option> get_global_options() {
 
     Option("osd_tier_default_cache_mode", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("writeback")
+    .set_enum_allowed({"none", "writeback", "forward",
+                      "readonly", "readforward", "readproxy", "proxy"})
     .set_description(""),
 
-    Option("osd_tier_default_cache_hit_set_count", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_hit_set_count", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(4)
     .set_description(""),
 
-    Option("osd_tier_default_cache_hit_set_period", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_hit_set_period", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1200)
     .set_description(""),
 
     Option("osd_tier_default_cache_hit_set_type", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("bloom")
+    .set_enum_allowed({"bloom", "explicit_hash", "explicit_object"})
     .set_description(""),
 
-    Option("osd_tier_default_cache_min_read_recency_for_promote", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_min_read_recency_for_promote", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1)
-    .set_description(""),
+    .set_description("number of recent HitSets the object must appear in to be promoted (on read)"),
 
-    Option("osd_tier_default_cache_min_write_recency_for_promote", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_min_write_recency_for_promote", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1)
-    .set_description(""),
+    .set_description("number of recent HitSets the object must appear in to be promoted (on write)"),
 
-    Option("osd_tier_default_cache_hit_set_grade_decay_rate", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_hit_set_grade_decay_rate", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(20)
     .set_description(""),
 
-    Option("osd_tier_default_cache_hit_set_search_last_n", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("osd_tier_default_cache_hit_set_search_last_n", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1)
     .set_description(""),
 
index 608a2e4b9ff11fe659522831b3218b073e56dd19..e0ae54c8289c76c9d0d45a9c38b2f9b3f9157224 100644 (file)
@@ -5300,7 +5300,7 @@ int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type,
       if (err)
        break;
       uint32_t data_chunks = erasure_code->get_data_chunk_count();
-      uint32_t stripe_unit = g_conf->osd_pool_erasure_code_stripe_unit;
+      uint32_t stripe_unit = g_conf->get_val<uint64_t>("osd_pool_erasure_code_stripe_unit");
       auto it = profile.find("stripe_unit");
       if (it != profile.end()) {
        string err_str;
@@ -5471,9 +5471,9 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid,
     pg_num = g_conf->get_val<uint64_t>("osd_pool_default_pg_num");
   if (pgp_num == 0)
     pgp_num = g_conf->get_val<uint64_t>("osd_pool_default_pgp_num");
-  if (pg_num > (unsigned)g_conf->mon_max_pool_pg_num) {
+  if (pg_num > g_conf->get_val<uint64_t>("mon_max_pool_pg_num")) {
     *ss << "'pg_num' must be greater than 0 and less than or equal to "
-        << g_conf->mon_max_pool_pg_num
+        << g_conf->get_val<uint64_t>("mon_max_pool_pg_num")
         << " (you may adjust 'mon max pool pg num' for higher values)";
     return -ERANGE;
   }
@@ -5761,9 +5761,9 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
        return -EEXIST;
       return 0;
     }
-    if (n > (unsigned)g_conf->mon_max_pool_pg_num) {
+    if (static_cast<uint64_t>(n) > g_conf->get_val<uint64_t>("mon_max_pool_pg_num")) {
       ss << "'pg_num' must be greater than 0 and less than or equal to "
-         << g_conf->mon_max_pool_pg_num
+         << g_conf->get_val<uint64_t>("mon_max_pool_pg_num")
          << " (you may adjust 'mon max pool pg num' for higher values)";
       return -ERANGE;
     }
@@ -5864,7 +5864,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
        return err;
       if (val == "bloom") {
        BloomHitSet::Params *bsp = new BloomHitSet::Params;
-       bsp->set_fpp(g_conf->osd_pool_default_hit_set_bloom_fpp);
+       bsp->set_fpp(g_conf->get_val<double>("osd_pool_default_hit_set_bloom_fpp"));
        p.hit_set_params = HitSet::Params(bsp);
       } else if (val == "explicit_hash")
        p.hit_set_params = HitSet::Params(new ExplicitHashHitSet::Params);
@@ -10530,7 +10530,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       err = -ENOTEMPTY;
       goto reply;
     }
-    string modestr = g_conf->osd_tier_default_cache_mode;
+    auto& modestr = g_conf->get_val<string>("osd_tier_default_cache_mode");
     pg_pool_t::cache_mode_t mode = pg_pool_t::get_cache_mode_from_str(modestr);
     if (mode < 0) {
       ss << "osd tier cache default mode '" << modestr << "' is not a valid cache mode";
@@ -10538,18 +10538,19 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       goto reply;
     }
     HitSet::Params hsp;
-    if (g_conf->osd_tier_default_cache_hit_set_type == "bloom") {
+    auto& cache_hit_set_type =
+      g_conf->get_val<string>("osd_tier_default_cache_hit_set_type");
+    if (cache_hit_set_type == "bloom") {
       BloomHitSet::Params *bsp = new BloomHitSet::Params;
-      bsp->set_fpp(g_conf->osd_pool_default_hit_set_bloom_fpp);
+      bsp->set_fpp(g_conf->get_val<double>("osd_pool_default_hit_set_bloom_fpp"));
       hsp = HitSet::Params(bsp);
-    } else if (g_conf->osd_tier_default_cache_hit_set_type == "explicit_hash") {
+    } else if (cache_hit_set_type == "explicit_hash") {
       hsp = HitSet::Params(new ExplicitHashHitSet::Params);
-    }
-    else if (g_conf->osd_tier_default_cache_hit_set_type == "explicit_object") {
+    } else if (cache_hit_set_type == "explicit_object") {
       hsp = HitSet::Params(new ExplicitObjectHitSet::Params);
     } else {
-      ss << "osd tier cache default hit set type '" <<
-       g_conf->osd_tier_default_cache_hit_set_type << "' is not a known type";
+      ss << "osd tier cache default hit set type '"
+        << cache_hit_set_type << "' is not a known type";
       err = -EINVAL;
       goto reply;
     }
@@ -10567,12 +10568,12 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     ntp->set_last_force_op_resend(pending_inc.epoch);
     ntp->tier_of = pool_id;
     ntp->cache_mode = mode;
-    ntp->hit_set_count = g_conf->osd_tier_default_cache_hit_set_count;
-    ntp->hit_set_period = g_conf->osd_tier_default_cache_hit_set_period;
-    ntp->min_read_recency_for_promote = g_conf->osd_tier_default_cache_min_read_recency_for_promote;
-    ntp->min_write_recency_for_promote = g_conf->osd_tier_default_cache_min_write_recency_for_promote;
-    ntp->hit_set_grade_decay_rate = g_conf->osd_tier_default_cache_hit_set_grade_decay_rate;
-    ntp->hit_set_search_last_n = g_conf->osd_tier_default_cache_hit_set_search_last_n;
+    ntp->hit_set_count = g_conf->get_val<uint64_t>("osd_tier_default_cache_hit_set_count");
+    ntp->hit_set_period = g_conf->get_val<uint64_t>("osd_tier_default_cache_hit_set_period");
+    ntp->min_read_recency_for_promote = g_conf->get_val<uint64_t>("osd_tier_default_cache_min_read_recency_for_promote");
+    ntp->min_write_recency_for_promote = g_conf->get_val<uint64_t>("osd_tier_default_cache_min_write_recency_for_promote");
+    ntp->hit_set_grade_decay_rate = g_conf->get_val<uint64_t>("osd_tier_default_cache_hit_set_grade_decay_rate");
+    ntp->hit_set_search_last_n = g_conf->get_val<uint64_t>("osd_tier_default_cache_hit_set_search_last_n");
     ntp->hit_set_params = hsp;
     ntp->target_max_bytes = size;
     ss << "pool '" << tierpoolstr << "' is now (or already was) a cache tier of '" << poolstr << "'";
index 72747a5a60bae069eece6afe2e774ce0d32e6bab..936ca5572755c8b31c4f20bc53a79c11e282ee27 100644 (file)
@@ -615,7 +615,7 @@ TEST(ErasureCodeLrc, encode_decode)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf->osd_pool_erasure_code_stripe_unit;
+  unsigned int chunk_size = g_conf->get_val<uint64_t>("osd_pool_erasure_code_stripe_unit");
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   set<int> want_to_encode;
@@ -745,7 +745,7 @@ TEST(ErasureCodeLrc, encode_decode_2)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf->osd_pool_erasure_code_stripe_unit;
+  unsigned int chunk_size = g_conf->get_val<uint64_t>("osd_pool_erasure_code_stripe_unit");
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   set<int> want_to_encode;