فهرست منبع

Merge pull request #17261 from mountkin/remove-unused-daemon-config

remove the unused DefaultNetwork member from daemon.Config
Michael Crosby 9 سال پیش
والد
کامیت
3f508f08de
3فایلهای تغییر یافته به همراه22 افزوده شده و 33 حذف شده
  1. 18 19
      daemon/config.go
  2. 0 1
      daemon/daemon_test.go
  3. 4 13
      daemon/daemon_unix.go

+ 18 - 19
daemon/config.go

@@ -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
-	Bridge         bridgeConfig // Bridge holds bridge network specific configuration.
-	Context        map[string][]string
-	DisableBridge  bool
-	DNS            []string
-	DNSOptions     []string
-	DNSSearch      []string
-	ExecOptions    []string
-	ExecRoot       string
-	GraphDriver    string
-	GraphOptions   []string
-	Labels         []string
-	LogConfig      runconfig.LogConfig
-	Mtu            int
-	Pidfile        string
-	RemappedRoot   string
-	Root           string
-	TrustKeyPath   string
-	DefaultNetwork string
+	AutoRestart   bool
+	Bridge        bridgeConfig // Bridge holds bridge network specific configuration.
+	Context       map[string][]string
+	DisableBridge bool
+	DNS           []string
+	DNSOptions    []string
+	DNSSearch     []string
+	ExecOptions   []string
+	ExecRoot      string
+	GraphDriver   string
+	GraphOptions  []string
+	Labels        []string
+	LogConfig     runconfig.LogConfig
+	Mtu           int
+	Pidfile       string
+	RemappedRoot  string
+	Root          string
+	TrustKeyPath  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

+ 0 - 1
daemon/daemon_test.go

@@ -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",
 		},
 		},

+ 4 - 13
daemon/daemon_unix.go

@@ -309,19 +309,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) != "" {
-		dn := strings.Split(dconfig.DefaultNetwork, ":")
-		if len(dn) < 2 {
-			return nil, fmt.Errorf("default network daemon config must be of the form NETWORKDRIVER:NETWORKNAME")
-		}
-		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))
-	}
+	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, "://")