]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: maintain crush_location multimap
authorSage Weil <sage@inktank.com>
Mon, 23 Dec 2013 23:18:07 +0000 (15:18 -0800)
committerSage Weil <sage@inktank.com>
Tue, 24 Dec 2013 15:58:07 +0000 (07:58 -0800)
Observe and parse the 'crush location' config option.

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

index d6f3499c7a39c0244f051af918b35037b7e3a84a..09a508bc730cb43a123fffd5e854cdbb11df5514 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "common/config.h"
 #include "common/perf_counters.h"
+#include "include/str_list.h"
 
 
 #define dout_subsys ceph_subsys_objecter
@@ -127,6 +128,35 @@ enum {
 };
 
 
+// config obs ----------------------------
+
+static const char *config_keys[] = {
+  "crush_location",
+  NULL
+};
+
+const char** Objecter::get_tracked_conf_keys() const
+{
+  return config_keys;
+}
+
+
+void Objecter::handle_conf_change(const struct md_config_t *conf,
+                                 const std::set <std::string> &changed)
+{
+  if (changed.count("crush_location")) {
+    crush_location.clear();
+    vector<string> lvec;
+    get_str_vec(cct->_conf->crush_location, lvec);
+    int r = CrushWrapper::parse_loc_multimap(lvec, &crush_location);
+    if (r < 0) {
+      lderr(cct) << "warning: crush_location '" << cct->_conf->crush_location
+                << "' does not parse" << dendl;
+    }
+  }
+}
+
+
 // messages ------------------------------
 
 void Objecter::init_unlocked()
index 228a744b0cb95a8ae8903b9ea7ade656135fdf3e..6e218458aa0cb9f3dbdc49e703cf052033f9672a 100644 (file)
@@ -916,12 +916,19 @@ struct ObjectOperation {
 // ----------------
 
 
-class Objecter {
- public:  
+class Objecter : public md_config_obs_t {
+public:
+  // config observer bits
+  virtual const char** get_tracked_conf_keys() const;
+  virtual void handle_conf_change(const struct md_config_t *conf,
+                                 const std::set <std::string> &changed);
+
+public:
   Messenger *messenger;
   MonClient *monc;
   OSDMap    *osdmap;
   CephContext *cct;
+  std::multimap<string,string> crush_location;
 
   bool initialized;