ceph: pass 'device-class' when creating explicit crush-rule
When 'pool.Replicated.ReplicasPerFailureDomain' is non zero, the code goes via route of adding explicit crush-rule from template, but ignores the 'pool.DeviceClass' if it is set. Added option to template to have (optional) 'class hdd|ssd' Signed-off-by: Shachar Sharon <ssharon@redhat.com>
This commit is contained in:
1 parent
27b0295ac1
commit
53461dd2ef
1 file changed
+6
-1
@@ -32,7 +32,7 @@ rule %s {
|
||||
type replicated
|
||||
min_size %d
|
||||
max_size %d
|
||||
step take %s
|
||||
step take %s %s
|
||||
step choose firstn 0 type %s
|
||||
step chooseleaf firstn 2 type %s
|
||||
step emit
|
||||
@@ -45,6 +45,10 @@ var (
|
||||
)
|
||||
|
||||
func buildTwoStepPlainCrushRule(crushMap CrushMap, ruleName string, pool cephv1.PoolSpec) string {
|
||||
var crushRuleInsert string
|
||||
if pool.DeviceClass != "" {
|
||||
crushRuleInsert = fmt.Sprintf("class %s", pool.DeviceClass)
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
twoStepCRUSHRuleTemplate,
|
||||
ruleName,
|
||||
@@ -52,6 +56,7 @@ func buildTwoStepPlainCrushRule(crushMap CrushMap, ruleName string, pool cephv1.
|
||||
ruleMinSizeDefault,
|
||||
ruleMaxSizeDefault,
|
||||
pool.CrushRoot,
|
||||
crushRuleInsert,
|
||||
pool.FailureDomain,
|
||||
pool.Replicated.SubFailureDomain,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user