From bdc998ef4c6c5967e1e807584dac2f6d69bc5a5a Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Mon, 17 Dec 2012 18:58:16 +0000 Subject: [PATCH] mon: OSDMonitor: add option 'mon_max_pool_pg_num' and limit 'pg_num' accordingly Instead of having a hardcoded default, use a configurable one. It is limited to 65536 until future testing guarantees there is no side-effects of increasing it past this value, but by being adjustable the user still has the freedom to specify whatever maximum value he wants. Signed-off-by: Joao Eduardo Luis --- src/common/config_opts.h | 1 + src/mon/OSDMonitor.cc | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index bd5b733bd64ef..6bc4b1facbf40 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -163,6 +163,7 @@ OPTION(auth_service_ticket_ttl, OPT_DOUBLE, 60*60) OPTION(mon_client_hunt_interval, OPT_DOUBLE, 3.0) // try new mon every N seconds until we connect OPTION(mon_client_ping_interval, OPT_DOUBLE, 10.0) // ping every N seconds OPTION(mon_client_max_log_entries_per_message, OPT_INT, 1000) +OPTION(mon_max_pool_pg_num, OPT_INT, 65536) OPTION(client_cache_size, OPT_INT, 16384) OPTION(client_cache_mid, OPT_FLOAT, .75) OPTION(client_use_random_mds, OPT_BOOL, false) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e893655dab68c..5c8b08e43a20b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2624,10 +2624,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m) int pg_num = 0; int pgp_num = 0; - /* Don't allow over 65535 pgs in a single pool */ pg_num = parse_pos_long(m->cmd[4].c_str(), &ss); - if ((pg_num == 0) || (pg_num > 65535)) { - ss << "'pg_num' must be greater than 0 and lower or equal than 65535"; + if ((pg_num == 0) || (pg_num > 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)"; err = -ERANGE; goto out; } -- 2.39.5