define

package
v5.2.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIdentityName = "machine"
View Source
const MaxSocketPathLength int = 103
View Source
const MountTag = "rosetta"

MountTag is an identifier to mount a VirtioFS file system tag on a mount point in the VM. Ref: https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta

View Source
const UserCertsTargetPath = "/etc/containers/certs.d"

Variables

View Source
var (
	ErrNoSuchVM         = errors.New("VM does not exist")
	ErrWrongState       = errors.New("VM in wrong state to perform action")
	ErrVMAlreadyExists  = errors.New("VM already exists")
	ErrVMAlreadyRunning = errors.New("VM already running or starting")
	ErrMultipleActiveVM = errors.New("only one VM can be active at a time")
	ErrNotImplemented   = errors.New("functionality not implemented")
)
View Source
var (
	DefaultFilePerm os.FileMode = 0644
)

Functions

This section is empty.

Types

type Artifact

type Artifact int64
const (
	Qemu Artifact = iota
	HyperV
	AppleHV
	None
)

func (Artifact) String

func (a Artifact) String() string

type CreateVMOpts

type CreateVMOpts struct {
	Name               string
	Dirs               *MachineDirs
	ReExec             bool
	UserModeNetworking bool
}

type ErrIncompatibleMachineConfig

type ErrIncompatibleMachineConfig struct {
	Name string
	Path string
}

func (*ErrIncompatibleMachineConfig) Error

func (err *ErrIncompatibleMachineConfig) Error() string

type ErrNewDiskSizeTooSmall

type ErrNewDiskSizeTooSmall struct {
	OldSize, NewSize strongunits.GiB
}

func (*ErrNewDiskSizeTooSmall) Error

func (err *ErrNewDiskSizeTooSmall) Error() string

type ErrVMDoesNotExist

type ErrVMDoesNotExist struct {
	Name string
}

func (*ErrVMDoesNotExist) Error

func (err *ErrVMDoesNotExist) Error() string

type ErrVMRunningCannotDestroyed

type ErrVMRunningCannotDestroyed struct {
	Name string
}

func (*ErrVMRunningCannotDestroyed) Error

func (err *ErrVMRunningCannotDestroyed) Error() string

type ImageFormat

type ImageFormat int64
const (
	Qcow ImageFormat = iota
	Vhdx
	Tar
	Raw
)

func (ImageFormat) Kind

func (imf ImageFormat) Kind() string

func (ImageFormat) KindWithCompression

func (imf ImageFormat) KindWithCompression() string

type InitOptions

type InitOptions struct {
	CPUS               uint64
	DiskSize           uint64
	IgnitionPath       string
	Image              string
	Volumes            []string
	IsDefault          bool
	Memory             uint64
	Name               string
	TimeZone           string
	URI                url.URL
	Username           string
	ReExec             bool
	Rootful            bool
	UID                string // uid of the user that called machine
	UserModeNetworking *bool  // nil = use backend/system default, false = disable, true = enable
	USBs               []string
}

type MachineDirs

type MachineDirs struct {
	ConfigDir     *VMFile
	DataDir       *VMFile
	ImageCacheDir *VMFile
	RuntimeDir    *VMFile
}

type SetOptions

type SetOptions struct {
	CPUs               *uint64
	DiskSize           *strongunits.GiB
	Memory             *strongunits.MiB
	Rootful            *bool
	UserModeNetworking *bool
	USBs               *[]string
}

type Status

type Status = string
const Running Status = "running"

Running indicates the qemu vm is running.

const Starting Status = "starting"

Starting indicated the vm is in the process of starting

const Stopped Status = "stopped"

Stopped indicates the vm has stopped.

const Unknown Status = "unknown"

Unknown means the state is not known

type USBConfig

type USBConfig struct {
	Bus       string
	DevNumber string
	Vendor    int
	Product   int
}

func ParseUSBs

func ParseUSBs(usbs []string) ([]USBConfig, error)

type VMFile

type VMFile struct {
	// Path is the fully qualified path to a file
	Path string
	// Symlink is a shortened version of Path by using
	// a symlink
	Symlink *string `json:"symlink,omitempty"`
}

func NewMachineFile

func NewMachineFile(path string, symlink *string) (*VMFile, error)

NewMachineFile is a constructor for VMFile

func (*VMFile) AppendToNewVMFile

func (m *VMFile) AppendToNewVMFile(additionalPath string, symlink *string) (*VMFile, error)

AppendToNewVMFile takes a given path and appends it to the existing vmfile path. The new VMFile is returned

func (*VMFile) Delete

func (m *VMFile) Delete() error

Delete removes the machinefile symlink (if it exists) and the actual path

func (*VMFile) GetPath

func (m *VMFile) GetPath() string

GetPath returns the working path for a machinefile. it returns the symlink unless one does not exist

func (*VMFile) Read

func (m *VMFile) Read() ([]byte, error)

Read the contents of a given file and return in []bytes

func (*VMFile) ReadMagicNumber

func (m *VMFile) ReadMagicNumber(n int) ([]byte, error)

Read the first n bytes of a given file and return in []bytes

func (*VMFile) ReadPIDFrom

func (m *VMFile) ReadPIDFrom() (int, error)

ReadPIDFrom a file and return as int. -1 means the pid file could not be read or had something that could not be converted to an int in it

type VMType

type VMType int64
const (
	QemuVirt VMType = iota
	WSLVirt
	AppleHvVirt
	HyperVVirt
	LibKrun
	UnknownVirt
)

func ParseVMType

func ParseVMType(input string, emptyFallback VMType) (VMType, error)

func (VMType) DiskType added in v5.1.0

func (v VMType) DiskType() string

DiskType returns a string representation that matches the OCI artifact type on the container image registry

func (VMType) ImageFormat

func (v VMType) ImageFormat() ImageFormat

func (VMType) String

func (v VMType) String() string

Jump to

Keyboard shortcuts

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