Skip to content

Commit

Permalink
Allow specifying poolSpec parameters for non-resilient cephBlockPools
Browse files Browse the repository at this point in the history
This change enables configuring the parameters of the non-resilient
cephBlockPools through the StorageCluster CR.
The parameters is passed directly to the pool's poolSpec, with
only necessary fields validated. Other fields remain untouched.

Signed-off-by: Malay Kumar Parida <[email protected]>
  • Loading branch information
malayparida2000 committed Feb 26, 2025
1 parent b8a7cb7 commit 0d4d6f3
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions controllers/storagecluster/cephblockpools.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,25 @@ func (o *ocsCephBlockPools) reconcileNonResilientCephBlockPool(r *StorageCluster
}

_, err = ctrl.CreateOrUpdate(r.ctx, r.Client, cephBlockPool, func() error {
cephBlockPool.Spec.PoolSpec.DeviceClass = failureDomainValue
cephBlockPool.Spec.PoolSpec.EnableCrushUpdates = true
cephBlockPool.Spec.PoolSpec.FailureDomain = getFailureDomain(storageCluster)
cephBlockPool.Spec.PoolSpec.Parameters = map[string]string{
"pg_num": "16",
"pgp_num": "16",
poolSpec := &cephBlockPool.Spec.PoolSpec
poolSpec.DeviceClass = failureDomainValue
poolSpec.EnableCrushUpdates = true
poolSpec.FailureDomain = getFailureDomain(storageCluster)
poolSpec.Parameters = storageCluster.Spec.ManagedResources.CephNonResilientPools.Parameters
if poolSpec.Parameters == nil {
poolSpec.Parameters = make(map[string]string)
}
cephBlockPool.Spec.PoolSpec.Replicated = cephv1.ReplicatedSpec{
if _, ok := poolSpec.Parameters["pg_num"]; !ok {
poolSpec.Parameters["pg_num"] = "16"
}
if _, ok := poolSpec.Parameters["pgp_num"]; !ok {
poolSpec.Parameters["pgp_num"] = "16"
}
poolSpec.Replicated = cephv1.ReplicatedSpec{
Size: 1,
RequireSafeReplicaSize: false,
}
cephBlockPool.Spec.PoolSpec.EnableRBDStats = true
poolSpec.EnableRBDStats = true

// Since provider mode handles mirroring, we only need to handle for internal mode
if storageCluster.Annotations["ocs.openshift.io/deployment-mode"] != "provider" {
Expand Down

0 comments on commit 0d4d6f3

Please sign in to comment.