]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/balancer: tolerate pgs outside of target weight map 34761/head
authorSage Weil <sage@redhat.com>
Tue, 17 Mar 2020 20:03:32 +0000 (15:03 -0500)
committerNathan Cutler <ncutler@suse.com>
Mon, 27 Apr 2020 08:58:53 +0000 (10:58 +0200)
commitab4b344c968b01fdbbef92ae24e08235c1f9648a
tree24921d2a72f87acdde8afc2fe6497462dfbe5fa7
parente44d481069270099eb30ebdc453ea37004e0d203
mgr/balancer: tolerate pgs outside of target weight map

We build a target weight map based on the primary crush weights, and
ignore weights that are 0.  However, it's possible that existing PGs are
on other OSDs that have weight 0 because the weight-set weight is >0.
That leads to a KeyError exception when we

                     pgs_by_osd[osd] += 1

and the key isn't present.  Fix by simply populating those keys as we
encounter OSDs.  Drop the old initialization loop.  The net of this is
we may have OSDs outside of target_by_root (won't matter, as far as I can
tell) and we won't have keys for osds with weight 0 (also won't matter,
as far as I can tell).

Fixes: https://tracker.ceph.com/issues/42721
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit c66e9acafd68215c42755067867c509247759bcb)
src/pybind/mgr/balancer/module.py