From: xie xingguo Date: Mon, 27 May 2019 06:46:48 +0000 (+0800) Subject: mgr/balancer: create compat weight-set earlier X-Git-Tag: v15.1.0~2609^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f73bd451ea2fe2ea692710c6874e18234feb992d;p=ceph.git 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 --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index a548604babca..80692929c2b0 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':