remove the unused DefaultNetwork member from daemon.Config

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This commit is contained in:
Shijiang Wei 2015-10-22 18:16:53 +08:00
parent c97ac4daf0
commit 76992f3e23
3 changed files with 22 additions and 33 deletions

View File

@ -14,25 +14,24 @@ const (
// CommonConfig defines the configuration of a docker daemon which are // CommonConfig defines the configuration of a docker daemon which are
// common across platforms. // common across platforms.
type CommonConfig struct { type CommonConfig struct {
AutoRestart bool AutoRestart bool
Bridge bridgeConfig // Bridge holds bridge network specific configuration. Bridge bridgeConfig // Bridge holds bridge network specific configuration.
Context map[string][]string Context map[string][]string
DisableBridge bool DisableBridge bool
DNS []string DNS []string
DNSOptions []string DNSOptions []string
DNSSearch []string DNSSearch []string
ExecOptions []string ExecOptions []string
ExecRoot string ExecRoot string
GraphDriver string GraphDriver string
GraphOptions []string GraphOptions []string
Labels []string Labels []string
LogConfig runconfig.LogConfig LogConfig runconfig.LogConfig
Mtu int Mtu int
Pidfile string Pidfile string
RemappedRoot string RemappedRoot string
Root string Root string
TrustKeyPath string TrustKeyPath string
DefaultNetwork string
// ClusterStore is the storage backend used for the cluster information. It is used by both // ClusterStore is the storage backend used for the cluster information. It is used by both
// multihost networking (to store networks and endpoints information) and by the node discovery // multihost networking (to store networks and endpoints information) and by the node discovery

View File

@ -554,7 +554,6 @@ func TestNetworkOptions(t *testing.T) {
daemon := &Daemon{} daemon := &Daemon{}
dconfigCorrect := &Config{ dconfigCorrect := &Config{
CommonConfig: CommonConfig{ CommonConfig: CommonConfig{
DefaultNetwork: "netPlugin:mynet:dev",
ClusterStore: "consul://localhost:8500", ClusterStore: "consul://localhost:8500",
ClusterAdvertise: "192.168.0.1:8000", ClusterAdvertise: "192.168.0.1:8000",
}, },

View File

@ -313,19 +313,10 @@ func (daemon *Daemon) networkOptions(dconfig *Config) ([]nwconfig.Option, error)
options = append(options, nwconfig.OptionDataDir(dconfig.Root)) options = append(options, nwconfig.OptionDataDir(dconfig.Root))
if strings.TrimSpace(dconfig.DefaultNetwork) != "" { dd := runconfig.DefaultDaemonNetworkMode()
dn := strings.Split(dconfig.DefaultNetwork, ":") dn := runconfig.DefaultDaemonNetworkMode().NetworkName()
if len(dn) < 2 { options = append(options, nwconfig.OptionDefaultDriver(string(dd)))
return nil, fmt.Errorf("default network daemon config must be of the form NETWORKDRIVER:NETWORKNAME") options = append(options, nwconfig.OptionDefaultNetwork(dn))
}
options = append(options, nwconfig.OptionDefaultDriver(dn[0]))
options = append(options, nwconfig.OptionDefaultNetwork(strings.Join(dn[1:], ":")))
} else {
dd := runconfig.DefaultDaemonNetworkMode()
dn := runconfig.DefaultDaemonNetworkMode().NetworkName()
options = append(options, nwconfig.OptionDefaultDriver(string(dd)))
options = append(options, nwconfig.OptionDefaultNetwork(dn))
}
if strings.TrimSpace(dconfig.ClusterStore) != "" { if strings.TrimSpace(dconfig.ClusterStore) != "" {
kv := strings.Split(dconfig.ClusterStore, "://") kv := strings.Split(dconfig.ClusterStore, "://")