]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/balancer/module.py
import ceph nautilus 14.2.2
[ceph.git] / ceph / src / pybind / mgr / balancer / module.py
index db8ea3c57c9d27dc6d5d0ff614fb5e4d20646a1d..7868cd2fbc174e3f48265944961c768d27962cb2 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':
@@ -1050,8 +1055,12 @@ class Module(MgrModule):
                         if actual[osd] > 0:
                             calc_weight = target[osd] / actual[osd] * weight * ow
                         else:
-                            # not enough to go on here... keep orig weight
-                            calc_weight = weight / orig_osd_weight[osd]
+                            # for newly created osds, reset calc_weight at target value
+                            # this way weight-set will end up absorbing *step* of its
+                            # target (final) value at the very beginning and slowly catch up later.
+                            # note that if this turns out causing too many misplaced
+                            # pgs, then we'll reduce step and retry
+                            calc_weight = target[osd]
                         new_weight = weight * (1.0 - step) + calc_weight * step
                         self.log.debug('Reweight osd.%d %f -> %f', osd, weight,
                                        new_weight)
@@ -1116,7 +1125,7 @@ class Module(MgrModule):
 
         # allow a small regression if we are phasing out osd weights
         fudge = 0
-        if next_ow != orig_osd_weight:
+        if best_ow != orig_osd_weight:
             fudge = .001
 
         if best_pe.score < pe.score + fudge: