libvirt

package
v0.0.0-...-e279674 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: GPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

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

Runner implements the topology.Runner interface using libvirt/qemu.

func NewRunner

func NewRunner(opts ...RunnerOption) *Runner

NewRunner constructs a runner configured with the specified options.

func (*Runner) Destroy

func (r *Runner) Destroy(ctx context.Context, t *topology.T) (err error)

Destroy destroys any resources created by a previous Run invocation. Destroy may be called on a different Runner instance than Run as long as the instance was created using the same same of RunnerOptions.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, t *topology.T) (err error)

Run starts up the topology described by t.

type RunnerOption

type RunnerOption func(*Runner)

A RunnerOption may be passed to NewRunner to customize the Runner's behaviour.

func WithAuthorizedKeys

func WithAuthorizedKeys(keys ...string) RunnerOption

WithAuthorizedKeys adds the provided SSH public keys to authorized_keys for all started VMs.

func WithBMCAddr

func WithBMCAddr(a string) RunnerOption

WithBMCAddr specifies the address for any created virtual BMCs to bind to.

func WithConfigFS

func WithConfigFS(fsys fs.FS) RunnerOption

WithConfigFS specifies a filesystem implementation for loading config snippets requested with the node attribute config.

func WithConnectionURI

func WithConnectionURI(uri string) RunnerOption

WithConnectionURI sets the connection URI used to connect to libvirtd. Defaults to "qemu:///system".

func WithMACAddressBase

func WithMACAddressBase(mac net.HardwareAddr) RunnerOption

WithMACAddressBase determines the starting address for automatically assigned MAC addresses. Explicitly configured MAC addresses (left_mac/right_mac edge attributes) are unaffected by this option.

func WithNamePrefix

func WithNamePrefix(prefix string) RunnerOption

WithNamePrefix configures the prefix to use when naming resources like guest domains. The default is "runtopo-".

func WithPortBase

func WithPortBase(port int) RunnerOption

WithPortBase specifies the starting port for allocating UDP tunnel ports.

func WithPortGap

func WithPortGap(delta int) RunnerOption

WithPortGap sets the gap left between local and remote port. It limits the maximum number of connections supported in a topology.

func WithStoragePool

func WithStoragePool(pool string) RunnerOption

WithStoragePool sets the libvirt storage pool where we create volumes.

func WithTunnelIP

func WithTunnelIP(ip net.IP) RunnerOption

WithTunnelIP sets the default IP address for libvirt UDP tunnels. This is used only for devices that do not have an explicit address configured (tunnelip node attribute).

func WriteBMCConfig

func WriteBMCConfig(w io.Writer) RunnerOption

WriteBMCConfig configures the Runner to write to w a JSON document describing any virtual BMCs that were created.

func WriteSSHConfig

func WriteSSHConfig(w io.Writer) RunnerOption

WriteSSHConfig configures the Runner to write an OpenSSH client configuration file to w. See ssh_config(5) for a description of its format.

Notes

Bugs

  • The default MAC address range matches the one used by topology_converter. It belongs to Cumulus though and we probably shouldn't use it without asking them.

  • File mode and group owner of created volumes is hard-coded to 0644 and gid 107, respectively.

  • We only support QCOW2 backing files in QCOW2 format. There's no reason we couldn't work with QCOW2 volumes backed by RAW images.

Jump to

Keyboard shortcuts

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