Make g_conf constant for all conf variable types

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-09-14 15:25:28 -07:00
parent dd01df7612
commit 2981ccadb3
4 changed files with 20 additions and 12 deletions

View File

@ -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");

View File

@ -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

View File

@ -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()) {

View File

@ -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<ObjectStore> 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;
}