Skip to content

Commit

Permalink
Merge pull request #170 from Hellcatlk/hardware-raid
Browse files Browse the repository at this point in the history
Bug 1986656: Fix missing case of BuildRAIDCleanSteps
  • Loading branch information
openshift-ci[bot] committed Aug 6, 2021
2 parents 1759c5e + 2a60349 commit 2e0f5db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/provisioner/ironic/raid.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@ func BuildRAIDCleanSteps(raidInterface string, target *metal3v1alpha1.RAIDConfig
}

// Hardware RAID
// Ignore SoftwareRAIDVolumes
if target != nil {
target.SoftwareRAIDVolumes = nil
// If hardware RAID configuration is nil,
// keep old hardware RAID configuration
if target == nil || target.HardwareRAIDVolumes == nil {
return
}

// Ignore SoftwareRAIDVolumes
target.SoftwareRAIDVolumes = nil
if actual != nil {
actual.SoftwareRAIDVolumes = nil
}
Expand All @@ -232,7 +236,7 @@ func BuildRAIDCleanSteps(raidInterface string, target *metal3v1alpha1.RAIDConfig
)

// If hardware raid configuration is empty, only need to clear old configuration
if target == nil || len(target.HardwareRAIDVolumes) == 0 {
if len(target.HardwareRAIDVolumes) == 0 {
return
}

Expand Down
10 changes: 10 additions & 0 deletions pkg/provisioner/ironic/raid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ func TestBuildRAIDCleanSteps(t *testing.T) {
expected []nodes.CleanStep
expectedError bool
}{
{
name: "keep hardware RAID",
raidInterface: "irmc",
target: nil,
},
{
name: "keep hardware RAID",
raidInterface: "irmc",
target: &metal3v1alpha1.RAIDConfig{},
},
{
name: "configure hardware RAID",
raidInterface: "irmc",
Expand Down

0 comments on commit 2e0f5db

Please sign in to comment.