]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/config: parse --no-mon-config into md_config_t, not CephInitParameters
authorSage Weil <sage@redhat.com>
Wed, 31 Jan 2018 22:36:07 +0000 (16:36 -0600)
committerSage Weil <sage@redhat.com>
Tue, 6 Mar 2018 20:44:50 +0000 (14:44 -0600)
We want to accept this in $CEPH_ARGS, which makes md_config_t a better
place to keep it.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/ceph_argparse.cc
src/common/ceph_argparse.h
src/common/config.cc
src/common/config.h
src/global/global_init.cc

index 5f86a002cc3bcba452bbf5de345e6b4d70c805d6..a89de95f6e405fb2988e8dc8918128efaa02e184 100644 (file)
@@ -484,9 +484,6 @@ CephInitParameters ceph_argparse_early_args
     else if (ceph_argparse_witharg(args, i, &val, "--conf", "-c", (char*)NULL)) {
       *conf_file_list = val;
     }
-    else if (ceph_argparse_flag(args, i, "--no-mon-config", (char*)NULL)) {
-      iparams.no_mon_config = true;
-    }
     else if (ceph_argparse_witharg(args, i, &val, "--cluster", (char*)NULL)) {
       *cluster = val;
     }
index ba9462acfc17ecb469d71f0424f17841fe2cb739..900b18f31a797134d544bbfc580a6298a8d1d6cb 100644 (file)
@@ -37,8 +37,6 @@ public:
 
   uint32_t module_type;
   EntityName name;
-
-  bool no_mon_config = false;
 };
 
 /////////////////////// Functions ///////////////////////
index 1bbcfb463e173eda367cb774d01a2534601de646..3227e2133de9aef22f0e7386959e46928cf891c0 100644 (file)
@@ -559,6 +559,9 @@ int md_config_t::parse_argv(std::vector<const char*>& args, int level)
     else if (ceph_argparse_witharg(args, i, &val, "--show_config_value", (char*)NULL)) {
       do_show_config_value = val;
     }
+    else if (ceph_argparse_flag(args, i, "--no-mon-config", (char*)NULL)) {
+      no_mon_config = true;
+    }
     else if (ceph_argparse_flag(args, i, "--foreground", "-f", (char*)NULL)) {
       set_val_or_die("daemonize", "false");
     }
index 684d7113daa8b93d0ad566f9b5d21d18c2490a46..390efa1ae58442cf088372b30108eb59ef3310a0 100644 (file)
@@ -327,6 +327,8 @@ public:
   /// cluster name
   string cluster;
 
+  bool no_mon_config = false;
+
 // This macro block defines C members of the md_config_t struct
 // corresponding to the definitions in legacy_config_opts.h.
 // These C members are consumed by code that was written before
index e81023e50f36fca1e9bf51c852bb8ed957bc6535..dac8421a02707f6670f388188a0204fb1fbe0842 100644 (file)
@@ -93,16 +93,17 @@ void global_pre_init(
   CephInitParameters iparams = ceph_argparse_early_args(
     args, module_type,
     &cluster, &conf_file_list);
-  if (flags & (CINIT_FLAG_NO_DEFAULT_CONFIG_FILE|
-              CINIT_FLAG_NO_MON_CONFIG)) {
-    iparams.no_mon_config = true;
-  }
 
   CephContext *cct = common_preinit(iparams, code_env, flags);
   cct->_conf->cluster = cluster;
   global_init_set_globals(cct);
   md_config_t *conf = cct->_conf;
 
+  if (flags & (CINIT_FLAG_NO_DEFAULT_CONFIG_FILE|
+              CINIT_FLAG_NO_MON_CONFIG)) {
+    conf->no_mon_config = true;
+  }
+
   // alternate defaults
   if (defaults) {
     for (auto& i : *defaults) {
@@ -140,7 +141,7 @@ void global_pre_init(
   // command line (as passed by caller)
   conf->parse_argv(args);
 
-  if (!iparams.no_mon_config) {
+  if (!conf->no_mon_config) {
     MonClient mc_bootstrap(g_ceph_context);
     if (mc_bootstrap.get_monmap_and_config() < 0) {
       derr << "failed to fetch mon config (--no-mon-config to skip)" << dendl;