net

package
v0.0.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FingerprintAttributeKeyPrefix is the key prefix to use when creating and
	// adding attributes during the fingerprint process.
	FingerprintAttributeKeyPrefix = "driver.virt.network."

	// NetworkStateActive is string representation to declare a network is in
	// active state. This is translated from "true" using the go-libvirt SDK
	// and 1 from the raw libvirt API when query if the network is active.
	NetworkStateActive = "active"

	// NetworkStateInactive is string representation to declare a network is in
	// inactive state. This is translated from "false" using the go-libvirt SDK
	// and 0 from the raw libvirt API when query if the network is active.
	NetworkStateInactive = "inactive"
)

Variables

This section is empty.

Functions

func IsActiveString

func IsActiveString(active bool) string

IsActiveString converts the boolean response from the IsActive call of libvirt network to a human-readable string. This string copies the vocabulary used by virsh for consistency.

func NetworkInterfaceHCLSpec

func NetworkInterfaceHCLSpec() *hclspec.Spec

NetworkInterfaceHCLSpec returns the HCL specification for a virtual machines network interface object.

Types

type NetworkInterfaceBridgeConfig

type NetworkInterfaceBridgeConfig struct {

	// Name is the name of the bridge interface to use. This relates to the
	// output seen from commands such as "ip addr show" or "virsh net-info".
	Name string `codec:"name"`

	// Ports contains a list of port labels which will be exposed on the host
	// via mapping to the network interface. These labels must exist within the
	// job specification network block.
	Ports []string `codec:"ports"`
}

NetworkInterfaceBridgeConfig is the network object when a VM is attached to a bridged network interface.

type NetworkInterfaceConfig

type NetworkInterfaceConfig struct {
	Bridge *NetworkInterfaceBridgeConfig `codec:"bridge"`
}

NetworkInterfaceConfig contains all the possible network interface options that a VM currently supports via the Nomad driver.

type NetworkInterfacesConfig

type NetworkInterfacesConfig []*NetworkInterfaceConfig

NetworkInterfacesConfig is the list of network interfaces that should be added to a VM. Currently, the driver only supports a single entry which is validated within the Validate function.

Due to its type, callers will need to dereference the object before performing iteration.

func (*NetworkInterfacesConfig) Validate

func (n *NetworkInterfacesConfig) Validate() error

Validate ensures the NetworkInterfaces is a valid object supported by the driver. Any error returned here should be considered terminal for a task and stop the process execution.

type TeardownSpec

type TeardownSpec struct {

	// IPTablesRules specifies the rules used to build the initial VM
	// networking. Each entry is a rule, the rule is a list of strings which
	// mimics how iptables is called.
	//   i[0] is the table name.
	//   i[1] is the chain name.
	//   i[2:] is the rule args.
	IPTablesRules [][]string
}

TeardownSpec contains a specification which will be stored in the task handle and used when stopping/killing the task. It should include information which either expedites the process or is critical to the process.

type VMStartedBuildRequest

type VMStartedBuildRequest struct {
	DomainName string
	NetConfig  *NetworkInterfacesConfig
	Resources  *drivers.Resources
}

VMStartedBuildRequest is the request object used to ask the network sub-system to perform its configuration, once a VM has been started.

type VMStartedBuildResponse

type VMStartedBuildResponse struct {

	// DriverNetwork is the object returned to Nomad once the task is started
	// and is used to populate service discovery. The network sub-system should
	// fill in all details; the driver will not do this and simply pass the
	// object straight onto Nomad.
	DriverNetwork *drivers.DriverNetwork

	// TeardownSpec contains a specification which will be stored in the task
	// handle and used when stopping/killing the task. It should include
	// information which either expedites the process or is critical to the
	// process.
	TeardownSpec *TeardownSpec
}

VMStartedBuildResponse is the response sent object once the network sub-system has performed its configuration for a running VM.

type VMTerminatedTeardownRequest

type VMTerminatedTeardownRequest struct {
	TeardownSpec *TeardownSpec
}

VMTerminatedTeardownRequest is the request object used to ask the network sub-system to perform its teardown of a VMs network configuration.

type VMTerminatedTeardownResponse

type VMTerminatedTeardownResponse struct{}

VMTerminatedTeardownResponse is the response object returned when the network sub-system has performed its teardown of a VMs network configuration.

Jump to

Keyboard shortcuts

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