From 11cd731af1818081d5ec6780f642589232c4829f Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 27 May 2019 14:46:48 +0800 Subject: [PATCH] mgr/balancer: create compat weight-set earlier So if we do: ceph balancer mode crush-compat ceph balancer on ceph config set global osd_crush_update_weight_set false and then add some new osd in, those osds will truly start with a zeroed weight-set weight. Signed-off-by: xie xingguo (cherry picked from commit f73bd451ea2fe2ea692710c6874e18234feb992d) --- src/pybind/mgr/balancer/module.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index a548604babca4..80692929c2b07 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -426,6 +426,11 @@ class Module(MgrModule): 'Try "ceph osd set-require-min-compat-client luminous" ' \ 'before enabling this mode' % min_compat_client return (-errno.EPERM, '', warn) + elif command['mode'] == 'crush-compat': + ms = MappingState(self.get_osdmap(), + self.get("pg_dump"), + 'initialize compat weight-set') + self.get_compat_weight_set_weights(ms) # ignore error self.set_module_option('mode', command['mode']) return (0, '', '') elif command['prefix'] == 'balancer on': -- 2.39.5