Skip to content

Commit

Permalink
Unset CephBlockPool mirroring if Mirroring spec is nil on SC
Browse files Browse the repository at this point in the history
Signed-off-by: vbadrina <[email protected]>
  • Loading branch information
vbnrh committed Dec 19, 2024
1 parent d62b2a2 commit e0e36f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions controllers/storagecluster/cephblockpools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
}
Expand Down

0 comments on commit e0e36f2

Please sign in to comment.