From eedf93d29845321a15f27fd7e1ef2a7ed35113fb Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 3 Nov 2021 17:00:59 -0600 Subject: [PATCH] core: allow downgrade of all daemons consistently In the event a ceph image is specified that is lower than the current running version of the daemons, the downgrade is allowed, even if not technically supported. All of the core daemons (mon,mgr,osd) were being downgraded, but the daemons for other controllers (rgw,mds,rbdmirror) were not being downgraded, resulting in an inconsistent cluster. Now we log that the downgrade is not supported and all all of the daemons to be downgraded. Signed-off-by: Travis Nielsen (cherry picked from commit 0c6ed25c4e8c29a0c933a15c4dbb59614d310114) --- pkg/operator/ceph/cluster/version.go | 3 ++- pkg/operator/ceph/cluster/version_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/operator/ceph/cluster/version.go b/pkg/operator/ceph/cluster/version.go index 8e436d888e3c..b4df66b345a5 100644 --- a/pkg/operator/ceph/cluster/version.go +++ b/pkg/operator/ceph/cluster/version.go @@ -105,7 +105,8 @@ func diffImageSpecAndClusterRunningVersion(imageSpecVersion cephver.CephVersion, } if cephver.IsInferior(imageSpecVersion, clusterRunningVersion) { - return true, errors.Errorf("image spec version %s is lower than the running cluster version %s, downgrading is not supported", imageSpecVersion.String(), clusterRunningVersion.String()) + logger.Warningf("image spec version %s is lower than the running cluster version %s, downgrading is not supported", imageSpecVersion.String(), clusterRunningVersion.String()) + return true, nil } } } diff --git a/pkg/operator/ceph/cluster/version_test.go b/pkg/operator/ceph/cluster/version_test.go index 3e56461efd72..8a79a511ba19 100755 --- a/pkg/operator/ceph/cluster/version_test.go +++ b/pkg/operator/ceph/cluster/version_test.go @@ -74,8 +74,9 @@ func TestDiffImageSpecAndClusterRunningVersion(t *testing.T) { err = json.Unmarshal([]byte(fakeRunningVersions), &dummyRunningVersions3) assert.NoError(t, err) + // Allow the downgrade m, err = diffImageSpecAndClusterRunningVersion(fakeImageVersion, dummyRunningVersions3) - assert.Error(t, err) + assert.NoError(t, err) assert.True(t, m) // 4 test - spec version is higher than running cluster --> we upgrade