]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Make g_conf constant for all conf variable types
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 14 Sep 2011 22:25:28 +0000 (15:25 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 14 Sep 2011 22:25:46 +0000 (15:25 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/common_init.cc
src/common/config.h
src/mds/MDS.cc
src/osd/OSD.cc

index eb80bbb3eaad96f52a9df940dd5b48202a08e384..8b19e129a223fa85625246efc8cbc08553ddc808 100644 (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");
index e946e951bae08a55182e849f1daeb006ad668d51..08a6c6b31f589194b22caf0313dbeeac03b56de5 100644 (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
index 046846e529beb9dc04aafd904c70ee7639662652..004e5333c80fbbfe12d6785365e600edf9c551ff 100644 (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()) {
index 3fb5584a880e2ae381de701322ee4042b716ebff..7c2238f5a1468c6450c9d3628055e5b320667833 100644 (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;
 }