Skip to content

Commit

Permalink
Merge pull request ceph#1567 from ceph/wip-7849
Browse files Browse the repository at this point in the history
ceph-conf: don't create log files

Reviewed-by: Josh Durgin <[email protected]>
  • Loading branch information
jdurgin committed Mar 31, 2014
2 parents d474332 + fc1a424 commit 880e6ea
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
23 changes: 16 additions & 7 deletions src/global/global_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ static const char* c_str_or_null(const std::string &str)
return str.c_str();
}

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)
void global_pre_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.
assert(!g_ceph_context);
Expand Down Expand Up @@ -104,10 +106,17 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const
// Expand metavariables. Invoke configuration observers.
conf->apply_changes(NULL);

g_lockdep = cct->_conf->lockdep;

// Now we're ready to complain about config file parse errors
complain_about_parse_errors(cct, &parse_errors);
}

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)
{
global_pre_init(alt_def_args, args, module_type, code_env, flags);

g_lockdep = g_ceph_context->_conf->lockdep;

// signal stuff
int siglist[] = { SIGPIPE, 0 };
Expand All @@ -131,13 +140,13 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const

if (g_lockdep) {
dout(1) << "lockdep is enabled" << dendl;
lockdep_register_ceph_context(cct);
lockdep_register_ceph_context(g_ceph_context);
}
register_assert_context(cct);
register_assert_context(g_ceph_context);

// call all observers now. this has the side-effect of configuring
// and opening the log file immediately.
conf->call_all_observers();
g_conf->call_all_observers();

if (code_env == CODE_ENVIRONMENT_DAEMON && !(flags & CINIT_FLAG_NO_DAEMON_ACTIONS))
output_ceph_version();
Expand Down
12 changes: 10 additions & 2 deletions src/global/global_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ 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 * > *alt_def_args, std::vector < const char* >& args,
uint32_t module_type, code_environment_t code_env, int flags);
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);

// just the first half; enough to get config parsed but doesn't start up the
// cct or log.
void global_pre_init(std::vector < const char * > *alt_def_args,
std::vector < const char* >& args,
uint32_t module_type, code_environment_t code_env,
int flags);

/*
* perform all of the steps that global_init_daemonize performs just prior
Expand Down
4 changes: 2 additions & 2 deletions src/tools/ceph_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ int main(int argc, const char **argv)
env_to_vec(args);
vector<const char*> orig_args = args;

global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_NO_DAEMON_ACTIONS);
global_pre_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_NO_DAEMON_ACTIONS);

// 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
Expand Down

0 comments on commit 880e6ea

Please sign in to comment.