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 <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-04-10 11:16:42 -05:00
parent 1a08a41266
commit 0d5dc37c9d

View File

@ -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";