From: Sage Weil Date: Thu, 4 May 2017 18:35:45 +0000 (-0500) Subject: mon/OSDMonitor: 'osd set-require-min-compat-client ...' X-Git-Tag: v12.0.3~50^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f08de01c58d4b278ac5f29bd7380d12f15158249;p=ceph.git mon/OSDMonitor: 'osd set-require-min-compat-client ...' Signed-off-by: Sage Weil --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 7f539a544985..92a8db1f3c54 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -394,6 +394,7 @@ function test_tiering() # make sure we can't create an ec pool tier ceph osd pool create eccache 2 2 erasure + expect_false ceph osd set-require-min-compat-client bobtail ceph osd pool create repbase 2 expect_false ceph osd tier add repbase eccache ceph osd pool delete repbase repbase --yes-i-really-really-mean-it @@ -1132,6 +1133,12 @@ function test_mon_osd() ceph osd crush set-tunable straw_calc_version 1 ceph osd crush get-tunable straw_calc_version | grep 1 + # + # require-min-compat-client + expect_false ceph osd set-require-min-compat-client dumpling # firefly tunables + ceph osd set-require-min-compat-client luminous + ceph osd dump | grep 'require_min_compat_client luminous' + # # osd scrub # diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 5857db47a4a8..5c364537a35d 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -603,6 +603,10 @@ COMMAND("osd set-nearfull-ratio " \ "name=ratio,type=CephFloat,range=0.0|1.0", \ "set usage ratio at which OSDs are marked near-full", "osd", "rw", "cli,rest") +COMMAND("osd set-require-min-compat-client " \ + "name=version,type=CephString", + "set the minimum client version we will maintain compatibility with", + "osd", "rw", "cli,rest") COMMAND("osd pause", "pause osd", "osd", "rw", "cli,rest") COMMAND("osd unpause", "unpause osd", "osd", "rw", "cli,rest") COMMAND("osd erasure-code-profile set " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index cc803e8e063f..c28ab3df1077 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -7288,6 +7288,39 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs, get_last_committed() + 1)); return true; + } else if (prefix == "osd set-require-min-compat-client") { + if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) { + ss << "you must complete the upgrade and set require_luminous_osds before" + << " using the new interface"; + err = -EPERM; + goto reply; + } + 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") { + 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; + err = -EPERM; + goto reply; + } + ss << "set require_min_compat_client to " << v; + pending_inc.new_require_min_compat_client = v; + getline(ss, rs); + wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs, + get_last_committed() + 1)); + return true; } else if (prefix == "osd pause") { return prepare_set_flag(op, CEPH_OSDMAP_PAUSERD | CEPH_OSDMAP_PAUSEWR);