Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.15] OCPBUGS-34927: Correct out-of-bounds check #172

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions pkg/controllers/config/cloudinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,24 @@ func enableTopologyFeature() (bool, error) {
}
}

// for us to enable the topology feature, we need to ensure that for
// every compute zone there is a matching volume zone
for i := range ci.ComputeZones {
if ci.ComputeZones[i] != ci.VolumeZones[i] {
// for us to enable the topology feature we should have a corresponding
// compute AZ for each volume AZ: if we have more compute AZs than volume
// AZs then this clearly isn't the case
if len(ci.ComputeZones) > len(ci.VolumeZones) {
return false, nil
}

// likewise if the names of the various AZs don't match, that clearly isn't
// true
for _, computeZone := range ci.ComputeZones {
var found bool
for _, volumeZone := range ci.VolumeZones {
if computeZone == volumeZone {
found = true
break
}
}
if !found {
return false, nil
}
}
Expand Down