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

liquid-ironic: report all AZs required by AZAwareResourceTopology #623

Merged
merged 1 commit into from
Dec 11, 2024
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
9 changes: 6 additions & 3 deletions internal/liquids/ironic/capacity.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func (l *Logic) ScanCapacity(ctx context.Context, req liquid.ServiceCapacityRequ
delete(nodesByFlavorName, flavorName)

perAZ := make(map[liquid.AvailabilityZone]*liquid.AZResourceCapacityReport)
for _, az := range req.AllAZs {
perAZ[az] = &liquid.AZResourceCapacityReport{Capacity: 0}
}
for _, node := range matchingNodes {
logg.Debug("Ironic node %q (%s) matches flavor %s", node.Name, node.UUID, flavorName)

Expand All @@ -135,9 +138,9 @@ func (l *Logic) ScanCapacity(ctx context.Context, req liquid.ServiceCapacityRequ
az := azForResourceProviderUUID[node.UUID]
if !slices.Contains(req.AllAZs, az) {
az = liquid.AvailabilityZoneUnknown
}
if perAZ[az] == nil {
perAZ[az] = &liquid.AZResourceCapacityReport{Capacity: 0}
if perAZ[az] == nil {
perAZ[az] = &liquid.AZResourceCapacityReport{Capacity: 0}
}
}
perAZ[az].Capacity++

Expand Down
Loading