Merge pull request #3013 from weaveworks/fix-claim

Pass check-alive flag on claim for container
This commit is contained in:
Marc Carré authored and GitHub committed 2017-06-12 15:31:51 +01:00
commit 4e5a8f348a
5 files changed
+6 -5

No files matched your search

+2 -2
View File
@@ -51,8 +51,8 @@ func (client *Client) LookupIP(ID string) (*net.IPNet, error) {
}
// Claim a specific IP on behalf of the ID
func (client *Client) ClaimIP(ID string, cidr *net.IPNet) error {
_, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, cidr), nil)
func (client *Client) ClaimIP(ID string, cidr *net.IPNet, checkAlive bool) error {
_, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, cidr), ipamValues(checkAlive))
return err
}
+1 -1
View File
@@ -87,7 +87,7 @@ func (i *Ipam) RequestAddress(poolID string, address net.IP, options map[string]
}
if address != nil { // try to claim specific address requested
ip = &net.IPNet{IP: address, Mask: subnet.Mask}
if err = i.weave.ClaimIP(api.NoContainerID, ip); err != nil {
if err = i.weave.ClaimIP(api.NoContainerID, ip, false); err != nil {
return
}
} else {
+1 -1
View File
@@ -392,7 +392,7 @@ func main() {
observeContainers(allocator)
if dockerCli != nil {
allContainerIDs, err := dockerCli.AllContainerIDs()
allContainerIDs, err := dockerCli.RunningContainerIDs()
checkFatal(err)
allocator.PruneOwned(allContainerIDs)
}
+1 -1
View File
@@ -568,7 +568,7 @@ func (proxy *Proxy) claimCIDR(containerID, cidr string) (*net.IPNet, error) {
return nil, err
}
ipnet.IP = ip // we want the specific IP plus the mask
err = proxy.weave.ClaimIP(containerID, ipnet)
err = proxy.weave.ClaimIP(containerID, ipnet, true)
return ipnet, err
}
+1
View File
@@ -27,6 +27,7 @@ check_iface_ready 10.2.1.1/24
# Check committed containers only have one weavewait prepended
proxy_start_container $HOST1 --name c1 -e 'WEAVE_CIDR=10.2.1.1/24'
COMMITTED_IMAGE=$(proxy docker_on $HOST1 commit c1)
docker_on $HOST1 stop -t=1 c1
assert_raises "proxy docker_on $HOST1 run --name c2 $COMMITTED_IMAGE"
assert "entrypoint c2" "$(entrypoint $COMMITTED_IMAGE)"