mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Reserve addresses of existing local endpoints
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
055c5dd496
commit
ae90761a21
1 changed files with 18 additions and 0 deletions
|
@ -669,9 +669,27 @@ func (c *controller) reservePools() {
|
||||||
c.Gateway = n.ipamV6Info[i].Gateway.IP.String()
|
c.Gateway = n.ipamV6Info[i].Gateway.IP.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Reserve pools
|
||||||
if err := n.ipamAllocate(); err != nil {
|
if err := n.ipamAllocate(); err != nil {
|
||||||
log.Warnf("Failed to allocate ipam pool(s) for network %q (%s): %v", n.Name(), n.ID(), err)
|
log.Warnf("Failed to allocate ipam pool(s) for network %q (%s): %v", n.Name(), n.ID(), err)
|
||||||
}
|
}
|
||||||
|
// Reserve existing endpoints' addresses
|
||||||
|
ipam, _, err := n.getController().getIPAMDriver(n.ipamType)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("Failed to retrieve ipam driver for network %q (%s) during address reservation", n.Name(), n.ID())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
epl, err := n.getEndpointsFromStore()
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("Failed to retrieve list of current endpoints on network %q (%s)", n.Name(), n.ID())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, ep := range epl {
|
||||||
|
if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
|
||||||
|
log.Warnf("Failed to reserve current adress for endpoint %q (%s) on network %q (%s)",
|
||||||
|
ep.Name(), ep.ID(), n.Name(), n.ID())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue