diff --git a/src/common/common_init.cc b/src/common/common_init.cc index eb80bbb3eaa..8b19e129a22 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -49,7 +49,7 @@ CephContext *common_preinit(const CephInitParameters &iparams, // Set some defaults based on code type switch (code_env) { case CODE_ENVIRONMENT_DAEMON: - conf->daemonize = true; + conf->set_val_or_die("daemonize", "true"); if (!(flags & CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS)) { conf->set_val_or_die("pid_file", "/var/run/ceph/$type.$id.pid"); conf->set_val_or_die("admin_socket", "/var/run/ceph/$name.asok"); diff --git a/src/common/config.h b/src/common/config.h index e946e951bae..08a6c6b31f5 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -158,14 +158,14 @@ private: public: EntityName name; #define OPTION_OPT_INT(name) const int name; -#define OPTION_OPT_LONGLONG(name) long long name; -#define OPTION_OPT_STR(name) std::string name; -#define OPTION_OPT_DOUBLE(name) double name; -#define OPTION_OPT_FLOAT(name) float name; -#define OPTION_OPT_BOOL(name) bool name; -#define OPTION_OPT_ADDR(name) entity_addr_t name; -#define OPTION_OPT_U32(name) uint32_t name; -#define OPTION_OPT_U64(name) uint64_t name; +#define OPTION_OPT_LONGLONG(name) const long long name; +#define OPTION_OPT_STR(name) const std::string name; +#define OPTION_OPT_DOUBLE(name) const double name; +#define OPTION_OPT_FLOAT(name) const float name; +#define OPTION_OPT_BOOL(name) const bool name; +#define OPTION_OPT_ADDR(name) const entity_addr_t name; +#define OPTION_OPT_U32(name) const uint32_t name; +#define OPTION_OPT_U64(name) const uint64_t name; #define OPTION(name, ty, init) OPTION_##ty(name) #include "common/config_opts.h" #undef OPTION_OPT_INT diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 046846e529b..004e5333c80 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -477,7 +477,8 @@ int MDS::init(int wanted_state) want_state = wanted_state; if (wanted_state==MDSMap::STATE_STANDBY_REPLAY || wanted_state==MDSMap::STATE_ONESHOT_REPLAY) { - g_conf->mds_standby_replay = true; + g_conf->set_val_or_die("mds_standby_replay", "true"); + g_conf->apply_changes(NULL); if ( wanted_state == MDSMap::STATE_ONESHOT_REPLAY && (g_conf->mds_standby_for_rank == -1) && g_conf->mds_standby_for_name.empty()) { diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3fb5584a880..7c2238f5a14 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -241,10 +241,17 @@ static int do_convertfs(ObjectStore *store) int OSD::convertfs(const std::string &dev, const std::string &jdev) { - g_ceph_context->_conf->filestore_update_collections = true; + // N.B. at some point we should rewrite this to avoid playing games with + // g_conf here + char buf[16] = { 0 }; + char *b = buf; + g_ceph_context->_conf->get_val("filestore_update_collections", &b, sizeof(buf)); + g_ceph_context->_conf->set_val_or_die("filestore_update_collections", "true"); + g_ceph_context->_conf->apply_changes(NULL); boost::scoped_ptr store(new FileStore(dev, jdev)); int r = do_convertfs(store.get()); - g_ceph_context->_conf->filestore_update_collections = false; + g_ceph_context->_conf->set_val_or_die("filestore_update_collections", buf); + g_ceph_context->_conf->apply_changes(NULL); return r; }