forked from rook/rook
pool: allow enablecrushupdates to be nil
Enabling crush updates is false by default, and can be enabled if set to true. The setting needs to be nullable in case we need to differentiate between the value being set to false or just not set, to know if the default should be different. This is necessary for rook consumers who are refererencing the pool struct and want to change the default, rather than using rook's default value of false. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
@@ -446,6 +446,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -7675,6 +7676,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -7869,6 +7871,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -11607,6 +11610,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -13220,6 +13224,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -14188,6 +14193,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -14377,6 +14383,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
|
||||
@@ -448,6 +448,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -7670,6 +7671,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -7864,6 +7866,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -11598,6 +11601,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -13211,6 +13215,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -14176,6 +14181,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
@@ -14365,6 +14371,7 @@ spec:
|
||||
type: string
|
||||
enableCrushUpdates:
|
||||
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
nullable: true
|
||||
type: boolean
|
||||
enableRBDStats:
|
||||
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
|
||||
|
||||
@@ -948,8 +948,9 @@ type PoolSpec struct {
|
||||
DeviceClass string `json:"deviceClass,omitempty"`
|
||||
|
||||
// Allow rook operator to change the pool CRUSH tunables once the pool is created
|
||||
// +nullable
|
||||
// +optional
|
||||
EnableCrushUpdates bool `json:"enableCrushUpdates,omitempty"`
|
||||
EnableCrushUpdates *bool `json:"enableCrushUpdates,omitempty"`
|
||||
|
||||
// DEPRECATED: use Parameters instead, e.g., Parameters["compression_mode"] = "force"
|
||||
// The inline compression mode in Bluestore OSD to set to (options are: none, passive, aggressive, force)
|
||||
|
||||
@@ -4552,6 +4552,11 @@ func (in *PoolPlacementSpec) DeepCopy() *PoolPlacementSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PoolSpec) DeepCopyInto(out *PoolSpec) {
|
||||
*out = *in
|
||||
if in.EnableCrushUpdates != nil {
|
||||
in, out := &in.EnableCrushUpdates, &out.EnableCrushUpdates
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
in.Replicated.DeepCopyInto(&out.Replicated)
|
||||
out.ErasureCoded = in.ErasureCoded
|
||||
if in.Parameters != nil {
|
||||
|
||||
@@ -510,7 +510,7 @@ func createReplicatedPoolForApp(context *clusterd.Context, clusterInfo *ClusterI
|
||||
}
|
||||
|
||||
func updatePoolCrushRule(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool cephv1.NamedPoolSpec) error {
|
||||
if !pool.EnableCrushUpdates {
|
||||
if pool.EnableCrushUpdates == nil || !*pool.EnableCrushUpdates {
|
||||
logger.Debugf("Skipping crush rule update for pool %q: EnableCrushUpdates is disabled", pool.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -286,12 +286,13 @@ func TestUpdateFailureDomain(t *testing.T) {
|
||||
return "", errors.Errorf("unexpected ceph command %q", args)
|
||||
}
|
||||
|
||||
enableCrushUpdates := true
|
||||
t.Run("no desired failure domain", func(t *testing.T) {
|
||||
p := cephv1.NamedPoolSpec{
|
||||
Name: "mypool",
|
||||
PoolSpec: cephv1.PoolSpec{
|
||||
Replicated: cephv1.ReplicatedSpec{Size: 3},
|
||||
EnableCrushUpdates: true,
|
||||
EnableCrushUpdates: &enableCrushUpdates,
|
||||
},
|
||||
}
|
||||
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
|
||||
@@ -306,7 +307,7 @@ func TestUpdateFailureDomain(t *testing.T) {
|
||||
PoolSpec: cephv1.PoolSpec{
|
||||
FailureDomain: currentFailureDomain,
|
||||
Replicated: cephv1.ReplicatedSpec{Size: 3},
|
||||
EnableCrushUpdates: true,
|
||||
EnableCrushUpdates: &enableCrushUpdates,
|
||||
},
|
||||
}
|
||||
testCrushRuleName = "mypool_rack"
|
||||
@@ -336,7 +337,7 @@ func TestUpdateFailureDomain(t *testing.T) {
|
||||
PoolSpec: cephv1.PoolSpec{
|
||||
FailureDomain: "zone",
|
||||
Replicated: cephv1.ReplicatedSpec{Size: 3},
|
||||
EnableCrushUpdates: true,
|
||||
EnableCrushUpdates: &enableCrushUpdates,
|
||||
},
|
||||
}
|
||||
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
|
||||
@@ -351,7 +352,7 @@ func TestUpdateFailureDomain(t *testing.T) {
|
||||
PoolSpec: cephv1.PoolSpec{
|
||||
FailureDomain: "zone",
|
||||
Replicated: cephv1.ReplicatedSpec{Size: 3},
|
||||
EnableCrushUpdates: true,
|
||||
EnableCrushUpdates: &enableCrushUpdates,
|
||||
},
|
||||
}
|
||||
clusterSpec := &cephv1.ClusterSpec{
|
||||
|
||||
Reference in New Issue
Block a user