]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: 'osd set-require-min-compat-client ...'
authorSage Weil <sage@redhat.com>
Thu, 4 May 2017 18:35:45 +0000 (13:35 -0500)
committerSage Weil <sage@redhat.com>
Tue, 9 May 2017 16:32:56 +0000 (11:32 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 7f539a544985d16d3ba68c49740bb1b0f1319f40..92a8db1f3c54f16ec9bcc644e965677c7635a905 100755 (executable)
@@ -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
   #
index 5857db47a4a872f9bce3adf4ae7051403a735a53..5c364537a35dc8be6406c573795da7e22e345df3 100644 (file)
@@ -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 " \
index cc803e8e063f7a449a71a480b2299f8775ba0c1a..c28ab3df10774898bfb4bff5100cbc74cad4e56f 100644 (file)
@@ -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);