From 0d5dc37c9d189d27dd3aa20f693f27347ddef587 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 10 Apr 2018 11:16:42 -0500 Subject: [PATCH] mon/OSDMonitor: adjust pgp_num_target down along with pg_num_target as needed If the user asks to reduce pg_num, reduce pg_num_target too at the same time. Don't completely hide pgp_num yet (by increasing it when pg_num_target increases). Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ce47155e78e5f..6773a79203dac 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -6935,14 +6935,13 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "nautilus OSDs are required to adjust pg_num_pending"; return -EPERM; } - if (n < (int)p.get_pgp_num_target()) { - ss << "specified pg_num " << n - << " < pgp_num " << p.get_pgp_num_target(); - return -EINVAL; - } } // set target; mgr will adjust pg_num_actual later p.set_pg_num_target(n); + // adjust pgp_num_target down too (as needed) + if (p.get_pgp_num_target() > n) { + p.set_pgp_num_target(n); + } } else if (var == "pgp_num_actual") { if (p.has_flag(pg_pool_t::FLAG_NOPGCHANGE)) { ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first"; -- 2.39.5