Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
feat: add basic erasure coded pool size check
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
  • Loading branch information
galexrt committed Feb 5, 2024
1 parent da99b65 commit e8cbd6f
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions pkg/recommender/modules/pool_sizes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,29 @@ func (m *PoolSizes) Run(ctx context.Context, p *Params) ([]*cephv1.ClusterRecomm
return nil, err
}
for _, bp := range blockPools.Items {
poolName := bp.Spec.Name
if poolName == "" {
poolName = bp.GetName()
}

if bp.Spec.IsErasureCoded() {
// TODO
if bp.Spec.ErasureCoded.CodingChunks < 2 || bp.Spec.ErasureCoded.DataChunks < 2 {
recs = append(recs, &cephv1.ClusterRecommendation{
Title: fmt.Sprintf("Pool - %s: Erasure coded chunks not recommended", poolName),
Description: "Erasure coded chunk coding/data chunks sizes not recommended, please see https://docs.ceph.com/en/latest/rados/operations/erasure-code/#erasure-code-profiles.",
Level: cephv1.RecommendationLevel_RECOMMENDATION_LEVEL_HIGH,
Type: cephv1.RecommendationType_RECOMMENDATION_TYPE_POOL,
ExtraData: &cephv1.ClusterRecommendation_RecommendedValue{
RecommendedValue: &cephv1.RecommendedValue{
Current: fmt.Sprintf("Coding chunks: %d, Data chunks: %d", bp.Spec.ErasureCoded.CodingChunks, bp.Spec.ErasureCoded.DataChunks),
Expected: "> 2",
},
},
})
}

} else if bp.Spec.IsReplicated() {
// TODO
if bp.Spec.Replicated.Size < 3 {
poolName := bp.Spec.Name
if poolName == "" {
poolName = bp.GetName()
}

recs = append(recs, &cephv1.ClusterRecommendation{
Title: fmt.Sprintf("Pool - %s: Replicated size less than 3", poolName),
Description: "Pool replicated size should be 3 or higher in production environments.",
Expand All @@ -57,7 +70,7 @@ func (m *PoolSizes) Run(ctx context.Context, p *Params) ([]*cephv1.ClusterRecomm
})
}
} else if bp.Spec.IsHybridStoragePool() {
// TODO
// TODO what to check for a hybrid storage pool
}
}

Expand Down

0 comments on commit e8cbd6f

Please sign in to comment.