Merge pull request #24546 from mavenugo/stend

Fixing a stale endpoint issue that blocks ingress network cleanup
This commit is contained in:
Brian Goff 2016-07-12 16:40:19 -04:00 committed by GitHub
commit 933584f16f
4 changed files with 15 additions and 2 deletions

View file

@ -127,6 +127,14 @@ func (daemon *Daemon) SetupIngress(create clustertypes.NetworkCreateRequest, nod
return
}
// Cleanup any stale endpoints that might be left over during previous iterations
epList := n.Endpoints()
for _, ep := range epList {
if err := ep.Delete(true); err != nil {
logrus.Errorf("Failed to delete endpoint %s (%s): %v", ep.Name(), ep.ID(), err)
}
}
if err := n.Delete(); err != nil {
logrus.Errorf("Failed to delete stale ingress network %s: %v", n.ID(), err)
return

View file

@ -65,7 +65,7 @@ clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
clone git github.com/imdario/mergo 0.2.1
#get libnetwork packages
clone git github.com/docker/libnetwork 6eece7dcc21dcd34d907f3e91dd71cb8640b661c
clone git github.com/docker/libnetwork 9b821dc123ca07e2c4d7244943f4e3e9632904fb
clone git github.com/docker/go-events 39718a26497694185f8fb58a7d6f31947f3dc42d
clone git github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

View file

@ -320,6 +320,7 @@ func (n *network) CopyTo(o datastore.KVObject) error {
dstN.id = n.id
dstN.networkType = n.networkType
dstN.scope = n.scope
dstN.dynamic = n.dynamic
dstN.ipamType = n.ipamType
dstN.enableIPv6 = n.enableIPv6
dstN.persist = n.persist
@ -706,7 +707,7 @@ func (n *network) driver(load bool) (driverapi.Driver, error) {
if cap != nil {
n.scope = cap.DataScope
}
if c.isAgent() {
if c.isAgent() || n.dynamic {
// If we are running in agent mode then all networks
// in libnetwork are local scope regardless of the
// backing driver.

View file

@ -360,6 +360,10 @@ func (nDB *NetworkDB) bulkSync(nid string, nodes []string, all bool) ([]string,
nodes = nDB.mRandomNodes(1, nodes)
}
if len(nodes) == 0 {
return nil, nil
}
logrus.Debugf("%s: Initiating bulk sync with nodes %v", nDB.config.NodeName, nodes)
var err error
var networks []string