On agent init, re-join on existing cluster networks

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2016-07-12 17:35:32 -07:00
parent e4957174ee
commit d0192db0cd
2 changed files with 12 additions and 5 deletions

View File

@ -358,6 +358,8 @@ func (c *controller) agentInit(bindAddrOrInterface string) error {
return false
})
c.WalkNetworks(joinCluster)
return nil
}

View File

@ -639,15 +639,20 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
return nil, err
}
if err = network.joinCluster(); err != nil {
log.Errorf("Failed to join network %s into agent cluster: %v", name, err)
}
network.addDriverWatches()
joinCluster(network)
return network, nil
}
var joinCluster NetworkWalker = func(nw Network) bool {
n := nw.(*network)
if err := n.joinCluster(); err != nil {
log.Errorf("Failed to join network %s (%s) into agent cluster: %v", n.Name(), n.ID(), err)
}
n.addDriverWatches()
return false
}
func (c *controller) reservePools() {
networks, err := c.getNetworksForScope(datastore.LocalScope)
if err != nil {