Browse Source

Merge pull request #1762 from aboch/nlo2

Do not accept swarm scope network creation if swarm is off
Madhu Venugopal 8 năm trước cách đây
mục cha
commit
a1ea100b9e
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      libnetwork/controller.go

+ 4 - 0
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 {