From 92e74a22f104143e1ed2837a92aad4bf959369ef Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Wed, 8 Mar 2017 12:24:01 -0800 Subject: [PATCH] allocator: Update unallocatedServices properly after service updates If a service update caused the service to be successfully allocated, that service should be removed from unallocatedServices. If the allocation was unsuccessful, unallocatedServices should be updated to contain the latest version of the service. Signed-off-by: Aaron Lehmann --- manager/allocator/network.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manager/allocator/network.go b/manager/allocator/network.go index 38871fa0e7..0420ec9a82 100644 --- a/manager/allocator/network.go +++ b/manager/allocator/network.go @@ -387,6 +387,9 @@ func (a *Allocator) doNetworkAlloc(ctx context.Context, ev events.Event) { return a.commitAllocatedService(ctx, batch, s) }); err != nil { log.G(ctx).WithError(err).Errorf("Failed to commit allocation during update for service %s", s.ID) + nc.unallocatedServices[s.ID] = s + } else { + delete(nc.unallocatedServices, s.ID) } case state.EventDeleteService: s := v.Service.Copy()