vm

package
v0.0.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VMStateStarting  = VMState("starting")
	VMStateRunning   = VMState("running")
	VMStateShutdown  = VMState("shutdown")
	VMStatePowerOff  = VMState("poweroff")
	VMStateSuspended = VMState("suspended")
	VMStatePaused    = VMState("paused")
	VMStateError     = VMState("error")
	VMStateUnknown   = VMState("unknown")
)
View Source
const (

	// FingerprintAttributeKeyPrefix is the key prefix to use when creating and
	// adding attributes during the fingerprint process.
	FingerprintAttributeKeyPrefix = "driver.virt"
)

Variables

View Source
var (
	ErrEmptyName           = fmt.Errorf("%w - virtual machine name can not be empty", errs.ErrInvalidConfiguration)
	ErrMissingImage        = fmt.Errorf("%w - image path can not be empty", errs.ErrInvalidConfiguration)
	ErrNotEnoughDisk       = fmt.Errorf("%w - not enough disk space assigned to task", errs.ErrInvalidConfiguration)
	ErrNoCPUS              = fmt.Errorf("%w - no cpus configured, use resources.cores to assign cores in the job spec", errs.ErrInvalidConfiguration)
	ErrNotEnoughMemory     = fmt.Errorf("%w - not enough memory assigned to task", errs.ErrInvalidConfiguration)
	ErrIncompleteOSVariant = fmt.Errorf("%w - provided os information is incomplete: arch and machine are mandatory", errs.ErrInvalidConfiguration)
	ErrInvalidHostName     = fmt.Errorf("%w - a resource name must consist of lower case alphanumeric characters or '-', must start and end with an alphanumeric character and be less than %d characters", errs.ErrInvalidConfiguration, maxNameLength+1)
)

Functions

func IsValidLabel

func IsValidLabel(name string) bool

IsValidLabel returns true if the string given is a valid DNS label (RFC 1123). Note: the only difference between RFC 1035 and RFC 1123 labels is that in RFC 1123 labels can begin with a number.

func ValidateHostName

func ValidateHostName(name string) error

ValidateHostName returns an error a name is not a valid resource name. The error will contain reference to what constitutes a valid resource name.

Types

type Config

type Config struct {
	RemoveConfigFiles bool
	XMLConfig         string
	Name              string
	Memory            uint
	CPUset            string
	CPUs              uint
	OsVariant         *OSVariant
	HostName          string
	Timezone          *time.Location
	Mounts            []MountFileConfig
	Files             []File
	SSHKey            string
	Password          string
	CMDs              []string
	BOOTCMDs          []string
	CIUserData        string
	Volumes           []storage.Volume
	NetworkInterfaces net.NetworkInterfacesConfig
}

func (*Config) CloudInitConfig

func (vm *Config) CloudInitConfig() *cloudinit.Config

CloudInitConfig generates the cloud-init configuration from the configuration.

func (*Config) Copy

func (vm *Config) Copy() *Config

Copy makes a deep copy of the configuration.

func (*Config) Validate

func (vm *Config) Validate() error

Validate validates the configuration.

type File

type File struct {
	Path        string
	Content     string
	Permissions string
	Encoding    string
	Owner       string
	Group       string
}

type Info

type Info struct {
	RawState  string
	State     VMState
	Memory    uint64
	CPUTime   uint64
	MaxMemory uint64
	NrVirtCPU uint
}

type MountFileConfig

type MountFileConfig struct {
	Source      string
	Destination string
	ReadOnly    bool
	Tag         string
	Driver      string
}

type NetworkInterface

type NetworkInterface struct {
	NetworkName string
	DeviceName  string
	MAC         string
	Addrs       []netip.Addr
	Model       string
	Driver      string
}

type OSVariant

type OSVariant struct {
	Arch    string
	Machine string
}

type VMState

type VMState string

func (VMState) ToTaskState

func (v VMState) ToTaskState() drivers.TaskState

type VirtualizerInfo

type VirtualizerInfo struct {
	Model           string
	Memory          uint64
	FreeMemory      uint64
	Cpus            uint
	Cores           uint32
	EmulatorVersion uint32
	LibvirtVersion  uint32
	RunningDomains  uint
	InactiveDomains uint
	StoragePools    uint
}

Jump to

Keyboard shortcuts

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