Quellcode durchsuchen

Libnetwork vendoring

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
Flavio Crisciani vor 8 Jahren
Ursprung
Commit
44c3de8450

+ 1 - 1
vendor.conf

@@ -24,7 +24,7 @@ github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5
 github.com/imdario/mergo 0.2.1
 
 #get libnetwork packages
-github.com/docker/libnetwork 5dc95a3f9ce4b70bf08492ca37ec55c5b6d84975
+github.com/docker/libnetwork cace103704768d39bd88a23d0df76df125a0e39a
 github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

+ 13 - 8
vendor/github.com/docker/libnetwork/agent.go

@@ -207,13 +207,18 @@ func (c *controller) agentSetup() error {
 	bindAddr := clusterProvider.GetLocalAddress()
 	advAddr := clusterProvider.GetAdvertiseAddress()
 	dataAddr := clusterProvider.GetDataPathAddress()
-	remote := clusterProvider.GetRemoteAddress()
-	remoteAddr, _, _ := net.SplitHostPort(remote)
+	remoteList := clusterProvider.GetRemoteAddressList()
+	remoteAddrList := make([]string, 0, len(remoteList))
+	for _, remote := range remoteList {
+		addr, _, _ := net.SplitHostPort(remote)
+		remoteAddrList = append(remoteAddrList, addr)
+	}
+
 	listen := clusterProvider.GetListenAddress()
 	listenAddr, _, _ := net.SplitHostPort(listen)
 
-	logrus.Infof("Initializing Libnetwork Agent Listen-Addr=%s Local-addr=%s Adv-addr=%s Data-addr=%s Remote-addr=%s",
-		listenAddr, bindAddr, advAddr, dataAddr, remoteAddr)
+	logrus.Infof("Initializing Libnetwork Agent Listen-Addr=%s Local-addr=%s Adv-addr=%s Data-addr=%s Remote-addr-list=%v",
+		listenAddr, bindAddr, advAddr, dataAddr, remoteAddrList)
 	if advAddr != "" && agent == nil {
 		if err := c.agentInit(listenAddr, bindAddr, advAddr, dataAddr); err != nil {
 			logrus.Errorf("Error in agentInit : %v", err)
@@ -227,8 +232,8 @@ func (c *controller) agentSetup() error {
 		}
 	}
 
-	if remoteAddr != "" {
-		if err := c.agentJoin(remoteAddr); err != nil {
+	if len(remoteAddrList) > 0 {
+		if err := c.agentJoin(remoteAddrList); err != nil {
 			logrus.Errorf("Error in joining gossip cluster : %v(join will be retried in background)", err)
 		}
 	}
@@ -342,12 +347,12 @@ func (c *controller) agentInit(listenAddr, bindAddrOrInterface, advertiseAddr, d
 	return nil
 }
 
-func (c *controller) agentJoin(remote string) error {
+func (c *controller) agentJoin(remoteAddrList []string) error {
 	agent := c.getAgent()
 	if agent == nil {
 		return nil
 	}
-	return agent.networkDB.Join([]string{remote})
+	return agent.networkDB.Join(remoteAddrList)
 }
 
 func (c *controller) agentDriverNotify(d driverapi.Driver) {

+ 1 - 1
vendor/github.com/docker/libnetwork/cluster/provider.go

@@ -13,7 +13,7 @@ type Provider interface {
 	GetListenAddress() string
 	GetAdvertiseAddress() string
 	GetDataPathAddress() string
-	GetRemoteAddress() string
+	GetRemoteAddressList() []string
 	ListenClusterEvents() <-chan struct{}
 	AttachNetwork(string, string, []string) (*network.NetworkingConfig, error)
 	DetachNetwork(string, string) error