]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: create compat weight-set earlier 28251/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 27 May 2019 06:46:48 +0000 (14:46 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 27 May 2019 06:46:48 +0000 (14:46 +0800)
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 <xie.xingguo@zte.com.cn>
src/pybind/mgr/balancer/module.py

index a548604babca4ab861109f73dbf73c813acacc5f..80692929c2b071d5608b738dadb51e8d0a3d1e0e 100644 (file)
@@ -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':