From 8569cbd4a3915a304812f849a7098d932e58e3d9 Mon Sep 17 00:00:00 2001 From: Martynas Pumputis Date: Fri, 10 Jun 2016 11:51:31 +0100 Subject: [PATCH] Force transferring of IPAM ranges in a case of Shutdown If no peer for transfer is found, we transfer them to mesh.UnknownPeerName to notify the ring update tracker. Makes the awsvpc tracker to remove local entries from the VPC route table when the last peer calls "weave reset". --- ipam/allocator.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipam/allocator.go b/ipam/allocator.go index ae8af51b6c..c0fc0c17e6 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -443,10 +443,11 @@ func (alloc *Allocator) Shutdown() { alloc.cancelOps(&alloc.pendingClaims) alloc.cancelOps(&alloc.pendingAllocates) alloc.cancelOps(&alloc.pendingPrimes) - if heir := alloc.pickPeerForTransfer(); heir != mesh.UnknownPeerName { - alloc.ring.Transfer(alloc.ourName, heir) + heir := alloc.pickPeerForTransfer() + alloc.ring.Transfer(alloc.ourName, heir) + alloc.space.Clear() + if heir != mesh.UnknownPeerName { alloc.persistRing() - alloc.space.Clear() alloc.gossip.GossipBroadcast(alloc.Gossip()) } doneChan <- struct{}{}