]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/ceph_context: add CrushLocation to cct
authorSage Weil <sage@redhat.com>
Tue, 29 Mar 2016 16:49:36 +0000 (12:49 -0400)
committerSage Weil <sage@redhat.com>
Mon, 9 May 2016 12:54:44 +0000 (08:54 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/ceph_context.cc
src/common/ceph_context.h

index c3ee8e686de0aa3691eebac05d1f836f53924b21..abf9f07e05bcae1f3a87eb84efccadad5b51cdc4 100644 (file)
@@ -239,6 +239,7 @@ public:
   const char** get_tracked_conf_keys() const {
     static const char *KEYS[] = {
       "enable_experimental_unrecoverable_data_corrupting_features",
+      "crush_location",
       NULL
     };
     return KEYS;
@@ -246,13 +247,20 @@ public:
 
   void handle_conf_change(const md_config_t *conf,
                           const std::set <std::string> &changed) {
-    ceph_spin_lock(&cct->_feature_lock);
-    get_str_set(conf->enable_experimental_unrecoverable_data_corrupting_features,
-               cct->_experimental_features);
-    ceph_spin_unlock(&cct->_feature_lock);
-    if (!cct->_experimental_features.empty())
-      lderr(cct) << "WARNING: the following dangerous and experimental features are enabled: "
-                << cct->_experimental_features << dendl;
+    if (changed.count(
+         "enable_experimental_unrecoverable_data_corrupting_features")) {
+      ceph_spin_lock(&cct->_feature_lock);
+      get_str_set(
+       conf->enable_experimental_unrecoverable_data_corrupting_features,
+       cct->_experimental_features);
+      ceph_spin_unlock(&cct->_feature_lock);
+      if (!cct->_experimental_features.empty())
+       lderr(cct) << "WARNING: the following dangerous and experimental features are enabled: "
+                  << cct->_experimental_features << dendl;
+    }
+    if (changed.count("crush_location")) {
+      cct->crush_location.update_from_conf();
+    }
   }
 };
 
@@ -459,6 +467,7 @@ CephContext::CephContext(uint32_t module_type_, int init_flags_)
     _crypto_aes(NULL),
     _plugin_registry(NULL),
     _lockdep_obs(NULL),
+    crush_location(this),
     _cct_perf(NULL)
 {
   ceph_spin_init(&_service_thread_lock);
index a455a0c8efdcb06a118f390aab0dfda5a194fa4c..86c1a4a736de806c9c4266367f7a6dcf5ff1aca1 100644 (file)
@@ -25,6 +25,7 @@
 #include "include/atomic.h"
 #include "common/cmdparse.h"
 #include "include/Spinlock.h"
+#include "crush/CrushLocation.h"
 #include <boost/noncopyable.hpp>
 
 class AdminSocket;
@@ -247,6 +248,10 @@ private:
 
   md_config_obs_t *_lockdep_obs;
 
+public:
+  CrushLocation crush_location;
+private:
+
   enum {
     l_cct_first,
     l_cct_total_workers,