mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Setting bridgename to be network-id[:12] if bridgename option is empty
Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
51699b91aa
commit
e4e77353c9
1 changed files with 5 additions and 2 deletions
|
@ -516,7 +516,7 @@ func parseNetworkGenericOptions(data interface{}) (*networkConfiguration, error)
|
|||
return config, err
|
||||
}
|
||||
|
||||
func parseNetworkOptions(option options.Generic) (*networkConfiguration, error) {
|
||||
func parseNetworkOptions(id string, option options.Generic) (*networkConfiguration, error) {
|
||||
var err error
|
||||
config := &networkConfiguration{}
|
||||
|
||||
|
@ -537,6 +537,9 @@ func parseNetworkOptions(option options.Generic) (*networkConfiguration, error)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if config.BridgeName == "" && config.DisableBridgeCreation == false {
|
||||
config.BridgeName = "br-" + id[:12]
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
|
@ -580,7 +583,7 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}) error {
|
|||
d.Unlock()
|
||||
|
||||
// Parse and validate the config. It should not conflict with existing networks' config
|
||||
config, err := parseNetworkOptions(option)
|
||||
config, err := parseNetworkOptions(id, option)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue