OSDMonitor: require --allow-experimental-feature to increase pg_num

Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2012-11-20 12:16:44 -08:00
parent fb738506f6
commit 338f3688b0

View File

@ -2696,7 +2696,7 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
return true;
}
} else if (m->cmd[2] == "set") {
if (m->cmd.size() != 6) {
if (m->cmd.size() < 6) {
err = -EINVAL;
ss << "usage: osd pool set <poolname> <field> <value>";
goto out;
@ -2740,7 +2740,12 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
return true;
} else if (m->cmd[4] == "pg_num") {
if (n <= p->get_pg_num()) {
if (m->cmd.size() < 6 ||
m->cmd[6] != "--allow-experimental-feature") {
ss << "increasing pg_num is currently experimental, add "
<< "--allow-experimental-feature as the last argument "
<< "to force";
} else if (n <= p->get_pg_num()) {
ss << "specified pg_num " << n << " <= current " << p->get_pg_num();
} else if (!mon->pgmon()->pg_map.creating_pgs.empty()) {
ss << "currently creating pgs, wait";