OSDMonitor: check mon_max_pool_pg_num when set pool pg_num

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>
This commit is contained in:
chenhg 2017-07-23 17:21:26 +08:00
parent 17c1a8f74a
commit 5dd3dff0f6

View 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 &&