From 0a4212365bfde0b949483dd398227f22d714b78a Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 11 Dec 2024 15:50:23 +0100 Subject: [PATCH] liquid-ironic: report all AZs required by AZAwareResourceTopology --- internal/liquids/ironic/capacity.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/liquids/ironic/capacity.go b/internal/liquids/ironic/capacity.go index a5d797d3..c84f6ba1 100644 --- a/internal/liquids/ironic/capacity.go +++ b/internal/liquids/ironic/capacity.go @@ -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) @@ -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++