Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BridgeNameForDevice ¶
The general policy is to: 1. Add br- to device name (to keep current behaviour), if it doesn fit in 15 characters then: 2. Add b- to device name, if it doesn't fit in 15 characters then: 3a. For devices starting in 'en' remove 'en' and add 'b-' 3b. For all other devices 'b-' + 6-char hash of name + '-' + last 6 chars of name 4. If using the device name directly always replace '.' with '-', to make sure that bridges from VLANs won't break
Types ¶
type BridgePolicy ¶
type BridgePolicy struct { // NetBondReconfigureDelay is how much of a delay to inject if we see that // one of the devices being bridged is a BondDevice. This exists because of // https://bugs.launchpad.net/juju/+bug/1657579 NetBondReconfigureDelay int // ContainerNetworkingMethod defines the way containers are networked. // It's one of: // - fan // - provider // - local ContainerNetworkingMethod string }
BridgePolicy defines functionality that helps us create and define bridges for guests inside of a host machine, along with the creation of network devices on those bridges for the containers to use. Ideally BridgePolicy would be defined outside of the 'state' package as it doesn't deal directly with DB content, but not quite enough of State is exposed
func (*BridgePolicy) FindMissingBridgesForContainer ¶
func (b *BridgePolicy) FindMissingBridgesForContainer(m Machine, containerMachine Container) ([]network.DeviceToBridge, int, error)
FindMissingBridgesForContainer looks at the spaces that the container wants to be in, and sees if there are any host devices that should be bridged. This will return an Error if the container wants a space that the host machine cannot provide.
func (*BridgePolicy) PopulateContainerLinkLayerDevices ¶
func (p *BridgePolicy) PopulateContainerLinkLayerDevices(m Machine, containerMachine Container) error
PopulateContainerLinkLayerDevices sets the link-layer devices of the given containerMachine, setting each device linked to the corresponding BridgeDevice of the host machine. It also records when one of the desired spaces is available on the host machine, but not currently bridged.
type Charm ¶
type Charm interface { LXDProfile() *jujucharm.LXDProfile Revision() int }
type Container ¶
type Container interface { Machine ContainerType() instance.ContainerType DesiredSpaces() (set.Strings, error) }
Machine is an indirection for state.Machine, describing a container.
type LinkLayerDevice ¶
type LinkLayerDevice interface { Name() string Type() state.LinkLayerDeviceType MACAddress() string ParentName() string ParentDevice() (LinkLayerDevice, error) EthernetDeviceForBridge(name string) (state.LinkLayerDeviceArgs, error) Addresses() ([]*state.Address, error) // These are recruited in tests. See comment on Machine below. MTU() uint IsUp() bool IsAutoStart() bool }
LinkLayerDevice is an indirection for state.LinkLayerDevice. It facilitates testing the provisioner's use of this package.
type Machine ¶
type Machine interface { Id() string AllSpaces() (set.Strings, error) LinkLayerDevicesForSpaces([]string) (map[string][]LinkLayerDevice, error) SetLinkLayerDevices(devicesArgs ...state.LinkLayerDeviceArgs) (err error) AllLinkLayerDevices() ([]LinkLayerDevice, error) // TODO (manadart 2018-10-10) These methods are used in tests, which rely // on the StateSuite. Some of them are recruited via the Container // interface below, but they are all located here for simplicity. // A better approach could be sought that does not require their // presence here. SetDevicesAddresses(devicesAddresses ...state.LinkLayerDeviceAddress) (err error) SetParentLinkLayerDevicesBeforeTheirChildren(devicesArgs []state.LinkLayerDeviceArgs) error SetConstraints(cons constraints.Value) (err error) RemoveAllAddresses() error Raw() *state.Machine }
Machine is an indirection for state.Machine, describing a machine that is to host containers.
type MachineShim ¶
MachineShim implements Machine. It is required to mock the return of LinkLayerDevicesForSpaces, which includes raw state.LinkLayerDevice references.
func (*MachineShim) AllLinkLayerDevices ¶
func (m *MachineShim) AllLinkLayerDevices() ([]LinkLayerDevice, error)
AllLinkLayerDevices implements Machine by wrapping each state.LinkLayerDevice reference in returned collection with the local LinkLayerDevice implementation.
func (*MachineShim) LinkLayerDevicesForSpaces ¶
func (m *MachineShim) LinkLayerDevicesForSpaces(spaces []string) (map[string][]LinkLayerDevice, error)
LinkLayerDevicesForSpaces implements Machine by unwrapping the inner state.Machine call and wrapping the raw state.LinkLayerDevice references with the local LinkLayerDevice implementation.
func (*MachineShim) Raw ¶
func (m *MachineShim) Raw() *state.Machine
Raw returns the inner state.Machine reference.
func (*MachineShim) Units ¶
func (m *MachineShim) Units() ([]Unit, error)
type Unit ¶
type Unit interface { Application() (Application, error) Name() string }