Documentation ¶
Index ¶
- Constants
- func FromNameToId(name string) (string, error)
- func GenerateNetworkConfig(network *NetworkConfig) string
- func NetworkConfigTemplate(networkType, networkLink string) string
- func SetContainerDir(dir string) (old string)
- func SetLxcContainerDir(dir string) (old string)
- func SetLxcRestartDir(dir string) (old string)
- func SetRemovedContainerDir(dir string) (old string)
- type ContainerManager
- type ManagerConfig
- type NetworkConfig
- type TestSuite
Constants ¶
const ( // DefaultDockerBridge is the package created container bridge DefaultDockerBridge = docker.DefaultNetworkBridge )
Variables ¶
This section is empty.
Functions ¶
func FromNameToId ¶
func GenerateNetworkConfig ¶
func GenerateNetworkConfig(network *NetworkConfig) string
func NetworkConfigTemplate ¶
func SetContainerDir ¶
SetContainerDir allows tests in other packages to override the containerDir.
func SetLxcContainerDir ¶
SetLxcContainerDir allows tests in other packages to override the dockerContainerDir.
func SetLxcRestartDir ¶
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 ¶
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 ¶
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.