From 9b0e1df4dd2dbab6d2aacfaae0ea27deaf5c7c62 Mon Sep 17 00:00:00 2001 From: Madhu Venugopal Date: Thu, 18 May 2017 15:14:12 -0700 Subject: [PATCH] Vendoring libnetwork Signed-off-by: Madhu Venugopal --- vendor.conf | 2 +- vendor/github.com/docker/libnetwork/controller.go | 4 ++++ vendor/github.com/docker/libnetwork/network.go | 13 +++++-------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/vendor.conf b/vendor.conf index df4aa7e1e8..f0cedfc22b 100644 --- a/vendor.conf +++ b/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 diff --git a/vendor/github.com/docker/libnetwork/controller.go b/vendor/github.com/docker/libnetwork/controller.go index eb0d9e4b20..df75be707f 100644 --- a/vendor/github.com/docker/libnetwork/controller.go +++ b/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 { diff --git a/vendor/github.com/docker/libnetwork/network.go b/vendor/github.com/docker/libnetwork/network.go index 5fcca95fc4..2b6c705a7b 100644 --- a/vendor/github.com/docker/libnetwork/network.go +++ b/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()