diff --git a/ipam/claim.go b/ipam/claim.go index 642898f1..fa35ef8f 100644 --- a/ipam/claim.go +++ b/ipam/claim.go @@ -45,7 +45,11 @@ func (c *claim) Try(alloc *Allocator) bool { return false default: alloc.debugf("requesting address %s from other peer %s", c.addr, owner) - alloc.sendSpaceRequest(owner, address.NewRange(c.addr, 1)) + err := alloc.sendSpaceRequest(owner, address.NewRange(c.addr, 1)) + if err != nil { // can't speak to owner right now; figure it out later + alloc.infof("Claim %s for %s: %s; will try later.", c.addr, c.ident, err) + c.sendResult(nil) + } return false } diff --git a/test/160_claim_test.sh b/test/160_claim_test.sh index b0b6ece2..c550f3b7 100755 --- a/test/160_claim_test.sh +++ b/test/160_claim_test.sh @@ -27,4 +27,14 @@ assert_raises "[ $C3 != $C1 ]" assert_raises "exec_on $HOST1 c1 $PING $C3" +stop_router_on $HOST1 +stop_router_on $HOST2 + +# Now make host1 attempt to claim from host2, when host2 is stopped +weave_on $HOST2 launch-router +# Introduce host3 to remember the IPAM CRDT when we stop host2 +weave_on $HOST3 launch-router $HOST2 +stop_router_on $HOST2 +weave_on $HOST1 launch-router --log-level=debug $HOST3 + end_suite