From 065d12b826f7d2129bf9dcae1dbb60d84779fba4 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 26 Sep 2019 07:54:07 +0000 Subject: [PATCH] common: allow running without config If `--no-config-file` is specified, allow the caller to ignore the requirements to find a config file. This presumes that the caller either doesn't need to be configured, or that whatever it may need is provided via the cli. Signed-off-by: Joao Eduardo Luis --- doc/man/8/ceph-mon.rst | 5 +++++ src/common/ceph_argparse.cc | 3 +++ src/common/ceph_argparse.h | 1 + src/common/common_init.cc | 2 ++ src/common/options.cc | 12 ++++++++++++ src/global/global_init.cc | 7 ++++++- 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/man/8/ceph-mon.rst b/doc/man/8/ceph-mon.rst index 0c2c57925e55..aeb6a38fc059 100644 --- a/doc/man/8/ceph-mon.rst +++ b/doc/man/8/ceph-mon.rst @@ -77,6 +77,11 @@ Options Specify a keyring for use with ``--mkfs``. +.. option:: --no-config-file + + Signal that we don't want to rely on a *ceph.conf*, either user provided + or the default, to run the daemon. This will entail providing all + necessary options to the daemon as arguments. Availability ============ diff --git a/src/common/ceph_argparse.cc b/src/common/ceph_argparse.cc index 818f8d076751..662ed296a1e0 100644 --- a/src/common/ceph_argparse.cc +++ b/src/common/ceph_argparse.cc @@ -504,6 +504,9 @@ 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-config-file", (char*)NULL)) { + iparams.no_config_file = 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 214b3dfb6727..1c5370a31504 100644 --- a/src/common/ceph_argparse.h +++ b/src/common/ceph_argparse.h @@ -37,6 +37,7 @@ public: uint32_t module_type; EntityName name; + bool no_config_file = false; }; /////////////////////// Functions /////////////////////// diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 40b2d31092fb..2ad93a958c48 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -64,6 +64,8 @@ CephContext *common_preinit(const CephInitParameters &iparams, conf.set_val_default("log_flush_on_exit", "false"); } + conf.set_val("no_config_file", iparams.no_config_file ? "true" : "false"); + return cct; } #endif // #ifndef WITH_SEASTAR diff --git a/src/common/options.cc b/src/common/options.cc index a2958da725aa..bc92192b52cf 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -441,6 +441,18 @@ std::vector