From e0e36f2a99cd729c519489ecfc21323997536ffc Mon Sep 17 00:00:00 2001 From: vbadrina Date: Thu, 19 Dec 2024 12:53:40 +0530 Subject: [PATCH] Unset CephBlockPool mirroring if Mirroring spec is nil on SC Signed-off-by: vbadrina --- controllers/storagecluster/cephblockpools.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/controllers/storagecluster/cephblockpools.go b/controllers/storagecluster/cephblockpools.go index 6cd0ea92ef..c88f9151db 100644 --- a/controllers/storagecluster/cephblockpools.go +++ b/controllers/storagecluster/cephblockpools.go @@ -257,12 +257,19 @@ func (o *ocsCephBlockPools) reconcileNonResilientCephBlockPool(r *StorageCluster } cephBlockPool.Spec.PoolSpec.EnableRBDStats = true - if storageCluster.Spec.Mirroring != nil { - if storageCluster.Spec.Mirroring.Enabled { + deploymentType, ok := storageCluster.Annotations["ocs.openshift.io/deployment-mode"] + if !ok { + return fmt.Errorf("deployment mode annotation not found") + } + + // Since provider mode handles mirroring, we only need to handle for converged mode + if deploymentType != "provider" { + if storageCluster.Spec.Mirroring != nil && storageCluster.Spec.Mirroring.Enabled { cephBlockPool.Spec.PoolSpec.Mirroring.Enabled = true cephBlockPool.Spec.PoolSpec.Mirroring.Mode = "image" cephBlockPool.Spec.PoolSpec.Mirroring.Peers = o.addPeerSecretsToCephBlockPool(r, storageCluster, cephBlockPool.Name, cephBlockPool.Namespace) } else { + // If mirroring is not enabled or is nil, disable it. This is to ensure that the pool mirroring does not remain enabled during further reconciliations cephBlockPool.Spec.PoolSpec.Mirroring = cephv1.MirroringSpec{Enabled: false} } }