From 6daa02af259f05132119f2a42676f95d19c954e8 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 14 Jan 2019 14:39:18 +0800 Subject: [PATCH] mgr/balancer: blame if upmap won't actually work With automatic balancing on, and if mode is set to upmap, balancer will fail silently if min_compat_client is lower than luminous. You can't figure out that unless you take a closer look at the mgr log, which is super annoying.. Signed-off-by: xie xingguo (cherry picked from commit c7356c66b0b0bb1a8a6197f84b26e6db0d192f60) Conflicts: - path: qa/suites/rados/thrash/d-balancer/upmap.yaml comment: changeset here -> qa/suites/rados/thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml - path: src/pybind/mgr/balancer/module.py comment: 'set_module_option()' -> 'set_config()' for mgr config-key --- .../thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml | 1 + src/pybind/mgr/balancer/module.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/qa/suites/rados/thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml b/qa/suites/rados/thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml index a1e0afea065..a6a11c4dec0 100644 --- a/qa/suites/rados/thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml +++ b/qa/suites/rados/thrash/d-require-luminous/at-mkfs-balancer-upmap.yaml @@ -7,5 +7,6 @@ tasks: - exec: mon.a: - while ! ceph balancer status ; do sleep 1 ; done + - ceph osd set-require-min-compat-client luminous - ceph balancer mode upmap - ceph balancer on diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 75cdfe35ed8..18d8b55f07b 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -288,6 +288,14 @@ class Module(MgrModule): } return (0, json.dumps(s, indent=4), '') elif command['prefix'] == 'balancer mode': + if command['mode'] == 'upmap': + min_compat_client = self.get_osdmap().dump().get('require_min_compat_client', '') + if min_compat_client < 'luminous': # works well because version is alphabetized.. + warn = 'min_compat_client "%s" ' \ + '< "luminous", which is required for pg-upmap. ' \ + 'Try "ceph osd set-require-min-compat-client luminous" ' \ + 'before enabling this mode' % min_compat_client + return (-errno.EPERM, '', warn) self.set_config('mode', command['mode']) return (0, '', '') elif command['prefix'] == 'balancer on': -- 2.47.3