]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: allow unsafe setting of config values
authorSage Weil <sage@inktank.com>
Mon, 31 Mar 2014 22:36:26 +0000 (15:36 -0700)
committerSage Weil <sage@redhat.com>
Wed, 30 Jul 2014 04:21:33 +0000 (21:21 -0700)
Allow callers to set config values even when there is no observer.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config.cc
src/common/config.h

index 0e28a83b0a44cfcc82b1a1f6d47a8151674ff551..dcb84b5f70fc617d7833ac7e324fe2ee99845652 100644 (file)
@@ -661,7 +661,7 @@ void md_config_t::set_val_or_die(const char *key, const char *val)
   assert(ret == 0);
 }
 
-int md_config_t::set_val(const char *key, const char *val, bool meta)
+int md_config_t::set_val(const char *key, const char *val, bool meta, bool safe)
 {
   Mutex::Locker l(lock);
   if (!key)
@@ -698,7 +698,7 @@ int md_config_t::set_val(const char *key, const char *val, bool meta)
   for (int i = 0; i < NUM_CONFIG_OPTIONS; ++i) {
     config_option *opt = &config_optionsp[i];
     if (strcmp(opt->name, k.c_str()) == 0) {
-      if (internal_safe_to_start_threads) {
+      if (safe && internal_safe_to_start_threads) {
        // If threads have been started...
        if ((opt->type == OPT_STR) || (opt->type == OPT_ADDR) ||
            (opt->type == OPT_UUID)) {
index 242b467247c1bdefac464d1d6dbb5d5408e135fb..99115430931c15442897b178ada1e48b4574f7ad 100644 (file)
@@ -130,7 +130,10 @@ public:
 
   // Set a configuration value.
   // Metavariables will be expanded.
-  int set_val(const char *key, const char *val, bool meta=true);
+  int set_val(const char *key, const char *val, bool meta=true, bool safe=true);
+  int set_val(const char *key, const string& s, bool meta=true, bool safe=true) {
+    return set_val(key, s.c_str(), meta, safe);
+  }
 
   // Get a configuration value.
   // No metavariables will be returned (they will have already been expanded)