Skip to content

Commit

Permalink
Move daemonconfig into daemon
Browse files Browse the repository at this point in the history
Signed-off-by: Solomon Hykes <[email protected]>
  • Loading branch information
Solomon Hykes committed Aug 13, 2014
1 parent c9c2718 commit a4befff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
5 changes: 4 additions & 1 deletion daemonconfig/config.go → daemon/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package daemonconfig
package daemon

import (
"github.com/docker/docker/daemon/networkdriver"
Expand All @@ -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
Expand Down
9 changes: 4 additions & 5 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -664,15 +663,15 @@ 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
}
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 != "" {
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 0 additions & 3 deletions daemonconfig/README.md

This file was deleted.

11 changes: 5 additions & 6 deletions docker/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
12 changes: 7 additions & 5 deletions integration/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a4befff

Please sign in to comment.