diff options
33 files changed, 36 insertions, 33 deletions
diff --git a/src/ceph_authtool.cc b/src/ceph_authtool.cc index aa522736a45..d151e592382 100644 --- a/src/ceph_authtool.cc +++ b/src/ceph_authtool.cc @@ -68,7 +68,7 @@ int main(int argc, const char **argv) bool bin_keyring = false; std::string fn; - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); std::vector<const char*>::iterator i; for (i = args.begin(); i != args.end(); ) { diff --git a/src/ceph_conf.cc b/src/ceph_conf.cc index 1228b42765f..608c0852122 100644 --- a/src/ceph_conf.cc +++ b/src/ceph_conf.cc @@ -156,7 +156,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); // do not common_init_finish(); do not start threads; do not do any of thing // wonky things the daemon whose conf we are examining would do (like initialize diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index c37d0be37be..5697515755b 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -52,7 +52,7 @@ int main(int argc, const char **argv, const char *envp[]) { argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS); for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) { if (ceph_argparse_double_dash(args, i)) { diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc index 61e790183fb..a7bc00d1ded 100644 --- a/src/ceph_mds.cc +++ b/src/ceph_mds.cc @@ -146,7 +146,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_MDS, CODE_ENVIRONMENT_DAEMON, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_MDS, CODE_ENVIRONMENT_DAEMON, 0); // mds specific args int shadow = 0; diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 72e50c3d873..26898318342 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -72,7 +72,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_MON, CODE_ENVIRONMENT_DAEMON, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_MON, CODE_ENVIRONMENT_DAEMON, 0); uuid_d fsid; std::string val; diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index e883e6016de..7177b32fd2f 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -67,7 +67,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_OSD, CODE_ENVIRONMENT_DAEMON, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_OSD, CODE_ENVIRONMENT_DAEMON, 0); ceph_heap_profiler_init(); // osd specific args diff --git a/src/ceph_syn.cc b/src/ceph_syn.cc index 2d35b0d64f4..2535af60310 100644 --- a/src/ceph_syn.cc +++ b/src/ceph_syn.cc @@ -47,7 +47,7 @@ int main(int argc, const char **argv, char *envp[]) vector<const char*> args; argv_to_vec(argc, argv, args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); parse_syn_options(args); // for SyntheticClient diff --git a/src/crushtool.cc b/src/crushtool.cc index 0849b636a64..6b47bfbdaf2 100644 --- a/src/crushtool.cc +++ b/src/crushtool.cc @@ -115,7 +115,7 @@ int main(int argc, const char **argv) CrushTester tester(crush, cerr, 1); vector<const char *> empty_args; // we use -c, don't confuse the generic arg parsing - global_init(empty_args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + global_init(NULL, empty_args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); common_init_finish(g_ceph_context); diff --git a/src/dupstore.cc b/src/dupstore.cc index dbbd55107da..33269028342 100644 --- a/src/dupstore.cc +++ b/src/dupstore.cc @@ -87,7 +87,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); // args diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 376a05a1dba..b385680fa3b 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -56,7 +56,7 @@ static const char* c_str_or_null(const std::string &str) return str.c_str(); } -void global_init(std::vector < const char* >& args, +void global_init(std::vector < const char * > *alt_def_args, std::vector < const char* >& args, uint32_t module_type, code_environment_t code_env, int flags) { // You can only call global_init once. @@ -85,6 +85,9 @@ void global_init(std::vector < const char* >& args, _exit(1); } + if (alt_def_args) + conf->parse_argv(*alt_def_args); // alternative default args + conf->parse_env(); // environment variables override conf->parse_argv(args); // argv override diff --git a/src/global/global_init.h b/src/global/global_init.h index 6f3f2e5c3e6..cd8432bb791 100644 --- a/src/global/global_init.h +++ b/src/global/global_init.h @@ -30,7 +30,7 @@ class CephContext; * daemons and utility programs need to call. It takes care of a lot of * initialization, including setting up g_ceph_context. */ -void global_init(std::vector < const char* >& args, +void global_init(std::vector < const char * > *alt_def_args, std::vector < const char* >& args, uint32_t module_type, code_environment_t code_env, int flags); /* diff --git a/src/librados-config.cc b/src/librados-config.cc index 9fbef57a0c3..a0a064fd1d7 100644 --- a/src/librados-config.cc +++ b/src/librados-config.cc @@ -42,7 +42,7 @@ int main(int argc, const char **argv) bool opt_version = false; bool opt_vernum = false; - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); for (std::vector<const char*>::iterator i = args.begin(); diff --git a/src/monmaptool.cc b/src/monmaptool.cc index 08f99d8920a..0e8f859a52e 100644 --- a/src/monmaptool.cc +++ b/src/monmaptool.cc @@ -48,7 +48,7 @@ int main(int argc, const char **argv) map<string,entity_addr_t> add; list<string> rm; - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); common_init_finish(g_ceph_context); std::string val; diff --git a/src/osdmaptool.cc b/src/osdmaptool.cc index 6c8a74872c7..6dc62b46e54 100644 --- a/src/osdmaptool.cc +++ b/src/osdmaptool.cc @@ -45,7 +45,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); common_init_finish(g_ceph_context); diff --git a/src/rados.cc b/src/rados.cc index 6b8b411a63e..a3305741120 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -1299,7 +1299,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); std::map < std::string, std::string > opts; diff --git a/src/rbd.cc b/src/rbd.cc index 9fffbdf4528..48f13dd5b80 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -917,7 +917,7 @@ int main(int argc, const char **argv) env_to_vec(args); int opt_cmd = OPT_NO_CMD; - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); const char *poolname = NULL; diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 1d9629b371b..0c37ce88588 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -506,7 +506,7 @@ int main(int argc, char **argv) argv_to_vec(argc, (const char **)argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); std::string user_id, access_key, secret_key, user_email, display_name; diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 1d16cfb1acf..9729355bbea 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -340,7 +340,7 @@ int main(int argc, const char **argv) vector<const char*> args; argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON, CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS); pid_t childpid = 0; diff --git a/src/streamtest.cc b/src/streamtest.cc index be0863ce01a..21693ac8713 100644 --- a/src/streamtest.cc +++ b/src/streamtest.cc @@ -105,7 +105,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); // args diff --git a/src/test/ObjectMap/test_object_map.cc b/src/test/ObjectMap/test_object_map.cc index d888a84bf11..3c8ebd2b2d2 100644 --- a/src/test/ObjectMap/test_object_map.cc +++ b/src/test/ObjectMap/test_object_map.cc @@ -373,7 +373,7 @@ int main(int argc, char **argv) { vector<const char*> args; argv_to_vec(argc, (const char **)argv, args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/src/test/TestDoutStreambuf.cc b/src/test/TestDoutStreambuf.cc index 22d612b8a09..fa1693fe8d0 100644 --- a/src/test/TestDoutStreambuf.cc +++ b/src/test/TestDoutStreambuf.cc @@ -39,7 +39,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); DoutStreambuf<char> *dos = new DoutStreambuf<char>(); diff --git a/src/test/TestSignalHandlers.cc b/src/test/TestSignalHandlers.cc index 0e85f5148ab..f9ea6749dfe 100644 --- a/src/test/TestSignalHandlers.cc +++ b/src/test/TestSignalHandlers.cc @@ -71,7 +71,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); test_fn_t fn = NULL; diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc index 8ec059a55ad..6e6f47351e6 100644 --- a/src/test/TestTimers.cc +++ b/src/test/TestTimers.cc @@ -255,7 +255,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); int ret; diff --git a/src/test/store_test.cc b/src/test/store_test.cc index 095a46c8162..ea7926a9560 100644 --- a/src/test/store_test.cc +++ b/src/test/store_test.cc @@ -642,7 +642,7 @@ int main(int argc, char **argv) { vector<const char*> args; argv_to_vec(argc, (const char **)argv, args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); g_ceph_context->_conf->set_val("osd_journal_size", "400"); g_ceph_context->_conf->apply_changes(NULL); diff --git a/src/test/test_filejournal.cc b/src/test/test_filejournal.cc index 170a9cb9e3b..c3af26bc3e4 100644 --- a/src/test/test_filejournal.cc +++ b/src/test/test_filejournal.cc @@ -59,7 +59,7 @@ int main(int argc, char **argv) { vector<const char*> args; argv_to_vec(argc, (const char **)argv, args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); char mb[10]; diff --git a/src/test/test_filestore_idempotent.cc b/src/test/test_filestore_idempotent.cc index ad546da0bef..769419a6817 100644 --- a/src/test/test_filestore_idempotent.cc +++ b/src/test/test_filestore_idempotent.cc @@ -50,7 +50,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); // args diff --git a/src/test/test_mutate.cc b/src/test/test_mutate.cc index 2f83a28d18a..f2feda11d48 100644 --- a/src/test/test_mutate.cc +++ b/src/test/test_mutate.cc @@ -44,7 +44,7 @@ int main(int argc, const char **argv) vector<const char*> args; argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); string val; diff --git a/src/test/unit.h b/src/test/unit.h index 4072d698705..b1fb373ed43 100644 --- a/src/test/unit.h +++ b/src/test/unit.h @@ -33,7 +33,7 @@ */ int main(int argc, char **argv) { std::vector<const char*> args; - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); common_init_finish(g_ceph_context); ::testing::InitGoogleTest(&argc, argv); diff --git a/src/test_trans.cc b/src/test_trans.cc index 248bb943bba..170927c1408 100644 --- a/src/test_trans.cc +++ b/src/test_trans.cc @@ -36,7 +36,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); // args diff --git a/src/testkeys.cc b/src/testkeys.cc index 6d04305b089..239956be926 100644 --- a/src/testkeys.cc +++ b/src/testkeys.cc @@ -11,7 +11,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); KeyServer server(g_ceph_context); diff --git a/src/testmsgr.cc b/src/testmsgr.cc index a7a0d52a032..59ba977ecd5 100644 --- a/src/testmsgr.cc +++ b/src/testmsgr.cc @@ -76,7 +76,7 @@ int main(int argc, const char **argv, const char *envp[]) { argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); vec_to_argv(args, argc, argv); diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index 70a80b737f1..e01539d5a04 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -186,7 +186,7 @@ int main(int argc, const char **argv) env_to_vec(args); // initialize globals - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); // parse user input diff --git a/src/tools/gceph.cc b/src/tools/gceph.cc index 5270813dd90..e990695fe10 100644 --- a/src/tools/gceph.cc +++ b/src/tools/gceph.cc @@ -79,7 +79,7 @@ int main(int argc, const char **argv) argv_to_vec(argc, argv, args); env_to_vec(args); - global_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(g_ceph_context); parse_gceph_args(args); |