Vendoring libnetwork to Replace the label variable to DriverOpts

Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Madhu Venugopal 2015-10-14 20:11:53 -07:00
parent c56b02b284
commit cf1b5fe601
3 changed files with 10 additions and 12 deletions

View File

@ -20,7 +20,7 @@ clone git github.com/tchap/go-patricia v2.1.0
clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git clone git golang.org/x/net 3cffabab72adf04f8e3b01c5baf775361837b5fe https://github.com/golang/net.git
#get libnetwork packages #get libnetwork packages
clone git github.com/docker/libnetwork dd1c5f0ffe7697f75a82bd8e4bbd6f225ec5e383 clone git github.com/docker/libnetwork 2934f6bf585fa24c86048cc85f7506a5bb626bf5
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4 clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4

View File

@ -74,7 +74,6 @@ type NetworkController interface {
Config() config.Config Config() config.Config
// Create a new network. The options parameter carries network specific options. // Create a new network. The options parameter carries network specific options.
// Labels support will be added in the near future.
NewNetwork(networkType, name string, options ...NetworkOption) (Network, error) NewNetwork(networkType, name string, options ...NetworkOption) (Network, error)
// Networks returns the list of Network(s) managed by this controller. // Networks returns the list of Network(s) managed by this controller.

View File

@ -33,7 +33,6 @@ type Network interface {
// Create a new endpoint to this network symbolically identified by the // Create a new endpoint to this network symbolically identified by the
// specified unique name. The options parameter carry driver specific options. // specified unique name. The options parameter carry driver specific options.
// Labels support will be added in the near future.
CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error) CreateEndpoint(name string, options ...EndpointOption) (Endpoint, error)
// Delete the network. // Delete the network.
@ -58,7 +57,7 @@ type Network interface {
// NetworkInfo returns some configuration and operational information about the network // NetworkInfo returns some configuration and operational information about the network
type NetworkInfo interface { type NetworkInfo interface {
IpamConfig() (string, []*IpamConf, []*IpamConf) IpamConfig() (string, []*IpamConf, []*IpamConf)
Labels() map[string]string DriverOptions() map[string]string
Scope() string Scope() string
} }
@ -402,7 +401,7 @@ func (n *network) UnmarshalJSON(b []byte) (err error) {
if v, ok := netMap["generic"]; ok { if v, ok := netMap["generic"]; ok {
n.generic = v.(map[string]interface{}) n.generic = v.(map[string]interface{})
// Restore labels in their map[string]string form // Restore opts in their map[string]string form
if v, ok := n.generic[netlabel.GenericData]; ok { if v, ok := n.generic[netlabel.GenericData]; ok {
var lmap map[string]string var lmap map[string]string
ba, err := json.Marshal(v) ba, err := json.Marshal(v)
@ -484,19 +483,19 @@ func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ip
} }
} }
// NetworkOptionLabels function returns an option setter for any parameter described by a map // NetworkOptionDriverOpts function returns an option setter for any parameter described by a map
func NetworkOptionLabels(labels map[string]string) NetworkOption { func NetworkOptionDriverOpts(opts map[string]string) NetworkOption {
return func(n *network) { return func(n *network) {
if n.generic == nil { if n.generic == nil {
n.generic = make(map[string]interface{}) n.generic = make(map[string]interface{})
} }
if labels == nil { if opts == nil {
labels = make(map[string]string) opts = make(map[string]string)
} }
// Store the options // Store the options
n.generic[netlabel.GenericData] = labels n.generic[netlabel.GenericData] = opts
// Decode and store the endpoint options of libnetwork interest // Decode and store the endpoint options of libnetwork interest
if val, ok := labels[netlabel.EnableIPv6]; ok { if val, ok := opts[netlabel.EnableIPv6]; ok {
var err error var err error
if n.enableIPv6, err = strconv.ParseBool(val); err != nil { if n.enableIPv6, err = strconv.ParseBool(val); err != nil {
log.Warnf("Failed to parse %s' value: %s (%s)", netlabel.EnableIPv6, val, err.Error()) log.Warnf("Failed to parse %s' value: %s (%s)", netlabel.EnableIPv6, val, err.Error())
@ -1056,7 +1055,7 @@ func (n *network) Info() NetworkInfo {
return n return n
} }
func (n *network) Labels() map[string]string { func (n *network) DriverOptions() map[string]string {
n.Lock() n.Lock()
defer n.Unlock() defer n.Unlock()
if n.generic != nil { if n.generic != nil {