pool: allow negative step num in crush rule
The crush rules may have a negative step num.
Rook had assumed negative values were not possible,
but just had not been encountered previously in
a custom crush rule.
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
(cherry picked from commit b9188c793a)
This commit is contained in:
1 parent
1a1daf6bff
commit
63e7c8125d
3 files changed
+3
-3
No files matched your search
@@ -75,7 +75,7 @@ type ruleSpec struct {
|
||||
|
||||
type stepSpec struct {
|
||||
Operation string `json:"op"`
|
||||
Number uint `json:"num"`
|
||||
Number int `json:"num"`
|
||||
Item int `json:"item"`
|
||||
ItemName string `json:"item_name"`
|
||||
Type string `json:"type"`
|
||||
|
||||
@@ -150,7 +150,7 @@ func buildTwoStepCrushSteps(pool cephv1.PoolSpec) []stepSpec {
|
||||
// Step three
|
||||
stepTakeSubFailureDomain := &stepSpec{
|
||||
Operation: "chooseleaf_firstn",
|
||||
Number: pool.Replicated.ReplicasPerFailureDomain,
|
||||
Number: int(pool.Replicated.ReplicasPerFailureDomain),
|
||||
Type: pool.Replicated.SubFailureDomain,
|
||||
}
|
||||
steps = append(steps, *stepTakeSubFailureDomain)
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestBuildCrushSteps(t *testing.T) {
|
||||
assert.Equal(t, 4, len(steps))
|
||||
assert.Equal(t, cephv1.DefaultCRUSHRoot, steps[0].ItemName)
|
||||
assert.Equal(t, "datacenter", steps[1].Type)
|
||||
assert.Equal(t, uint(2), steps[2].Number)
|
||||
assert.Equal(t, 2, steps[2].Number)
|
||||
}
|
||||
|
||||
func TestCompileCRUSHMap(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user