if (newmap.backfillfull_ratio > 1.0) newmap.backfillfull_ratio /= 100;
newmap.nearfull_ratio = g_conf->mon_osd_nearfull_ratio;
if (newmap.nearfull_ratio > 1.0) newmap.nearfull_ratio /= 100;
- newmap.require_min_compat_client = g_conf->mon_osd_initial_require_min_compat_client;
+ int r = ceph_release_from_name(
+ g_conf->mon_osd_initial_require_min_compat_client.c_str());
+ if (r <= 0) {
+ assert(0 == "mon_osd_initial_require_min_compat_client is not valid");
+ }
+ newmap.require_min_compat_client = r;
}
// encode into pending incremental
}
// min_compat_client?
- if (tmp.require_min_compat_client.empty()) {
+ if (tmp.require_min_compat_client == 0) {
auto mv = tmp.get_min_compat_client();
- dout(1) << __func__ << " setting require_min_compat_client to current " << mv
- << dendl;
- mon->clog->info() << "setting require_min_compat_client to currently required "
- << mv;
- pending_inc.new_require_min_compat_client = mv.first;
+ dout(1) << __func__ << " setting require_min_compat_client to currently "
+ << "required " << ceph_release_name(mv) << dendl;
+ mon->clog->info() << "setting require_min_compat_client to currently "
+ << "required " << ceph_release_name(mv);
+ pending_inc.new_require_min_compat_client = mv;
}
}
}
newmap.apply_incremental(new_pending);
// client compat
- if (newmap.require_min_compat_client.length()) {
+ if (newmap.require_min_compat_client > 0) {
auto mv = newmap.get_min_compat_client();
- if (mv.first > newmap.require_min_compat_client) {
- ss << "new crush map requires client version " << mv
+ if (mv > newmap.require_min_compat_client) {
+ ss << "new crush map requires client version " << ceph_release_name(mv)
<< " but require_min_compat_client is "
- << newmap.require_min_compat_client;
+ << ceph_release_name(newmap.require_min_compat_client);
return false;
}
}
}
string v;
cmd_getval(g_ceph_context, cmdmap, "version", v);
- if (v != "luminous" && v != "kraken" && v != "jewel" && v != "infernalis" &&
- v != "hammer" && v != "giant" && v != "firefly" && v != "emperor" &&
- v != "dumpling" && v != "cuttlefish" && v != "bobtail" && v != "argonaut") {
+ int vno = ceph_release_from_name(v.c_str());
+ if (vno <= 0) {
ss << "version " << v << " is not recognized";
err = -EINVAL;
goto reply;
OSDMap newmap;
newmap.deepish_copy_from(osdmap);
newmap.apply_incremental(pending_inc);
- newmap.require_min_compat_client = v;
- auto mv = newmap.get_min_compat_client();
- if (v < mv.first) {
- ss << "osdmap current utilizes features that require " << mv
- << "; cannot set require_min_compat_client below that to " << v;
+ newmap.require_min_compat_client = vno;
+ auto mvno = newmap.get_min_compat_client();
+ if (vno < mvno) {
+ ss << "osdmap current utilizes features that require "
+ << ceph_release_name(mvno)
+ << "; cannot set require_min_compat_client below that to "
+ << ceph_release_name(vno);
err = -EPERM;
goto reply;
}
- ss << "set require_min_compat_client to " << v;
- pending_inc.new_require_min_compat_client = v;
+ ss << "set require_min_compat_client to " << ceph_release_name(vno);
+ pending_inc.new_require_min_compat_client = vno;
getline(ss, rs);
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs,
get_last_committed() + 1));
err = -EPERM;
goto reply;
}
- int rel = -1;
- if (release == "luminous") {
+ int rel = ceph_release_from_name(release.c_str());
+ if (rel <= 0) {
+ ss << "unrecognized release " << release;
+ err = -EINVAL;
+ goto reply;
+ }
+ if (rel < CEPH_RELEASE_LUMINOUS) {
+ ss << "use this command only for luminous and later";
+ err = -EINVAL;
+ goto reply;
+ }
+ if (rel == CEPH_RELEASE_LUMINOUS) {
if (!HAVE_FEATURE(osdmap.get_up_osd_features(), SERVER_LUMINOUS)) {
ss << "not all up OSDs have CEPH_FEATURE_SERVER_LUMINOUS feature";
err = -EPERM;
goto reply;
}
- rel = CEPH_RELEASE_LUMINOUS;
} else {
- ss << "unrecognized release " << release;
- err = -EINVAL;
+ ss << "not supported for this release yet";
+ err = -EPERM;
goto reply;
}
if (rel < osdmap.require_osd_release) {
goto reply;
}
- if (osdmap.require_min_compat_client.length() &&
- osdmap.require_min_compat_client < "firefly") {
- ss << "require_min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client > 0 &&
+ osdmap.require_min_compat_client < CEPH_RELEASE_FIREFLY) {
+ ss << "require_min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < firefly, which is required for primary-temp";
err = -EPERM;
goto reply;
err = -EPERM;
goto reply;
}
- if (osdmap.require_min_compat_client < "luminous") {
- ss << "min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client < CEPH_RELEASE_LUMINOUS) {
+ ss << "min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < luminous, which is required for pg-upmap";
err = -EPERM;
goto reply;
err = -EPERM;
goto reply;
}
- if (osdmap.require_min_compat_client < "luminous") {
- ss << "require_min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client < CEPH_RELEASE_LUMINOUS) {
+ ss << "require_min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < luminous, which is required for pg-upmap";
err = -EPERM;
goto reply;
err = -EPERM;
goto reply;
}
- if (osdmap.require_min_compat_client < "luminous") {
- ss << "require_min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client < CEPH_RELEASE_LUMINOUS) {
+ ss << "require_min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < luminous, which is required for pg-upmap";
err = -EPERM;
goto reply;
err = -EPERM;
goto reply;
}
- if (osdmap.require_min_compat_client < "luminous") {
- ss << "require_min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client < CEPH_RELEASE_LUMINOUS) {
+ ss << "require_min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < luminous, which is required for pg-upmap";
err = -EPERM;
goto reply;
err = -EINVAL;
goto reply;
}
- if (osdmap.require_min_compat_client.length() &&
- osdmap.require_min_compat_client < "firefly") {
- ss << "require_min_compat_client " << osdmap.require_min_compat_client
+ if (osdmap.require_min_compat_client > 0 &&
+ osdmap.require_min_compat_client < CEPH_RELEASE_FIREFLY) {
+ ss << "require_min_compat_client "
+ << ceph_release_name(osdmap.require_min_compat_client)
<< " < firefly, which is required for primary-affinity";
err = -EPERM;
goto reply;
::encode(new_full_ratio, bl);
::encode(new_backfillfull_ratio, bl);
}
- if (target_v >= 5) {
- ::encode(new_require_min_compat_client, bl);
- }
+ // 5 was string-based new_require_min_compat_client
if (target_v >= 6) {
+ ::encode(new_require_min_compat_client, bl);
::encode(new_require_osd_release, bl);
}
ENCODE_FINISH(bl); // osd-only data
} else {
new_backfillfull_ratio = -1;
}
- if (struct_v >= 5) {
- ::decode(new_require_min_compat_client, bl);
+ if (struct_v == 5) {
+ string r;
+ ::decode(r, bl);
+ if (r.length()) {
+ new_require_min_compat_client = ceph_release_from_name(r.c_str());
+ }
}
if (struct_v >= 6) {
+ ::decode(new_require_min_compat_client, bl);
::decode(new_require_osd_release, bl);
} else {
if (new_flags >= 0 && (new_flags & CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
f->dump_float("new_full_ratio", new_full_ratio);
f->dump_float("new_nearfull_ratio", new_nearfull_ratio);
f->dump_float("new_backfillfull_ratio", new_backfillfull_ratio);
- f->dump_string("new_require_min_compat_client", new_require_min_compat_client);
+ f->dump_int("new_require_min_compat_client", new_require_min_compat_client);
f->dump_int("new_require_osd_release", new_require_osd_release);
if (fullmap.length()) {
return features;
}
-pair<string,string> OSDMap::get_min_compat_client() const
+uint8_t OSDMap::get_min_compat_client() const
{
uint64_t f = get_features(CEPH_ENTITY_TYPE_CLIENT, nullptr);
if (HAVE_FEATURE(f, OSDMAP_PG_UPMAP) || // v12.0.0-1733-g27d6f43
- HAVE_FEATURE(f, CRUSH_CHOOSE_ARGS)) { // v12.0.1-2172-gef1ef28
- return make_pair("luminous", "12.2.0");
+ HAVE_FEATURE(f, CRUSH_CHOOSE_ARGS)) { // v12.0.1-2172-gef1ef28
+ return CEPH_RELEASE_LUMINOUS; // v12.2.0
}
if (HAVE_FEATURE(f, CRUSH_TUNABLES5)) { // v10.0.0-612-g043a737
- return make_pair("jewel", "10.2.0");
+ return CEPH_RELEASE_JEWEL; // v10.2.0
}
if (HAVE_FEATURE(f, CRUSH_V4)) { // v0.91-678-g325fc56
- return make_pair("hammer", "0.94");
+ return CEPH_RELEASE_HAMMER; // v0.94.0
}
if (HAVE_FEATURE(f, OSD_PRIMARY_AFFINITY) || // v0.76-553-gf825624
HAVE_FEATURE(f, CRUSH_TUNABLES3) || // v0.76-395-ge20a55d
HAVE_FEATURE(f, OSD_ERASURE_CODES) || // v0.73-498-gbfc86a8
HAVE_FEATURE(f, OSD_CACHEPOOL)) { // v0.67-401-gb91c1c5
- return make_pair("firefly", "0.80");
+ return CEPH_RELEASE_FIREFLY; // v0.80.0
}
if (HAVE_FEATURE(f, CRUSH_TUNABLES2) || // v0.54-684-g0cc47ff
HAVE_FEATURE(f, OSDHASHPSPOOL)) { // v0.57-398-g8cc2b0f
- return make_pair("dumpling", "0.67");
+ return CEPH_RELEASE_DUMPLING; // v0.67.0
}
if (HAVE_FEATURE(f, CRUSH_TUNABLES)) { // v0.48argonaut-206-g6f381af
- return make_pair("argonaut", "0.48argonaut-207");
+ return CEPH_RELEASE_ARGONAUT; // v0.48argonaut-206-g6f381af
}
- return make_pair("argonaut", "0.48");
+ return CEPH_RELEASE_ARGONAUT; // v0.48argonaut-206-g6f381af
}
void OSDMap::_calc_up_osd_features()
if (inc.new_full_ratio >= 0) {
full_ratio = inc.new_full_ratio;
}
- if (inc.new_require_min_compat_client.length()) {
+ if (inc.new_require_min_compat_client > 0) {
require_min_compat_client = inc.new_require_min_compat_client;
}
if (inc.new_require_osd_release >= 0) {
::encode(full_ratio, bl);
::encode(backfillfull_ratio, bl);
}
- if (target_v >= 4) {
- ::encode(require_min_compat_client, bl);
- }
+ // 4 was string-based new_require_min_compat_client
if (target_v >= 5) {
+ ::encode(require_min_compat_client, bl);
::encode(require_osd_release, bl);
}
ENCODE_FINISH(bl); // osd-only data
} else {
backfillfull_ratio = 0;
}
- if (struct_v >= 4) {
- ::decode(require_min_compat_client, bl);
+ if (struct_v == 4) {
+ string r;
+ ::decode(r, bl);
+ if (r.length())
+ require_min_compat_client = ceph_release_from_name(r.c_str());
}
if (struct_v >= 5) {
+ ::decode(require_min_compat_client, bl);
::decode(require_osd_release, bl);
if (require_osd_release >= CEPH_RELEASE_LUMINOUS) {
flags &= ~(CEPH_OSDMAP_LEGACY_REQUIRE_FLAGS);
f->dump_string("cluster_snapshot", get_cluster_snapshot());
f->dump_int("pool_max", get_pool_max());
f->dump_int("max_osd", get_max_osd());
- f->dump_string("require_min_compat_client", require_min_compat_client);
- auto mv = get_min_compat_client();
- f->dump_string("min_compat_client", mv.first);
- f->dump_string("min_compat_client_version", mv.second);
- f->dump_int("require_osd_release", require_osd_release);
+ f->dump_string("require_min_compat_client",
+ ceph_release_name(require_min_compat_client));
+ f->dump_string("min_compat_client",
+ ceph_release_name(get_min_compat_client()));
f->dump_string("require_osd_release",
ceph_release_name(require_osd_release));
out << "full_ratio " << full_ratio << "\n";
out << "backfillfull_ratio " << backfillfull_ratio << "\n";
out << "nearfull_ratio " << nearfull_ratio << "\n";
- if (require_min_compat_client.length()) {
- out << "require_min_compat_client " << require_min_compat_client << "\n";
+ if (require_min_compat_client > 0) {
+ out << "require_min_compat_client "
+ << ceph_release_name(require_min_compat_client) << "\n";
}
- auto mv = get_min_compat_client();
- out << "min_compat_client " << mv.first << " " << mv.second << "\n";
+ out << "min_compat_client " << ceph_release_name(get_min_compat_client())
+ << "\n";
if (get_cluster_snapshot().length())
out << "cluster_snapshot " << get_cluster_snapshot() << "\n";
out << "\n";
float new_backfillfull_ratio = -1;
float new_full_ratio = -1;
- string new_require_min_compat_client;
+ int8_t new_require_min_compat_client = -1;
mutable bool have_crc; ///< crc values are defined
uint32_t full_crc; ///< crc of the resulting OSDMap
float full_ratio = 0, backfillfull_ratio = 0, nearfull_ratio = 0;
/// min compat client we want to support
- string require_min_compat_client;
+ uint8_t require_min_compat_client = 0; // CEPH_RELEASE_*
public:
/// require osds to run at least this release
- uint8_t require_osd_release = 0;
+ uint8_t require_osd_release = 0; // CEPH_RELEASE_*
private:
mutable uint64_t cached_up_osd_features;
* get oldest *client* version (firefly, hammer, etc.) that can connect given
* the feature bits required (according to get_features()).
*/
- pair<string,string> get_min_compat_client() const;
+ uint8_t get_min_compat_client() const;
/**
* get intersection of features supported by up osds