From a0d0b00938fdba9e1632bee49a342de6fb021830 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 12 Jun 2017 09:07:31 +0000 Subject: [PATCH] Pass check-alive flag on claim for container --- api/ipam.go | 4 ++-- plugin/ipam/driver.go | 2 +- proxy/proxy.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/ipam.go b/api/ipam.go index 0f72b0b0..ea25b618 100644 --- a/api/ipam.go +++ b/api/ipam.go @@ -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 } diff --git a/plugin/ipam/driver.go b/plugin/ipam/driver.go index 9bb90a2d..ceb9458b 100644 --- a/plugin/ipam/driver.go +++ b/plugin/ipam/driver.go @@ -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 { diff --git a/proxy/proxy.go b/proxy/proxy.go index d991794c..893168bc 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -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 }