From d7849c0be81eb9117169736bb8275923450707e3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 31 Jan 2018 16:36:07 -0600 Subject: [PATCH] common/config: parse --no-mon-config into md_config_t, not CephInitParameters We want to accept this in $CEPH_ARGS, which makes md_config_t a better place to keep it. Signed-off-by: Sage Weil --- src/common/ceph_argparse.cc | 3 --- src/common/ceph_argparse.h | 2 -- src/common/config.cc | 3 +++ src/common/config.h | 2 ++ src/global/global_init.cc | 11 ++++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/common/ceph_argparse.cc b/src/common/ceph_argparse.cc index 5f86a002cc3bc..a89de95f6e405 100644 --- a/src/common/ceph_argparse.cc +++ b/src/common/ceph_argparse.cc @@ -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; } diff --git a/src/common/ceph_argparse.h b/src/common/ceph_argparse.h index ba9462acfc17e..900b18f31a797 100644 --- a/src/common/ceph_argparse.h +++ b/src/common/ceph_argparse.h @@ -37,8 +37,6 @@ public: uint32_t module_type; EntityName name; - - bool no_mon_config = false; }; /////////////////////// Functions /////////////////////// diff --git a/src/common/config.cc b/src/common/config.cc index 1bbcfb463e173..3227e2133de9a 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -559,6 +559,9 @@ int md_config_t::parse_argv(std::vector& 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"); } diff --git a/src/common/config.h b/src/common/config.h index 684d7113daa8b..390efa1ae5844 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -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 diff --git a/src/global/global_init.cc b/src/global/global_init.cc index e81023e50f36f..dac8421a02707 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -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; -- 2.39.5