From: Sage Weil Date: Wed, 31 Jan 2018 22:36:07 +0000 (-0600) Subject: common/config: parse --no-mon-config into md_config_t, not CephInitParameters X-Git-Tag: v13.0.2~78^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7849c0be81eb9117169736bb8275923450707e3;p=ceph.git 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 --- diff --git a/src/common/ceph_argparse.cc b/src/common/ceph_argparse.cc index 5f86a002cc3..a89de95f6e4 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 ba9462acfc1..900b18f31a7 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 1bbcfb463e1..3227e2133de 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 684d7113daa..390efa1ae58 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 e81023e50f3..dac8421a027 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;