]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: set a configurable max osd cap
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 26 Jul 2012 20:14:40 +0000 (13:14 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Thu, 26 Jul 2012 22:26:32 +0000 (15:26 -0700)
Don't allow setting a higher osd num through the
ceph control util.

Fixes: #2752
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc

index 43e726decb5f846ea64af5740b471a64b4c218ad..8ae36732a2340500fd2445de4255fefdbd9358a2 100644 (file)
@@ -125,6 +125,7 @@ OPTION(mon_force_standby_active, OPT_BOOL, true) // should mons force standby-re
 OPTION(mon_min_osdmap_epochs, OPT_INT, 500)
 OPTION(mon_max_pgmap_epochs, OPT_INT, 500)
 OPTION(mon_max_log_epochs, OPT_INT, 500)
+OPTION(mon_max_osd, OPT_INT, 10000)
 OPTION(mon_probe_timeout, OPT_DOUBLE, 2.0)
 OPTION(mon_slurp_timeout, OPT_DOUBLE, 10.0)
 OPTION(mon_slurp_bytes, OPT_INT, 256*1024)    // limit size of slurp messages
index f0b008f9686fe156c0a46a264b48a276cafec0d5..6dbb35ecce94e2b714469964efc22562e8c8bce1 100644 (file)
@@ -1975,6 +1975,12 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
           << osdmap.crush->get_max_devices();
        goto out;
       }
+      if (newmax > g_conf->mon_max_osd) {
+       err = -ERANGE;
+       ss << "cannot set max_osd to " << newmax << " which is > conf.mon_max_osd ("
+           << g_conf->mon_max_osd << ")";
+       goto out;
+      }
 
       pending_inc.new_max_osd = newmax;
       ss << "set new max_osd = " << pending_inc.new_max_osd;