Feature #10742
openInitial pg_num choice is static, different from other default setting
0%
Description
OSDMap::build_simple tries to do a num_osds << pg_bits calculation to scale the number of PGs with the number of OSDs. However, this gets called when the OSDMonitor is initialized the first time, i.e. when there are 0 OSDs.
The result is that the initial RBD pool is always created with 1 << pg_bits PGs. This makes the pg_bits setting redundant with respect to the osd_pool_default_pg_num setting. That default is also only used when creating pools via an MPoolOp rather than with the usual CLI (where pg_num is mandatory from the user).
This is all rather confusing...
The simplest thing would probably be to retire the pg_bits setting in favour of osd_pool_default_pg_num, to make the whole situation simpler and make the static-ness of the default RBD pg count more explicit.
It would also make sense to avoid creating the RBD pool initially (we can never know the right PG default until the OSDs are populated), but that would require some more work to make sure everything (like health) looked sane/sensible in a system with zero PGs.