uint8_t v = 5;
uint8_t min_v = 1;
if (!crush_loc.empty()) {
- min_v = 5;
+ // we added crush_loc in version 5, but need to let old clients decode it
+ // so just leave the min_v at version 4. Monitors are protected
+ // from misunderstandings about location because setting it is blocked
+ // on FEATURE_PINGING
+ min_v = 4;
}
if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) {
v = 2;
return;
}
- uint8_t new_compat_v = 0;
ENCODE_START(9, 6, blist);
ceph::encode_raw(fsid, blist);
encode(epoch, blist);
encode(stretch_mode_enabled, blist);
encode(tiebreaker_mon, blist);
encode(stretch_marked_down_mons, blist);
- if (stretch_mode_enabled) {
- new_compat_v = 9;
- }
- ENCODE_FINISH_NEW_COMPAT(blist, new_compat_v);
+ ENCODE_FINISH(blist);
}
void MonMap::decode(ceph::buffer::list::const_iterator& p)
map<string, string> loc;
cmd_getval(cmdmap, "location", locationvec);
CrushWrapper::parse_loc_map(locationvec, &loc);
+ if (locationvec.size() &&
+ !mon->get_quorum_mon_features().contains_all(
+ ceph::features::mon::FEATURE_PINGING)) {
+ err = -ENOTSUP;
+ ss << "Not all monitors support adding monitors with a location; please upgrade first!";
+ goto reply;
+ }
+ if (locationvec.size() && !loc.size()) {
+ ss << "We could not parse your input location to anything real; " << locationvec
+ << " turned into an empty map!";
+ err = -EINVAL;
+ goto reply;
+ }
dout(10) << "mon add setting location for " << name << " to " << loc << dendl;
err = 0;
propose = true;
} else if (prefix == "mon set_location") {
+ if (!mon->get_quorum_mon_features().contains_all(
+ ceph::features::mon::FEATURE_PINGING)) {
+ err = -ENOTSUP;
+ ss << "Not all monitors support monitor locations; please upgrade first!";
+ goto reply;
+ }
string name;
if (!cmd_getval(cmdmap, "name", name)) {
err = -EINVAL;