container

package
v0.0.0-...-6337964 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2014 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigName   = "name"
	ConfigLogDir = "log-dir"
)
View Source
const (
	// BridgeNetwork will have the container use the network bridge.
	BridgeNetwork = "bridge"
	// PhyscialNetwork will have the container use a specified network device.
	PhysicalNetwork = "physical"
)

Variables

View Source
var (
	ContainerDir        = "/var/lib/juju/containers"
	RemovedContainerDir = "/var/lib/juju/removed-containers"
)

Functions

func NewDirectory

func NewDirectory(containerName string) (directory string, err error)

NewDirectory creates a new directory for the container name in the directory identified by `ContainerDir`.

func RemoveDirectory

func RemoveDirectory(containerName string) error

RemoveDirectory moves the container directory from `ContainerDir` to `RemovedContainerDir` and makes sure that the names don't clash.

func WriteCloudInitFile

func WriteCloudInitFile(directory string, userData []byte) (string, error)

WriteCloudInitFile writes the data out to a cloud-init file in the directory specified, and returns the filename.

func WriteUserData

func WriteUserData(machineConfig *cloudinit.MachineConfig, directory string) (string, error)

WriteUserData generates the cloud init for the specified machine config, and writes the serialized form out to a cloud-init file in the directory specified.

Types

type Initialiser

type Initialiser interface {
	// Initialise installs all required packages, sync any images etc so
	// that the host machine can run containers.
	Initialise() error
}

Initialiser is responsible for performing the steps required to initialise a host machine so it can run containers.

type Manager

type Manager interface {
	// CreateContainer creates and starts a new container for the specified
	// machine.
	CreateContainer(
		machineConfig *cloudinit.MachineConfig,
		series string,
		network *NetworkConfig) (instance.Instance, *instance.HardwareCharacteristics, error)

	// DestroyContainer stops and destroyes the container identified by
	// instance id.
	DestroyContainer(instance.Id) error

	// ListContainers return a list of containers that have been started by
	// this manager.
	ListContainers() ([]instance.Instance, error)
}

Manager is responsible for starting containers, and stopping and listing containers that it has started.

type ManagerConfig

type ManagerConfig map[string]string

ManagerConfig contains the initialization parameters for the ContainerManager. The name of the manager is used to namespace the containers on the machine.

func (ManagerConfig) PopValue

func (m ManagerConfig) PopValue(key string) string

PopValue returns the requested key from the config map. If the value doesn't exist, the function returns the empty string. If the value does exist, the value is returned, and the element removed from the map.

func (ManagerConfig) WarnAboutUnused

func (m ManagerConfig) WarnAboutUnused()

WarnAboutUnused emits a warning about each value in the map.

type NetworkConfig

type NetworkConfig struct {
	NetworkType string
	Device      string
}

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 PhysicalNetworkConfig

func PhysicalNetworkConfig(device string) *NetworkConfig

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

Directories

Path Synopsis
kvm
lxc

Jump to

Keyboard shortcuts

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