From c7356c66b0b0bb1a8a6197f84b26e6db0d192f60 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 --- qa/suites/rados/thrash/d-balancer/upmap.yaml | 1 + src/pybind/mgr/balancer/module.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/qa/suites/rados/thrash/d-balancer/upmap.yaml b/qa/suites/rados/thrash/d-balancer/upmap.yaml index 417544a52c5..788eebeeddd 100644 --- a/qa/suites/rados/thrash/d-balancer/upmap.yaml +++ b/qa/suites/rados/thrash/d-balancer/upmap.yaml @@ -2,5 +2,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 076a064b4a9..bbc5d015a6d 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -374,6 +374,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_module_option('mode', command['mode']) return (0, '', '') elif command['prefix'] == 'balancer on': -- 2.39.5