pool: add option to enableCrushUpdates to pool if required

this will be disabled by default but in scenarios where the user want to
update failureDomain, DeviceClass etc, this option can be enabled, to be
noted this can lead to lot of data rebalancing and remapping. Use with
caution

Signed-off-by: Deepika Upadhyay <deepika.upadhyay@clyso.com>
This commit is contained in:
Deepika Upadhyay committed 2024-06-12 22:48:25 +05:30
1 parent dafcb7644f
commit d71f9c238f
7 files changed
+88 -5

No files matched your search

+12
View File
@@ -10478,6 +10478,18 @@ string
</tr>
<tr>
<td>
<code>enableCrushUpdates</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Allow rook operator to change the pool CRUSH tunables once the pool is created</p>
</td>
</tr>
<tr>
<td>
<code>compressionMode</code><br/>
<em>
string
@@ -184,6 +184,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6540,6 +6543,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6721,6 +6727,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -10198,6 +10207,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -11310,6 +11322,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12037,6 +12052,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12213,6 +12231,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
+21
View File
@@ -186,6 +186,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6535,6 +6538,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6716,6 +6722,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -10189,6 +10198,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -11301,6 +11313,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12025,6 +12040,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12201,6 +12219,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
enableCrushUpdates:
description: Allow rook operator to change the pool CRUSH tunables once the pool is created
type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
+2
View File
@@ -33,6 +33,8 @@ spec:
# If device classes are specified, ensure this property is added to every pool in the cluster,
# otherwise Ceph will warn about pools with overlapping roots.
#deviceClass: my-class
# allow rook to update pool spec and crush rule, use with caution, disabled by default
#enableCrushUpdates: false
# Enables collecting RBD per-image IO statistics by enabling dynamic OSD performance counters. Defaults to false.
# For reference: https://docs.ceph.com/docs/master/mgr/prometheus/#rbd-io-statistics
# enableRBDStats: true
+4
View File
@@ -755,6 +755,10 @@ type PoolSpec struct {
// +nullable
DeviceClass string `json:"deviceClass,omitempty"`
// Allow rook operator to change the pool CRUSH tunables once the pool is created
// +optional
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)
// +kubebuilder:validation:Enum=none;passive;aggressive;force;""
+6
View File
@@ -463,6 +463,12 @@ func createReplicatedPoolForApp(context *clusterd.Context, clusterInfo *ClusterI
}
func updatePoolCrushRule(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool cephv1.NamedPoolSpec) error {
if !pool.EnableCrushUpdates {
logger.Debugf("Skipping crush rule update for pool %q: EnableCrushUpdates is disabled", pool.Name)
return nil
}
if pool.FailureDomain == "" && pool.DeviceClass == "" {
logger.Debugf("skipping check for failure domain and deviceClass on pool %q as it is not specified", pool.Name)
return nil
+22 -5
View File
@@ -281,7 +281,8 @@ func TestUpdateFailureDomain(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
Replicated: cephv1.ReplicatedSpec{Size: 3},
Replicated: cephv1.ReplicatedSpec{Size: 3},
EnableCrushUpdates: true,
},
}
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
@@ -294,8 +295,9 @@ func TestUpdateFailureDomain(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
FailureDomain: currentFailureDomain,
Replicated: cephv1.ReplicatedSpec{Size: 3},
FailureDomain: currentFailureDomain,
Replicated: cephv1.ReplicatedSpec{Size: 3},
EnableCrushUpdates: true,
},
}
testCrushRuleName = "mypool_rack"
@@ -305,12 +307,27 @@ func TestUpdateFailureDomain(t *testing.T) {
assert.Equal(t, "", newCrushRule)
})
t.Run("trying to change failure domain without enabling EnableCrushUpdates", func(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
FailureDomain: "zone",
Replicated: cephv1.ReplicatedSpec{Size: 3},
},
}
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
err := updatePoolCrushRule(context, AdminTestClusterInfo("mycluster"), clusterSpec, p)
assert.NoError(t, err)
assert.Equal(t, "", newCrushRule)
})
t.Run("changing failure domain", func(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
FailureDomain: "zone",
Replicated: cephv1.ReplicatedSpec{Size: 3},
FailureDomain: "zone",
Replicated: cephv1.ReplicatedSpec{Size: 3},
EnableCrushUpdates: true,
},
}
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}