Merge pull request #46548 from thaJeztah/libnetwork_inline_populateSpecial

libnetwork: inline populateSpecial NetworkWalker
This commit is contained in:
Sebastiaan van Stijn 2023-09-27 10:13:15 +02:00 committed by GitHub
commit b1855bb4af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View file

@ -140,7 +140,14 @@ func New(cfgOptions ...config.Option) (*Controller, error) {
return nil, err
}
c.WalkNetworks(populateSpecial)
c.WalkNetworks(func(nw *Network) bool {
if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
if err := n.getController().addNetwork(n); err != nil {
log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
}
}
return false
})
// Reserve pools first before doing cleanup. Otherwise the
// cleanups of endpoint/network and sandbox below will

View file

@ -287,12 +287,3 @@ func (c *Controller) networkCleanup() {
}
}
}
var populateSpecial NetworkWalker = func(nw *Network) bool {
if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
if err := n.getController().addNetwork(n); err != nil {
log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
}
}
return false
}