mirror of
https://github.com/ceph/ceph
synced 2024-12-17 08:57:28 +00:00
osdc/Objecter: maintain crush_location multimap
Observe and parse the 'crush location' config option. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
746069ee62
commit
ac14d4ffae
@ -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()
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user