diff --git a/daemonconfig/config.go b/daemon/config.go similarity index 84% rename from daemonconfig/config.go rename to daemon/config.go index 13c2a5db5c..0f269da869 100644 --- a/daemonconfig/config.go +++ b/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 diff --git a/daemon/daemon.go b/daemon/daemon.go index d65bad8b82..0a2ad4c315 100644 --- a/daemon/daemon.go +++ b/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 } diff --git a/daemonconfig/README.md b/daemonconfig/README.md deleted file mode 100644 index b61df1449e..0000000000 --- a/daemonconfig/README.md +++ /dev/null @@ -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` diff --git a/docker/daemon.go b/docker/daemon.go index 6a4d767733..2866f6990c 100644 --- a/docker/daemon.go +++ b/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 { diff --git a/integration/utils_test.go b/integration/utils_test.go index 29741465a8..a7f3f999e2 100644 --- a/integration/utils_test.go +++ b/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)