Merge pull request #15951 from OdedViner/target_size_ratio_negative
pool: support targetSizeRatio=0 and default compressionMode=""
This commit is contained in:
6 files changed
+33
-10
No files matched your search
@@ -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" {
|
||||
|
||||
@@ -1159,6 +1159,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"`
|
||||
|
||||
|
||||
@@ -326,11 +326,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user