Skip to content

Commit

Permalink
Pass check-alive flag on claim for container
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Jun 12, 2017
1 parent 31a4657 commit a0d0b00
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/ipam/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a0d0b00

Please sign in to comment.