浏览代码

Merge pull request #33280 from mavenugo/vin-ln-1706

Vendoring libnetwork b2bc1a684
Brian Goff 8 年之前
父节点
当前提交
ab83b924bc
共有 3 个文件被更改,包括 10 次插入9 次删除
  1. 1 1
      vendor.conf
  2. 4 0
      vendor/github.com/docker/libnetwork/controller.go
  3. 5 8
      vendor/github.com/docker/libnetwork/network.go

+ 1 - 1
vendor.conf

@@ -26,7 +26,7 @@ github.com/imdario/mergo 0.2.1
 golang.org/x/sync de49d9dcd27d4f764488181bea099dfe6179bcf0
 
 #get libnetwork packages
-github.com/docker/libnetwork b2bc1a68486ccf8ada503162d9f0df7d31bdd8fb
+github.com/docker/libnetwork 83e1e49475b88a9f1f8ba89a690a7d5de42e24b9
 github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

+ 4 - 0
vendor/github.com/docker/libnetwork/controller.go

@@ -765,6 +765,10 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
 		return nil, types.ForbiddenErrorf("Cannot create a multi-host network from a worker node. Please create the network from a manager node.")
 	}
 
+	if network.scope == datastore.SwarmScope && c.isDistributedControl() {
+		return nil, types.ForbiddenErrorf("cannot create a swarm scoped network when swarm is not active")
+	}
+
 	// Make sure we have a driver available for this network type
 	// before we allocate anything.
 	if _, err := network.driver(true); err != nil {

+ 5 - 8
vendor/github.com/docker/libnetwork/network.go

@@ -356,10 +356,10 @@ func (n *network) validateConfiguration() error {
 	if n.configOnly {
 		// Only supports network specific configurations.
 		// Network operator configurations are not supported.
-		if n.ingress || n.internal || n.attachable {
+		if n.ingress || n.internal || n.attachable || n.scope != "" {
 			return types.ForbiddenErrorf("configuration network can only contain network " +
 				"specific fields. Network operator fields like " +
-				"[ ingress | internal | attachable ] are not supported.")
+				"[ ingress | internal | attachable | scope ] are not supported.")
 		}
 	}
 	if n.configFrom != "" {
@@ -904,17 +904,14 @@ func (n *network) driver(load bool) (driverapi.Driver, error) {
 		return nil, err
 	}
 
-	c := n.getController()
-	isAgent := c.isAgent()
 	n.Lock()
 	// If load is not required, driver, cap and err may all be nil
 	if n.scope == "" && cap != nil {
 		n.scope = cap.DataScope
 	}
-	if isAgent && n.dynamic {
-		// If we are running in agent mode and the network
-		// is dynamic, then the networks are swarm scoped
-		// regardless of the backing driver.
+	if n.dynamic {
+		// If the network is dynamic, then it is swarm
+		// scoped regardless of the backing driver.
 		n.scope = datastore.SwarmScope
 	}
 	n.Unlock()