Merge pull request #16001 from rook/mergify/bp/release-1.17/pr-15951

pool: support targetSizeRatio=0 and default compressionMode="" (backport #15951)
This commit is contained in:
mergify[bot] authored and GitHub committed 2025-06-11 15:42:16 +00:00
commit 993ae032a8
6 files changed
+33 -10

No files matched your search

@@ -572,6 +572,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -7372,6 +7373,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -7560,6 +7562,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -11224,6 +11227,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -12824,6 +12828,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -13758,6 +13763,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -13941,6 +13947,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
+7
View File
@@ -574,6 +574,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -7367,6 +7368,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -7555,6 +7557,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -11215,6 +11218,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -12815,6 +12819,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -13746,6 +13751,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
@@ -13929,6 +13935,7 @@ spec:
type: string
targetSizeRatio:
description: TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
minimum: 0
type: number
required:
- size
-8
View File
@@ -32,14 +32,6 @@ func (p *PoolSpec) IsHybridStoragePool() bool {
return p.Replicated.HybridStorage != nil
}
func (p *PoolSpec) IsCompressionEnabled() bool {
return p.CompressionMode != ""
}
func (p *ReplicatedSpec) IsTargetRatioEnabled() bool {
return p.TargetSizeRatio != 0
}
// ValidateCephBlockPool validates specifically a CephBlockPool's spec (not just any NamedPoolSpec)
func ValidateCephBlockPool(p *CephBlockPool) error {
if p.Spec.Name == ".rgw.root" || p.Spec.Name == ".mgr" || p.Spec.Name == ".nfs" {
+1
View File
@@ -1083,6 +1083,7 @@ type ReplicatedSpec struct {
Size uint `json:"size"`
// TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
// +kubebuilder:validation:Minimum=0
// +optional
TargetSizeRatio float64 `json:"targetSizeRatio,omitempty"`
+2 -2
View File
@@ -325,11 +325,11 @@ func setCommonPoolProperties(context *clusterd.Context, clusterInfo *ClusterInfo
pool.Parameters = make(map[string]string)
}
if pool.Replicated.IsTargetRatioEnabled() {
if _, ok := pool.Parameters[targetSizeRatioProperty]; !ok {
pool.Parameters[targetSizeRatioProperty] = strconv.FormatFloat(pool.Replicated.TargetSizeRatio, 'f', -1, 32)
}
if pool.IsCompressionEnabled() {
if _, ok := pool.Parameters[CompressionModeProperty]; !ok && pool.CompressionMode != "" {
pool.Parameters[CompressionModeProperty] = pool.CompressionMode
}
+16
View File
@@ -308,6 +308,22 @@ func fsExecutor(t *testing.T, fsName, configDir string, multiFS bool, createData
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-data1", "size", "1"}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-metadata", "target_size_ratio", "0"}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-data0", "target_size_ratio", "0"}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-data1", "target_size_ratio", "0"}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-named-pool", "target_size_ratio", "0"}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-metadata", "compression_mode", ""}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-data0", "compression_mode", ""}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-data1", "compression_mode", ""}) {
return "", nil
} else if reflect.DeepEqual(args[0:6], []string{"osd", "pool", "set", fsName + "-named-pool", "compression_mode", ""}) {
return "", nil
} else if reflect.DeepEqual(args[0:4], []string{"fs", "add_data_pool", fsName, fsName + "-data1"}) {
*addDataPoolCount++
return "", nil