From 1556ed9b33753ab86f2b0d6a9ba8e914b8ecc3c6 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Fri, 19 Apr 2024 09:04:47 -0600 Subject: [PATCH] osd: legacy osds on lvm pvcs crash on resize init container OSDs on LVM-mode PVCs are failing to come up and crashing in the expand-bluefs init container. To avoid the crash and allow the OSDs to start, a workaround was found to simply remove that init container. Now we disable the OSD resize for this case to avoid others hitting this during upgrade as well. Signed-off-by: Travis Nielsen (cherry picked from commit acd7b4faa05330c66636c9f034c156c184a20deb) (cherry picked from commit d0fbec4b8d62b948986586b90fb96a3ab96fe893) --- pkg/operator/ceph/cluster/osd/spec.go | 3 ++- pkg/operator/ceph/cluster/osd/spec_test.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index 7f96c8ea2120..df0528fcf623 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -580,8 +580,9 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo, provisionC initContainers = append(initContainers, c.getExpandEncryptedPVCInitContainer(osdDataDirPath, osdProps)) } initContainers = append(initContainers, c.getActivatePVCInitContainer(osdProps, osdID)) + // The expand init container fails for legacy LVM-based OSDs, so only supported expansion for raw mode OSDs + initContainers = append(initContainers, c.getExpandPVCInitContainer(osdProps, osdID)) } - initContainers = append(initContainers, c.getExpandPVCInitContainer(osdProps, osdID)) } else { // Add the volume to the spec and the mount to the daemon container // so that it can pick the already mounted/activated osd metadata path diff --git a/pkg/operator/ceph/cluster/osd/spec_test.go b/pkg/operator/ceph/cluster/osd/spec_test.go index 2361c673dd30..6532d7c853fd 100644 --- a/pkg/operator/ceph/cluster/osd/spec_test.go +++ b/pkg/operator/ceph/cluster/osd/spec_test.go @@ -198,12 +198,11 @@ func testPodDevices(t *testing.T, dataDir, deviceName string, allDevices bool) { deployment, err = c.makeDeployment(osdProp, osd, dataPathMap) assert.Nil(t, err) assert.NotNil(t, deployment) - assert.Equal(t, 5, len(deployment.Spec.Template.Spec.InitContainers), deployment.Spec.Template.Spec.InitContainers[2].Name) + assert.Equal(t, 4, len(deployment.Spec.Template.Spec.InitContainers), deployment.Spec.Template.Spec.InitContainers[2].Name) assert.Equal(t, "config-init", deployment.Spec.Template.Spec.InitContainers[0].Name) assert.Equal(t, "copy-bins", deployment.Spec.Template.Spec.InitContainers[1].Name) assert.Equal(t, "blkdevmapper", deployment.Spec.Template.Spec.InitContainers[2].Name) - assert.Equal(t, "expand-bluefs", deployment.Spec.Template.Spec.InitContainers[3].Name) - assert.Equal(t, "chown-container-data-dir", deployment.Spec.Template.Spec.InitContainers[4].Name) + assert.Equal(t, "chown-container-data-dir", deployment.Spec.Template.Spec.InitContainers[3].Name) assert.Equal(t, 1, len(deployment.Spec.Template.Spec.Containers)) initCont = deployment.Spec.Template.Spec.InitContainers[0] assert.Equal(t, 5, len(initCont.VolumeMounts), initCont.VolumeMounts)