Pass check-alive flag on claim for container

This commit is contained in:
Bryan Boreham committed 2017-06-12 14:03:53 +00:00
1 parent 31a4657467
commit a0d0b00938
3 files changed
+4 -4

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 // Claim a specific IP on behalf of the ID
func (client *Client) ClaimIP(ID string, cidr *net.IPNet) error { func (client *Client) ClaimIP(ID string, cidr *net.IPNet, checkAlive bool) error {
_, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, cidr), nil) _, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, cidr), ipamValues(checkAlive))
return err 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 if address != nil { // try to claim specific address requested
ip = &net.IPNet{IP: address, Mask: subnet.Mask} 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 return
} }
} else { } else {
+1 -1
View File
@@ -568,7 +568,7 @@ func (proxy *Proxy) claimCIDR(containerID, cidr string) (*net.IPNet, error) {
return nil, err return nil, err
} }
ipnet.IP = ip // we want the specific IP plus the mask 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 return ipnet, err
} }