Skip to content

Commit

Permalink
liquid-ironic: report all AZs required by AZAwareResourceTopology
Browse files Browse the repository at this point in the history
  • Loading branch information
majewsky committed Dec 11, 2024
1 parent aabca03 commit 0a42123
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit 0a42123

Please sign in to comment.