]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
OSDMonitor: check mon_max_pool_pg_num when set pool pg_num
authorchenhg <mesfet@126.com>
Sun, 23 Jul 2017 09:21:26 +0000 (17:21 +0800)
committerchenhg <mesfet@126.com>
Mon, 24 Jul 2017 10:36:30 +0000 (18:36 +0800)
Check the mon_max_pool_pg_num when creating pools, but did not

check in the the modification. So we can create a pool and then

modify pg_num exceeds the mon_max_pool_pg_num limit.

By following these steps can verify this problem

step 1: set  mon_max_pool_pg_num = 65536

step 2: ceph osd pool create testpool 65536 65536

step 3: ceph osd pool set testpool pg_num 65537

Signed-off-by: chenhg <c744402859@gmail.com>
src/mon/OSDMonitor.cc

index 82fd1cfae43821482eb561911a97642d61fe92fb..c61ce5d4c53b101008fe64645e2789a06caaac98 100644 (file)
@@ -6008,6 +6008,12 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
        return -EEXIST;
       return 0;
     }
+    if (n > (unsigned)g_conf->mon_max_pool_pg_num) {
+      ss << "'pg_num' must be greater than 0 and less than or equal to "
+         << g_conf->mon_max_pool_pg_num
+         << " (you may adjust 'mon max pool pg num' for higher values)";
+      return -ERANGE;
+    }
     string force;
     cmd_getval(g_ceph_context,cmdmap, "force", force);
     if (p.cache_mode != pg_pool_t::CACHEMODE_NONE &&