From c4c7b151ac59f84985d50a8e8853dae4a59025ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 8 Jan 2021 16:08:42 +0100 Subject: [PATCH 1/2] ceph: add pacific release name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the version is detected it will print the name of the release Pacific correctly where previously it was showing ". Signed-off-by: Sébastien Han --- pkg/operator/ceph/version/version.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/operator/ceph/version/version.go b/pkg/operator/ceph/version/version.go index 7b684f7a9..ceb1d0836 100644 --- a/pkg/operator/ceph/version/version.go +++ b/pkg/operator/ceph/version/version.go @@ -80,10 +80,12 @@ func (v *CephVersion) CephVersionFormatted() string { // ReleaseName is the name of the Ceph release func (v *CephVersion) ReleaseName() string { switch v.Major { - case Octopus.Major: - return "octopus" case Nautilus.Major: return "nautilus" + case Octopus.Major: + return "octopus" + case Pacific.Major: + return "pacific" default: return unknownVersionString } From 362637ec3d50716b66716061df9bdf9ee33cf520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 8 Jan 2021 15:22:44 +0100 Subject: [PATCH 2/2] ceph: do not explicitly turn on the balancer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of Pacific the balancer is now on by default in upmap mode. In earlier versions, the balancer was included in the `always_on_modules` list, but needed to be turned on explicitly using the ``ceph balancer on command. Signed-off-by: Sébastien Han --- pkg/daemon/ceph/client/mgr.go | 8 +++++++- pkg/daemon/ceph/client/mgr_test.go | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/ceph/client/mgr.go b/pkg/daemon/ceph/client/mgr.go index abf3d3a16..69de60dc7 100755 --- a/pkg/daemon/ceph/client/mgr.go +++ b/pkg/daemon/ceph/client/mgr.go @@ -34,7 +34,13 @@ func MgrEnableModule(context *clusterd.Context, clusterInfo *ClusterInfo, name s retryCount := 5 var err error for i := 0; i < retryCount; i++ { - if name == "balancer" { + /* In Pacific the balancer is now on by default in upmap mode. + In earlier versions, the balancer was included in the ``always_on_modules`` list, but needed to be + turned on explicitly using the ``ceph balancer on`` command. */ + if name == "balancer" && clusterInfo.CephVersion.IsAtLeastPacific() { + logger.Debug("balancer module is already 'on' on pacific, doing nothing", name) + return nil + } else if name == "balancer" { err = enableDisableBalancerModule(context, clusterInfo, "on") } else { err = enableModule(context, clusterInfo, name, force, "enable") diff --git a/pkg/daemon/ceph/client/mgr_test.go b/pkg/daemon/ceph/client/mgr_test.go index 3571f3433..dae058ee6 100644 --- a/pkg/daemon/ceph/client/mgr_test.go +++ b/pkg/daemon/ceph/client/mgr_test.go @@ -21,6 +21,7 @@ import ( "github.com/pkg/errors" "github.com/rook/rook/pkg/clusterd" + "github.com/rook/rook/pkg/operator/ceph/version" exectest "github.com/rook/rook/pkg/util/exec/test" "github.com/stretchr/testify/assert" ) @@ -59,10 +60,16 @@ func TestEnableModuleRetries(t *testing.T) { _ = MgrEnableModule(&clusterd.Context{Executor: executor}, clusterInfo, "pg_autoscaler", false) assert.Equal(t, 0, moduleEnableRetries) + // Balancer not on Ceph Pacific moduleEnableRetries = 0 _ = MgrEnableModule(&clusterd.Context{Executor: executor}, clusterInfo, "balancer", false) assert.Equal(t, 0, moduleEnableRetries) + // Balancer skipped on Pacific + clusterInfo.CephVersion = version.Pacific + _ = MgrEnableModule(&clusterd.Context{Executor: executor}, clusterInfo, "balancer", false) + assert.Equal(t, 0, moduleEnableRetries) + } func TestEnableModule(t *testing.T) {