dock

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2013 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultDockerBridge is the package created container bridge
	DefaultDockerBridge = docker.DefaultNetworkBridge
)

Variables

This section is empty.

Functions

func FromNameToId

func FromNameToId(name string) (string, error)

func GenerateNetworkConfig

func GenerateNetworkConfig(network *NetworkConfig) string

func NetworkConfigTemplate

func NetworkConfigTemplate(networkType, networkLink string) string

func SetContainerDir

func SetContainerDir(dir string) (old string)

SetContainerDir allows tests in other packages to override the containerDir.

func SetLxcContainerDir

func SetLxcContainerDir(dir string) (old string)

SetLxcContainerDir allows tests in other packages to override the dockerContainerDir.

func SetLxcRestartDir

func SetLxcRestartDir(dir string) (old string)

SetLxcRestartDir allows tests in other packages to override the lxcRestartDir, which contains the symlinks to the config files so containers can be auto-restarted on reboot.

func SetRemovedContainerDir

func SetRemovedContainerDir(dir string) (old string)

SetRemovedContainerDir allows tests in other packages to override the removedContainerDir.

Types

type ContainerManager

type ContainerManager interface {
	// StartContainer creates and starts a new lxc container for the specified machine.
	StartContainer(
		machineId, series, nonce string,
		network *NetworkConfig,
		tools *tools.Tools,
		environConfig *config.Config,
		stateInfo *state.Info,
		apiInfo *api.Info) (instance.Instance, error)
	// StopContainer stops and destroyes the lxc container identified by Instance.
	StopContainer(instance.Instance) error
	// ListContainers return a list of containers that have been started by
	// this manager.
	ListContainers() ([]instance.Instance, error)
}

ContainerManager is responsible for starting containers, and stopping and listing containers that it has started. The name of the manager is used to namespace the docker containers on the machine.

func NewContainerManager

func NewContainerManager(conf ManagerConfig) ContainerManager

NewContainerManager returns a manager object that can start and stop docker containers. The containers that are created are namespaced by the name parameter.

type ManagerConfig

type ManagerConfig struct {
	Name   string
	LogDir string
}

ManagerConfig contains the initialization parameters for the ContainerManager.

type NetworkConfig

type NetworkConfig struct {
	// contains filtered or unexported fields
}

NetworkConfig defines how the container network will be configured.

func BridgeNetworkConfig

func BridgeNetworkConfig(device string) *NetworkConfig

BridgeNetworkConfig returns a valid NetworkConfig to use the specified device as a network bridge for the container.

func DefaultNetworkConfig

func DefaultNetworkConfig() *NetworkConfig

DefaultNetworkConfig returns a valid NetworkConfig to use the defaultDockerBridge that is created by the lxc package.

func PhysicalNetworkConfig

func PhysicalNetworkConfig(device string) *NetworkConfig

PhysicalNetworkConfig returns a valid NetworkConfig to use the specified device as the network device for the container.

type TestSuite

type TestSuite struct {
	//Factory            mock.ContainerFactory
	//oldFactory         golxc.ContainerFactory
	ContainerDir string
	RemovedDir   string
	LxcDir       string
	RestartDir   string
	// contains filtered or unexported fields
}

TestSuite replaces the lxc factory that the broker uses with a mock implementation.

func (*TestSuite) SetUpSuite

func (s *TestSuite) SetUpSuite(c *gc.C)

func (*TestSuite) SetUpTest

func (s *TestSuite) SetUpTest(c *gc.C)

func (*TestSuite) TearDownSuite

func (s *TestSuite) TearDownSuite(c *gc.C)

func (*TestSuite) TearDownTest

func (s *TestSuite) TearDownTest(c *gc.C)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL