diff options
author | Sage Weil <sage@inktank.com> | 2013-06-07 17:03:41 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-18 14:28:02 -0700 |
commit | 2df3619169d2e83617fc3005b68de395e982b39a (patch) | |
tree | 8f19e487af78fa4b6b129b48503c3cc46426d04d | |
parent | eace9987c19f4da5cc89ca84abec5e54035b4887 (diff) | |
download | ceph-2df3619169d2e83617fc3005b68de395e982b39a.tar.gz |
global: create /var/run/ceph on daemon startup
This handles cases where the daemon is started without the benefit of
sysvinit or upstart (as with teuthology or ceph-fuse).
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 654299108bfb11e7dce45f54946d1505f71d2de8)
-rw-r--r-- | src/common/config_opts.h | 3 | ||||
-rw-r--r-- | src/global/global_init.cc | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h index d7684a4ba29..1eff739c01b 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -23,7 +23,8 @@ OPTION(num_client, OPT_INT, 1) OPTION(monmap, OPT_STR, "") OPTION(mon_host, OPT_STR, "") OPTION(lockdep, OPT_BOOL, false) -OPTION(admin_socket, OPT_STR, "/var/run/ceph/$cluster-$name.asok") // default changed by common_preinit() +OPTION(run_dir, OPT_STR, "/var/run/ceph") // the "/var/run/ceph" dir, created on daemon startup +OPTION(admin_socket, OPT_STR, "run_dir/$cluster-$name.asok") // default changed by common_preinit() OPTION(daemonize, OPT_BOOL, false) // default changed by common_preinit() OPTION(pid_file, OPT_STR, "") // default changed by common_preinit() diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 91733f5968b..f10a4fc07b8 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -119,6 +119,15 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const if (g_conf->log_flush_on_exit) g_ceph_context->_log->set_flush_on_exit(); + if (g_conf->run_dir.length() && + code_env == CODE_ENVIRONMENT_DAEMON) { + int r = ::mkdir(g_conf->run_dir.c_str(), 0755); + if (r < 0 && errno != EEXIST) { + r = -errno; + derr << "warning: unable to create " << g_conf->run_dir << ": " << cpp_strerror(r) << dendl; + } + } + if (g_lockdep) { dout(1) << "lockdep is enabled" << dendl; lockdep_register_ceph_context(cct); |