mon: new 'osd require-osd-release' command

Note that we only allow setting this to 'luminous'.  If the 'jewel' or 'kraken'
flags need to be set that can be done through the legacy interface.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-05-12 11:31:41 -04:00
parent 3d4c4d9d9d
commit 0b517992e0
2 changed files with 32 additions and 0 deletions

View File

@ -637,6 +637,10 @@ COMMAND("osd set " \
COMMAND("osd unset " \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent", \
"unset <key>", "osd", "rw", "cli,rest")
COMMAND("osd require-osd-release "\
"name=release,type=CephChoices,strings=luminous",
"set the minimum allowed OSD release to participate in the cluster",
"osd", "rw", "cli,rest")
COMMAND("osd cluster_snap", "take cluster snapshot (disabled)", \
"osd", "r", "")
COMMAND("osd down " \

View File

@ -7597,6 +7597,34 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
err = -EINVAL;
}
} else if (prefix == "osd require-osd-release") {
string release;
cmd_getval(g_ceph_context, cmdmap, "release", release);
if (!osdmap.test_flag(CEPH_OSDMAP_SORTBITWISE)) {
ss << "the sortbitwise flag must be set first";
err = -EPERM;
goto reply;
}
int rel = -1;
if (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;
goto reply;
}
if (rel < osdmap.require_osd_release) {
ss << "require_osd_release cannot be lowered once it has been set";
err = -EPERM;
goto reply;
}
pending_inc.new_require_osd_release = rel;
goto update;
} else if (prefix == "osd cluster_snap") {
// ** DISABLE THIS FOR NOW **
ss << "cluster snapshot currently disabled (broken implementation)";