mon/OSDMointor: Simplify check_pg_num()
* See: https://tracker.ceph.com/issues/47062.
Originally check_pg_num did not take into account the root
osds by the crash rule.
This behavior resulted in an inaccurate pg num per osd count.
* Avoid summing all of the projecetd pg num and only later
on subtracting the pg num if the pool did exist.
* With this change, we only count the projected pg num which
are part the pools affected by the crush rule.
Same for osd number, instead of dividing the projected
pg number by all of the osdmap osds, divide only by
the osds used by the crush rule.
* Avoid differentiating between whether the mapping epoch
is later than the osdmap epoch or not. Always check the pg
num according to crush rule.
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit
c6e4c174cb9d906537d78ff3980930439ace86da)
*****
Note: The following commit has been squashed to comply with Q:
*****
mon/OSDMonitor: Replace set::contains with set::count
std::set::contains is available since C++20 and is replaced by
std::set::count instead (unlike the original commit).
Signed-off-by: Matan Breizman <mbreizma@redhat.com>