misc

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NonExistErr

type NonExistErr string

NonExistErr VM, funcClient, etc does not exist.

func (NonExistErr) Error

func (e NonExistErr) Error() string

type VM

type VM struct {
	ID               string
	ContainerSnapKey string
	SnapBooted       bool
	Image            *containerd.Image
	Container        *containerd.Container
	Task             *containerd.Task
	TaskCh           <-chan containerd.ExitStatus
	NetConfig        *networking.NetworkConfig
}

VM type

func NewVM

func NewVM(vmID string) *VM

NewVM Initialize a VM

func (*VM) GetGatewayAddr

func (vm *VM) GetGatewayAddr() string

func (*VM) GetHostDevName

func (vm *VM) GetHostDevName() string

GetHostDevName returns the name of the VM host device

func (*VM) GetIP

func (vm *VM) GetIP() string

GetIP returns the IP at which the VM is reachable

func (*VM) GetMacAddress

func (vm *VM) GetMacAddress() string

GetMacAddress returns the name of the VM MAC address

func (*VM) GetNetworkNamespace

func (vm *VM) GetNetworkNamespace() string

func (*VM) GetPrimaryAddr

func (vm *VM) GetPrimaryAddr() string

GetPrimaryAddr returns the primary IP address of the VM

type VMPool

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

VMPool Pool of active VMs (can be in several states though)

func NewVMPool

func NewVMPool(hostIfaceName string, netPoolSize int) *VMPool

NewVMPool Initializes a pool of VMs

func (*VMPool) Allocate

func (p *VMPool) Allocate(vmID string) (*VM, error)

Allocate Initializes a VM, activates it and then adds it to VM map

func (*VMPool) CleanupNetwork

func (p *VMPool) CleanupNetwork()

CleanupNetwork Removes the networks created by the network manager

func (*VMPool) Free

func (p *VMPool) Free(vmID string) error

Free Removes a VM from the pool and transitions it to Deactivating

func (*VMPool) GetVM

func (p *VMPool) GetVM(vmID string) (*VM, error)

GetVM Returns a pointer to the VM

func (*VMPool) GetVMMap

func (p *VMPool) GetVMMap() map[string]*VM

GetVMMap Returns a copy of vmMap as a regular concurrency-unsafe map

Jump to

Keyboard shortcuts

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