From: Sage Weil Date: Thu, 23 Feb 2017 20:52:27 +0000 (-0500) Subject: mon/OSDMonitor: implement new 'osd set-[near]full-ratio ...' commands X-Git-Tag: v12.0.1~145^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6422e0a220fb3f32ccae50e0c7e52dc9984685c6;p=ceph-ci.git mon/OSDMonitor: implement new 'osd set-[near]full-ratio ...' commands Signed-off-by: Sage Weil --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 3f2ba92d0c8..cefb2102cfe 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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 " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index f822bc0864b..1ef0dd9834c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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);