Browse code

Vendoring libnetwork to Replace the label variable to DriverOpts

Signed-off-by: Madhu Venugopal <madhu@docker.com>

Madhu Venugopal authored on 2015/10/15 12:11:53
Showing 3 changed files
... ...
@@ -20,7 +20,7 @@ clone git github.com/tchap/go-patricia v2.1.0
20 20
 clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git
21 21
 
22 22
 #get libnetwork packages
23
-clone git github.com/docker/libnetwork dd1c5f0ffe7697f75a82bd8e4bbd6f225ec5e383
23
+clone git github.com/docker/libnetwork 2934f6bf585fa24c86048cc85f7506a5bb626bf5
24 24
 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
25 25
 clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
26 26
 clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
... ...
@@ -74,7 +74,6 @@ type NetworkController interface {
74 74
 	Config() config.Config
75 75
 
76 76
 	// Create a new network. The options parameter carries network specific options.
77
-	// Labels support will be added in the near future.
78 77
 	NewNetwork(networkType, name string, options ...NetworkOption) (Network, error)
79 78
 
80 79
 	// Networks returns the list of Network(s) managed by this controller.
... ...
@@ -33,7 +33,6 @@ type Network interface {
33 33
 
34 34
 	// Create a new endpoint to this network symbolically identified by the
35 35
 	// specified unique name. The options parameter carry driver specific options.
36
-	// Labels support will be added in the near future.
37 36
 	CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)
38 37
 
39 38
 	// Delete the network.
... ...
@@ -58,7 +57,7 @@ type Network interface {
58 58
 // NetworkInfo returns some configuration and operational information about the network
59 59
 type NetworkInfo interface {
60 60
 	IpamConfig() (string, []*IpamConf, []*IpamConf)
61
-	Labels() map[string]string
61
+	DriverOptions() map[string]string
62 62
 	Scope() string
63 63
 }
64 64
 
... ...
@@ -402,7 +401,7 @@ func (n *network) UnmarshalJSON(b []byte) (err error) {
402 402
 
403 403
 	if v, ok := netMap["generic"]; ok {
404 404
 		n.generic = v.(map[string]interface{})
405
-		// Restore labels in their map[string]string form
405
+		// Restore opts in their map[string]string form
406 406
 		if v, ok := n.generic[netlabel.GenericData]; ok {
407 407
 			var lmap map[string]string
408 408
 			ba, err := json.Marshal(v)
... ...
@@ -484,19 +483,19 @@ func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ip
484 484
 	}
485 485
 }
486 486
 
487
-// NetworkOptionLabels function returns an option setter for any parameter described by a map
488
-func NetworkOptionLabels(labels map[string]string) NetworkOption {
487
+// NetworkOptionDriverOpts function returns an option setter for any parameter described by a map
488
+func NetworkOptionDriverOpts(opts map[string]string) NetworkOption {
489 489
 	return func(n *network) {
490 490
 		if n.generic == nil {
491 491
 			n.generic = make(map[string]interface{})
492 492
 		}
493
-		if labels == nil {
494
-			labels = make(map[string]string)
493
+		if opts == nil {
494
+			opts = make(map[string]string)
495 495
 		}
496 496
 		// Store the options
497
-		n.generic[netlabel.GenericData] = labels
497
+		n.generic[netlabel.GenericData] = opts
498 498
 		// Decode and store the endpoint options of libnetwork interest
499
-		if val, ok := labels[netlabel.EnableIPv6]; ok {
499
+		if val, ok := opts[netlabel.EnableIPv6]; ok {
500 500
 			var err error
501 501
 			if n.enableIPv6, err = strconv.ParseBool(val); err != nil {
502 502
 				log.Warnf("Failed to parse %s' value: %s (%s)", netlabel.EnableIPv6, val, err.Error())
... ...
@@ -1056,7 +1055,7 @@ func (n *network) Info() NetworkInfo {
1056 1056
 	return n
1057 1057
 }
1058 1058
 
1059
-func (n *network) Labels() map[string]string {
1059
+func (n *network) DriverOptions() map[string]string {
1060 1060
 	n.Lock()
1061 1061
 	defer n.Unlock()
1062 1062
 	if n.generic != nil {