From f1c9de5b4c6cc7f7f22a5a5776da536b0ea73115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Mon, 7 Jul 2025 10:51:35 +0200 Subject: [PATCH 1/2] core: set erasure-code-profile plugin based on pool algorithm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a `CephBlockPool` defines `spec.erasureCoded.algorithm`, use it as the erasure-code-profile plugin. Until now, that parameter would have been ignored completely, and every erasure-coded pool would use the same plugin as the `default` erasure-code-profile (i.e. `jerasure`). Note that using any algorithm other than `jerasure` or `isa` is likely to fail given the current implementation, as different algorithm require different sets of parameters, and those cannot be supplied by the user. Signed-off-by: Benoît Knecht (cherry picked from commit d7f08693ed3f5d858eb018a6ecb0deefb5d5b11c) --- pkg/daemon/ceph/client/erasure-code-profile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/daemon/ceph/client/erasure-code-profile.go b/pkg/daemon/ceph/client/erasure-code-profile.go index bb8c2fbad..16579af81 100644 --- a/pkg/daemon/ceph/client/erasure-code-profile.go +++ b/pkg/daemon/ceph/client/erasure-code-profile.go @@ -72,6 +72,10 @@ func CreateErasureCodeProfile(context *clusterd.Context, clusterInfo *ClusterInf return errors.Wrap(err, "failed to look up default erasure code profile") } + if pool.ErasureCoded.Algorithm != "" { + defaultProfile.Plugin = pool.ErasureCoded.Algorithm + } + // define the profile with a set of key/value pairs profilePairs := []string{ fmt.Sprintf("k=%d", pool.ErasureCoded.DataChunks), From 7b082939b86d3ccf60ef6fa0aa29c8530f52ed34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Tue, 8 Jul 2025 20:43:31 +0200 Subject: [PATCH 2/2] core: only support isa and jerasure algorithms on ec pools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `CephBlockPool` CR allowed any algorithm to be specified in `spec.erasureCoded.algorithm`, but in practice only `isa` or `jerasure` would work. Make that restriction explicit by restricting this field to `isa` or `jerasure` in the CRD. Signed-off-by: Benoît Knecht (cherry picked from commit 0b423a30f9af0fb558dce8e43a1bc8bd42dafeda) --- Documentation/CRDs/specification.md | 3 +- .../charts/rook-ceph/templates/resources.yaml | 49 ++++++++++++++++--- deploy/examples/crds.yaml | 49 ++++++++++++++++--- pkg/apis/ceph.rook.io/v1/types.go | 4 +- 4 files changed, 89 insertions(+), 16 deletions(-) diff --git a/Documentation/CRDs/specification.md b/Documentation/CRDs/specification.md index f9068e312..da8e65910 100644 --- a/Documentation/CRDs/specification.md +++ b/Documentation/CRDs/specification.md @@ -6678,7 +6678,8 @@ string (Optional) -

The algorithm for erasure coding

+

The algorithm for erasure coding. +If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile.

diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index ae42d500e..9e1a4e391 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -454,7 +454,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7551,7 +7556,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7740,7 +7750,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -11445,7 +11460,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13046,7 +13066,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14006,7 +14031,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14190,7 +14220,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 79f6700aa..4853b19b1 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -456,7 +456,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7546,7 +7551,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7735,7 +7745,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -11436,7 +11451,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13037,7 +13057,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13994,7 +14019,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14178,7 +14208,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index fae5e1e07..a57a25f7f 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -1315,7 +1315,9 @@ type ErasureCodedSpec struct { // +kubebuilder:validation:Minimum=0 DataChunks uint `json:"dataChunks"` - // The algorithm for erasure coding + // The algorithm for erasure coding. + // If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + // +kubebuilder:validation:Enum=isa;jerasure // +optional Algorithm string `json:"algorithm,omitempty"` }