From: Sage Weil Date: Fri, 12 May 2017 15:31:41 +0000 (-0400) Subject: mon: new 'osd require-osd-release' command X-Git-Tag: v12.1.0~57^2~6^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0b517992e00b1e020d48fe996badb9056205c688;p=ceph.git 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 --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 59bc608d5608..7469b223323f 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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 ", "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 " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 5e89b8f9b5af..fb25d5dbb441 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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)";