Browse Source

Move daemonconfig into daemon

Signed-off-by: Solomon Hykes <solomon@docker.com>
Solomon Hykes 11 years ago
parent
commit
a4befff533
5 changed files with 20 additions and 20 deletions
  1. 4 1
      daemon/config.go
  2. 4 5
      daemon/daemon.go
  3. 0 3
      daemonconfig/README.md
  4. 5 6
      docker/daemon.go
  5. 7 5
      integration/utils_test.go

+ 4 - 1
daemonconfig/config.go → daemon/config.go

@@ -1,4 +1,4 @@
-package daemonconfig
+package daemon
 
 import (
 	"github.com/docker/docker/daemon/networkdriver"
@@ -10,6 +10,9 @@ const (
 	DisableNetworkBridge = "none"
 )
 
+// Config define the configuration of a docker daemon
+//  These are the configuration settings that you pass
+// to the docker daemon when you launch it with say: `docker -d -e lxc`
 // FIXME: separate runtime configuration from http api configuration
 type Config struct {
 	Pidfile                     string

+ 4 - 5
daemon/daemon.go

@@ -21,7 +21,6 @@ import (
 	_ "github.com/docker/docker/daemon/graphdriver/vfs"
 	_ "github.com/docker/docker/daemon/networkdriver/bridge"
 	"github.com/docker/docker/daemon/networkdriver/portallocator"
-	"github.com/docker/docker/daemonconfig"
 	"github.com/docker/docker/dockerversion"
 	"github.com/docker/docker/engine"
 	"github.com/docker/docker/graph"
@@ -95,7 +94,7 @@ type Daemon struct {
 	sysInfo        *sysinfo.SysInfo
 	volumes        *graph.Graph
 	eng            *engine.Engine
-	config         *daemonconfig.Config
+	config         *Config
 	containerGraph *graphdb.Database
 	driver         graphdriver.Driver
 	execDriver     execdriver.Driver
@@ -664,7 +663,7 @@ func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.
 }
 
 // FIXME: harmonize with NewGraph()
-func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
+func NewDaemon(config *Config, eng *engine.Engine) (*Daemon, error) {
 	daemon, err := NewDaemonFromDirectory(config, eng)
 	if err != nil {
 		return nil, err
@@ -672,7 +671,7 @@ func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error)
 	return daemon, nil
 }
 
-func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
+func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) {
 	// Claim the pidfile first, to avoid any and all unexpected race conditions.
 	// Some of the init doesn't need a pidfile lock - but let's not try to be smart.
 	if config.Pidfile != "" {
@@ -1010,7 +1009,7 @@ func (daemon *Daemon) Repositories() *graph.TagStore {
 	return daemon.repositories
 }
 
-func (daemon *Daemon) Config() *daemonconfig.Config {
+func (daemon *Daemon) Config() *Config {
 	return daemon.config
 }
 

+ 0 - 3
daemonconfig/README.md

@@ -1,3 +0,0 @@
-This directory contains code pertaining to the configuration of the docker daemon
-
-These are the configuration settings that you pass to the docker daemon when you launch it with say: `docker -d -e lxc`

+ 5 - 6
docker/daemon.go

@@ -10,7 +10,6 @@ import (
 	"github.com/docker/docker/daemon"
 	_ "github.com/docker/docker/daemon/execdriver/lxc"
 	_ "github.com/docker/docker/daemon/execdriver/native"
-	"github.com/docker/docker/daemonconfig"
 	"github.com/docker/docker/dockerversion"
 	"github.com/docker/docker/engine"
 	flag "github.com/docker/docker/pkg/mflag"
@@ -48,8 +47,8 @@ func mainDaemon() {
 	// the http api so that connections don't fail while the daemon
 	// is booting
 	go func() {
-		// FIXME: daemonconfig and CLI flag parsing should be directly integrated
-		cfg := &daemonconfig.Config{
+		// FIXME: daemon config and CLI flag parsing should be directly integrated
+		cfg := &daemon.Config{
 			Pidfile:                     *pidfile,
 			Root:                        *flRoot,
 			AutoRestart:                 *flAutoRestart,
@@ -68,12 +67,12 @@ func mainDaemon() {
 			Mtu:                         *flMtu,
 			Sockets:                     flHosts.GetAll(),
 		}
-		// FIXME this should be initialized in NewDaemon or somewhere in daemonconfig.
+		// FIXME this should be initialized in NewDaemon or somewhere in daemon.
 		// Currently it is copy-pasted in `integration` to create test daemons that work.
 		if cfg.Mtu == 0 {
-			cfg.Mtu = daemonconfig.GetDefaultNetworkMtu()
+			cfg.Mtu = daemon.GetDefaultNetworkMtu()
 		}
-		cfg.DisableNetwork = cfg.BridgeIface == daemonconfig.DisableNetworkBridge
+		cfg.DisableNetwork = cfg.BridgeIface == daemon.DisableNetworkBridge
 
 		d, err := daemon.NewDaemon(cfg, eng)
 		if err != nil {

+ 7 - 5
integration/utils_test.go

@@ -17,7 +17,6 @@ import (
 
 	"github.com/docker/docker/builtins"
 	"github.com/docker/docker/daemon"
-	"github.com/docker/docker/daemonconfig"
 	"github.com/docker/docker/engine"
 	"github.com/docker/docker/runconfig"
 	"github.com/docker/docker/utils"
@@ -179,17 +178,20 @@ func newTestEngine(t utils.Fataler, autorestart bool, root string) *engine.Engin
 	// Load default plugins
 	builtins.Register(eng)
 	// (This is manually copied and modified from main() until we have a more generic plugin system)
-	cfg := &daemonconfig.Config{
+	cfg := &daemon.Config{
 		Root:        root,
 		AutoRestart: autorestart,
 		ExecDriver:  "native",
+		// Either InterContainerCommunication or EnableIptables must be set,
+		// otherwise NewDaemon will fail because of conflicting settings.
+		InterContainerCommunication: true,
 	}
-	// FIXME: this should be initialized in NewDaemon or somewhere in daemonconfig.
+	// FIXME: this should be initialized in NewDaemon
 	// Currently it is copy-pasted from daemonMain()
 	if cfg.Mtu == 0 {
-		cfg.Mtu = daemonconfig.GetDefaultNetworkMtu()
+		cfg.Mtu = daemon.GetDefaultNetworkMtu()
 	}
-	cfg.DisableNetwork = cfg.BridgeIface == daemonconfig.DisableNetworkBridge
+	cfg.DisableNetwork = cfg.BridgeIface == daemon.DisableNetworkBridge
 	d, err := daemon.NewDaemon(cfg, eng)
 	if err != nil {
 		t.Fatal(err)