mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Refresh special drivers networks if present in store
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
3b705e73e6
commit
9328f1ea1e
4 changed files with 20 additions and 6 deletions
|
@ -203,6 +203,8 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.WalkNetworks(populateSpecial)
|
||||||
|
|
||||||
// Reserve pools first before doing cleanup. Otherwise the
|
// Reserve pools first before doing cleanup. Otherwise the
|
||||||
// cleanups of endpoint/network and sandbox below will
|
// cleanups of endpoint/network and sandbox below will
|
||||||
// generate many unnecessary warnings
|
// generate many unnecessary warnings
|
||||||
|
|
|
@ -987,7 +987,7 @@ func (ep *endpoint) assignAddress(ipam ipamapi.Ipam, assignIPv4, assignIPv6 bool
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
n := ep.getNetwork()
|
n := ep.getNetwork()
|
||||||
if n.Type() == "host" || n.Type() == "null" {
|
if n.hasSpecialDriver() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@ func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
|
||||||
|
|
||||||
func (ep *endpoint) releaseAddress() {
|
func (ep *endpoint) releaseAddress() {
|
||||||
n := ep.getNetwork()
|
n := ep.getNetwork()
|
||||||
if n.Type() == "host" || n.Type() == "null" {
|
if n.hasSpecialDriver() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1123,8 +1123,7 @@ func (n *network) getController() *controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *network) ipamAllocate() error {
|
func (n *network) ipamAllocate() error {
|
||||||
// For now also exclude bridge from using new ipam
|
if n.hasSpecialDriver() {
|
||||||
if n.Type() == "host" || n.Type() == "null" {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,8 +1294,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *network) ipamRelease() {
|
func (n *network) ipamRelease() {
|
||||||
// For now exclude host and null
|
if n.hasSpecialDriver() {
|
||||||
if n.Type() == "host" || n.Type() == "null" {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ipam, _, err := n.getController().getIPAMDriver(n.ipamType)
|
ipam, _, err := n.getController().getIPAMDriver(n.ipamType)
|
||||||
|
@ -1504,3 +1502,8 @@ func (n *network) TableEventRegister(tableName string) error {
|
||||||
n.driverTables = append(n.driverTables, tableName)
|
n.driverTables = append(n.driverTables, tableName)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special drivers are ones which do not need to perform any network plumbing
|
||||||
|
func (n *network) hasSpecialDriver() bool {
|
||||||
|
return n.Type() == "host" || n.Type() == "null"
|
||||||
|
}
|
||||||
|
|
|
@ -464,3 +464,12 @@ func (c *controller) networkCleanup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var populateSpecial NetworkWalker = func(nw Network) bool {
|
||||||
|
if n := nw.(*network); n.hasSpecialDriver() {
|
||||||
|
if err := n.getController().addNetwork(n); err != nil {
|
||||||
|
log.Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue