]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: implement new 'osd set-[near]full-ratio ...' commands
authorSage Weil <sage@redhat.com>
Thu, 23 Feb 2017 20:52:27 +0000 (15:52 -0500)
committerSage Weil <sage@redhat.com>
Mon, 6 Mar 2017 21:42:33 +0000 (16:42 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 3f2ba92d0c84098b4fa0350ec73e07cbe0166c89..cefb2102cfef90d1474dda20c9f556436aeb1f5e 100644 (file)
@@ -621,6 +621,14 @@ COMMAND("osd crush tree",
 COMMAND("osd setmaxosd " \
        "name=newmax,type=CephInt,range=0", \
        "set new maximum osd value", "osd", "rw", "cli,rest")
+COMMAND("osd set-full-ratio " \
+       "name=ratio,type=CephFloat,range=0.0|1.0", \
+       "set usage ratio at which OSDs are marked full",
+       "osd", "rw", "cli,rest")
+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 pause", "pause osd", "osd", "rw", "cli,rest")
 COMMAND("osd unpause", "unpause osd", "osd", "rw", "cli,rest")
 COMMAND("osd erasure-code-profile set " \
index f822bc0864b6c9ae8c3b1b3da47de4877f6d680c..1ef0dd9834cb2806fa8e82e9e91937a8ffe93f60 100644 (file)
@@ -6680,6 +6680,30 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
                                              get_last_committed() + 1));
     return true;
 
+  } else if (prefix == "osd set-full-ratio" ||
+             prefix == "osd set-nearfull-ratio") {
+    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;
+    }
+    double n;
+    if (!cmd_getval(g_ceph_context, cmdmap, "ratio", n)) {
+      ss << "unable to parse 'ratio' value '"
+         << cmd_vartype_stringify(cmdmap["who"]) << "'";
+      err = -EINVAL;
+      goto reply;
+    }
+    if (prefix == "osd set-full-ratio")
+      pending_inc.new_full_ratio = n;
+    else if (prefix == "osd set-nearfull-ratio")
+      pending_inc.new_nearfull_ratio = n;
+    ss << prefix << " " << n;
+    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);