Documentation ¶
Index ¶
- Constants
- Variables
- func FillCopyToHostDefaults(rule *CopyToHost, instDir string, user User, param map[string]string)
- func FillDefault(y, d, o *LimaYAML, filePath string, warn bool)
- func FillPortForwardDefaults(rule *PortForward, instDir string, user User, param map[string]string)
- func FirstUsernetIndex(l *LimaYAML) int
- func HasHostCPU() bool
- func HasMaxCPU() bool
- func IsAccelOS() bool
- func IsNativeArch(arch Arch) bool
- func MACAddress(uniqueID string) string
- func Marshal(y *LimaYAML, stream bool) ([]byte, error)
- func Unmarshal(data []byte, v interface{}, comment string) error
- func Validate(y *LimaYAML, warn bool) error
- func ValidateParamIsUsed(y *LimaYAML) error
- type Arch
- type Audio
- type CACertificates
- type CPUType
- type Containerd
- type ContainerdYAML
- type CopyToHost
- type Disk
- type File
- type FileWithVMType
- type Firmware
- type HostResolver
- type Image
- type Kernel
- type LimaYAML
- type Mount
- type MountType
- type Network
- type NineP
- type OS
- type PortForward
- type Probe
- type ProbeMode
- type Proto
- type Provision
- type ProvisionMode
- type QEMUOpts
- type Rosetta
- type SFTPDriver
- type SSH
- type SSHFS
- type User
- type VMOpts
- type VMType
- type VNCOptions
- type Video
- type Virtiofs
Constants ¶
const ( // Default9pSecurityModel is "none" for supporting symlinks // https://gitlab.com/qemu-project/qemu/-/issues/173 Default9pSecurityModel string = "none" Default9pProtocolVersion string = "9p2000.L" Default9pMsize string = "128KiB" Default9pCacheForRO string = "fscache" Default9pCacheForRW string = "mmap" DefaultVirtiofsQueueSize int = 1024 )
const ( LINUX OS = "Linux" X8664 Arch = "x86_64" AARCH64 Arch = "aarch64" ARMV7L Arch = "armv7l" RISCV64 Arch = "riscv64" REVSSHFS MountType = "reverse-sshfs" NINEP MountType = "9p" VIRTIOFS MountType = "virtiofs" WSLMount MountType = "wsl2" QEMU VMType = "qemu" VZ VMType = "vz" WSL2 VMType = "wsl2" )
const ( SFTPDriverBuiltin = "builtin" SFTPDriverOpenSSHSFTPServer = "openssh-sftp-server" )
Variables ¶
var ( OSTypes = []OS{LINUX} ArchTypes = []Arch{X8664, AARCH64, ARMV7L, RISCV64} MountTypes = []MountType{REVSSHFS, NINEP, VIRTIOFS, WSLMount} VMTypes = []VMType{QEMU, VZ, WSL2} )
var (
IPv4loopback1 = net.IPv4(127, 0, 0, 1)
)
Functions ¶
func FillCopyToHostDefaults ¶ added in v0.15.0
func FillCopyToHostDefaults(rule *CopyToHost, instDir string, user User, param map[string]string)
func FillDefault ¶
FillDefault updates undefined fields in y with defaults from d (or built-in default), and overwrites with values from o. Both d and o may be empty.
Maps (`Env`) are being merged: first populated from d, overwritten by y, and again overwritten by o. Slices (e.g. `Mounts`, `Provision`) are appended, starting with o, followed by y, and finally d. This makes sure o takes priority over y over d, in cases it matters (e.g. `PortForwards`, where the first matching rule terminates the search).
Exceptions:
- Mounts are appended in d, y, o order, but "merged" when the Location matches a previous entry; the highest priority Writable setting wins.
- Networks are appended in d, y, o order
- DNS are picked from the highest priority where DNS is not empty.
- CACertificates Files and Certs are uniquely appended in d, y, o order
func FillPortForwardDefaults ¶
func FillPortForwardDefaults(rule *PortForward, instDir string, user User, param map[string]string)
func FirstUsernetIndex ¶ added in v0.16.0
FirstUsernetIndex gets the index of first usernet network under l.Network[]. Returns -1 if no usernet network found.
func HasHostCPU ¶ added in v0.11.1
func HasHostCPU() bool
func IsNativeArch ¶ added in v0.8.3
func MACAddress ¶
func ValidateParamIsUsed ¶ added in v0.23.0
ValidateParamIsUsed checks if the keys in the `param` field are used in any script, probe, copyToHost, or portForward. It should be called before the `y` parameter is passed to FillDefault() that execute template.
Types ¶
type Audio ¶ added in v0.16.0
type Audio struct { // Device is a QEMU audiodev string Device *string `yaml:"device,omitempty" json:"device,omitempty" jsonschema:"nullable"` }
type CACertificates ¶ added in v0.10.0
type CACertificates struct { RemoveDefaults *bool `yaml:"removeDefaults,omitempty" json:"removeDefaults,omitempty" jsonschema:"nullable"` // default: false Files []string `yaml:"files,omitempty" json:"files,omitempty" jsonschema:"nullable"` Certs []string `yaml:"certs,omitempty" json:"certs,omitempty" jsonschema:"nullable"` }
type Containerd ¶
type Containerd struct { System *bool `yaml:"system,omitempty" json:"system,omitempty" jsonschema:"nullable"` // default: false User *bool `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"nullable"` // default: true Archives []File `yaml:"archives,omitempty" json:"archives,omitempty"` // default: see defaultContainerdArchives }
type ContainerdYAML ¶ added in v1.0.0
type ContainerdYAML struct {
Archives []File
}
type CopyToHost ¶ added in v0.15.0
type FileWithVMType ¶ added in v0.19.1
type Firmware ¶
type Firmware struct { // LegacyBIOS disables UEFI if set. // LegacyBIOS is ignored for aarch64. LegacyBIOS *bool `yaml:"legacyBIOS,omitempty" json:"legacyBIOS,omitempty" jsonschema:"nullable"` // Images specify UEFI images (edk2-aarch64-code.fd.gz). // Defaults to built-in UEFI. Images []FileWithVMType `yaml:"images,omitempty" json:"images,omitempty"` }
type HostResolver ¶ added in v0.8.1
type LimaYAML ¶
type LimaYAML struct { MinimumLimaVersion *string `yaml:"minimumLimaVersion,omitempty" json:"minimumLimaVersion,omitempty" jsonschema:"nullable"` VMType *VMType `yaml:"vmType,omitempty" json:"vmType,omitempty" jsonschema:"nullable"` VMOpts VMOpts `yaml:"vmOpts,omitempty" json:"vmOpts,omitempty"` OS *OS `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"nullable"` Arch *Arch `yaml:"arch,omitempty" json:"arch,omitempty" jsonschema:"nullable"` Images []Image `yaml:"images" json:"images"` // REQUIRED CPUType CPUType `yaml:"cpuType,omitempty" json:"cpuType,omitempty" jsonschema:"nullable"` CPUs *int `yaml:"cpus,omitempty" json:"cpus,omitempty" jsonschema:"nullable"` Memory *string `yaml:"memory,omitempty" json:"memory,omitempty" jsonschema:"nullable"` // go-units.RAMInBytes Disk *string `yaml:"disk,omitempty" json:"disk,omitempty" jsonschema:"nullable"` // go-units.RAMInBytes AdditionalDisks []Disk `yaml:"additionalDisks,omitempty" json:"additionalDisks,omitempty" jsonschema:"nullable"` Mounts []Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"` MountTypesUnsupported []string `yaml:"mountTypesUnsupported,omitempty" json:"mountTypesUnsupported,omitempty" jsonschema:"nullable"` MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty" jsonschema:"nullable"` MountInotify *bool `yaml:"mountInotify,omitempty" json:"mountInotify,omitempty" jsonschema:"nullable"` SSH SSH `yaml:"ssh,omitempty" json:"ssh,omitempty"` // REQUIRED (FIXME) Firmware Firmware `yaml:"firmware,omitempty" json:"firmware,omitempty"` Audio Audio `yaml:"audio,omitempty" json:"audio,omitempty"` Video Video `yaml:"video,omitempty" json:"video,omitempty"` Provision []Provision `yaml:"provision,omitempty" json:"provision,omitempty"` UpgradePackages *bool `yaml:"upgradePackages,omitempty" json:"upgradePackages,omitempty" jsonschema:"nullable"` Containerd Containerd `yaml:"containerd,omitempty" json:"containerd,omitempty"` GuestInstallPrefix *string `yaml:"guestInstallPrefix,omitempty" json:"guestInstallPrefix,omitempty" jsonschema:"nullable"` Probes []Probe `yaml:"probes,omitempty" json:"probes,omitempty"` PortForwards []PortForward `yaml:"portForwards,omitempty" json:"portForwards,omitempty"` CopyToHost []CopyToHost `yaml:"copyToHost,omitempty" json:"copyToHost,omitempty"` Message string `yaml:"message,omitempty" json:"message,omitempty"` Networks []Network `yaml:"networks,omitempty" json:"networks,omitempty" jsonschema:"nullable"` // `network` was deprecated in Lima v0.7.0, removed in Lima v0.14.0. Use `networks` instead. Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"` Param map[string]string `yaml:"param,omitempty" json:"param,omitempty"` DNS []net.IP `yaml:"dns,omitempty" json:"dns,omitempty"` HostResolver HostResolver `yaml:"hostResolver,omitempty" json:"hostResolver,omitempty"` // `useHostResolver` was deprecated in Lima v0.8.1, removed in Lima v0.14.0. Use `hostResolver.enabled` instead. PropagateProxyEnv *bool `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty" jsonschema:"nullable"` CACertificates CACertificates `yaml:"caCerts,omitempty" json:"caCerts,omitempty"` Rosetta Rosetta `yaml:"rosetta,omitempty" json:"rosetta,omitempty"` Plain *bool `yaml:"plain,omitempty" json:"plain,omitempty" jsonschema:"nullable"` TimeZone *string `yaml:"timezone,omitempty" json:"timezone,omitempty" jsonschema:"nullable"` NestedVirtualization *bool `yaml:"nestedVirtualization,omitempty" json:"nestedVirtualization,omitempty" jsonschema:"nullable"` User User `yaml:"user,omitempty" json:"user,omitempty"` }
type Mount ¶
type Mount struct { Location string `yaml:"location" json:"location"` // REQUIRED MountPoint *string `yaml:"mountPoint,omitempty" json:"mountPoint,omitempty" jsonschema:"nullable"` Writable *bool `yaml:"writable,omitempty" json:"writable,omitempty" jsonschema:"nullable"` SSHFS SSHFS `yaml:"sshfs,omitempty" json:"sshfs,omitempty"` NineP NineP `yaml:"9p,omitempty" json:"9p,omitempty"` Virtiofs Virtiofs `yaml:"virtiofs,omitempty" json:"virtiofs,omitempty"` }
type Network ¶
type Network struct { // `Lima` and `Socket` are mutually exclusive; exactly one is required Lima string `yaml:"lima,omitempty" json:"lima,omitempty"` // Socket is a QEMU-compatible socket Socket string `yaml:"socket,omitempty" json:"socket,omitempty"` // VZNAT uses VZNATNetworkDeviceAttachment. Needs VZ. No root privilege is required. VZNAT *bool `yaml:"vzNAT,omitempty" json:"vzNAT,omitempty"` MACAddress string `yaml:"macAddress,omitempty" json:"macAddress,omitempty"` Interface string `yaml:"interface,omitempty" json:"interface,omitempty"` Metric *uint32 `yaml:"metric,omitempty" json:"metric,omitempty"` }
type NineP ¶ added in v0.10.0
type NineP struct { SecurityModel *string `yaml:"securityModel,omitempty" json:"securityModel,omitempty" jsonschema:"nullable"` ProtocolVersion *string `yaml:"protocolVersion,omitempty" json:"protocolVersion,omitempty" jsonschema:"nullable"` Msize *string `yaml:"msize,omitempty" json:"msize,omitempty" jsonschema:"nullable"` Cache *string `yaml:"cache,omitempty" json:"cache,omitempty" jsonschema:"nullable"` }
type PortForward ¶
type PortForward struct { GuestIPMustBeZero bool `yaml:"guestIPMustBeZero,omitempty" json:"guestIPMustBeZero,omitempty"` GuestIP net.IP `yaml:"guestIP,omitempty" json:"guestIP,omitempty"` GuestPort int `yaml:"guestPort,omitempty" json:"guestPort,omitempty"` GuestPortRange [2]int `yaml:"guestPortRange,omitempty" json:"guestPortRange,omitempty"` GuestSocket string `yaml:"guestSocket,omitempty" json:"guestSocket,omitempty"` HostIP net.IP `yaml:"hostIP,omitempty" json:"hostIP,omitempty"` HostPort int `yaml:"hostPort,omitempty" json:"hostPort,omitempty"` HostPortRange [2]int `yaml:"hostPortRange,omitempty" json:"hostPortRange,omitempty"` HostSocket string `yaml:"hostSocket,omitempty" json:"hostSocket,omitempty"` Proto Proto `yaml:"proto,omitempty" json:"proto,omitempty"` Reverse bool `yaml:"reverse,omitempty" json:"reverse,omitempty"` Ignore bool `yaml:"ignore,omitempty" json:"ignore,omitempty"` }
type Probe ¶
type Probe struct { Mode ProbeMode `yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"default=readiness"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Script string `yaml:"script,omitempty" json:"script,omitempty"` Hint string `yaml:"hint,omitempty" json:"hint,omitempty"` }
type Provision ¶
type Provision struct { Mode ProvisionMode `yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"default=system"` SkipDefaultDependencyResolution *bool `yaml:"skipDefaultDependencyResolution,omitempty" json:"skipDefaultDependencyResolution,omitempty"` Script string `yaml:"script" json:"script"` Playbook string `yaml:"playbook,omitempty" json:"playbook,omitempty"` }
type ProvisionMode ¶
type ProvisionMode = string
const ( ProvisionModeSystem ProvisionMode = "system" ProvisionModeUser ProvisionMode = "user" ProvisionModeBoot ProvisionMode = "boot" ProvisionModeDependency ProvisionMode = "dependency" ProvisionModeAnsible ProvisionMode = "ansible" )
type QEMUOpts ¶ added in v1.0.0
type QEMUOpts struct {
MinimumVersion *string `yaml:"minimumVersion,omitempty" json:"minimumVersion,omitempty" jsonschema:"nullable"`
}
type SFTPDriver ¶ added in v0.10.0
type SFTPDriver = string
type SSH ¶
type SSH struct { LocalPort *int `yaml:"localPort,omitempty" json:"localPort,omitempty" jsonschema:"nullable"` // LoadDotSSHPubKeys loads ~/.ssh/*.pub in addition to $LIMA_HOME/_config/user.pub . LoadDotSSHPubKeys *bool `yaml:"loadDotSSHPubKeys,omitempty" json:"loadDotSSHPubKeys,omitempty" jsonschema:"nullable"` // default: false ForwardAgent *bool `yaml:"forwardAgent,omitempty" json:"forwardAgent,omitempty" jsonschema:"nullable"` // default: false ForwardX11 *bool `yaml:"forwardX11,omitempty" json:"forwardX11,omitempty" jsonschema:"nullable"` // default: false ForwardX11Trusted *bool `yaml:"forwardX11Trusted,omitempty" json:"forwardX11Trusted,omitempty" jsonschema:"nullable"` // default: false }
type SSHFS ¶ added in v0.8.1
type SSHFS struct { Cache *bool `yaml:"cache,omitempty" json:"cache,omitempty" jsonschema:"nullable"` FollowSymlinks *bool `yaml:"followSymlinks,omitempty" json:"followSymlinks,omitempty" jsonschema:"nullable"` SFTPDriver *SFTPDriver `yaml:"sftpDriver,omitempty" json:"sftpDriver,omitempty" jsonschema:"nullable"` }
type User ¶ added in v1.0.0
type User struct { Name *string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"nullable"` Comment *string `yaml:"comment,omitempty" json:"comment,omitempty" jsonschema:"nullable"` Home *string `yaml:"home,omitempty" json:"home,omitempty" jsonschema:"nullable"` UID *uint32 `yaml:"uid,omitempty" json:"uid,omitempty" jsonschema:"nullable"` }
type VMOpts ¶ added in v1.0.0
type VMOpts struct {
QEMU QEMUOpts `yaml:"qemu,omitempty" json:"qemu,omitempty"`
}
type VNCOptions ¶ added in v0.15.0
type VNCOptions struct {
Display *string `yaml:"display,omitempty" json:"display,omitempty" jsonschema:"nullable"`
}
type Video ¶
type Video struct { // Display is a QEMU display string Display *string `yaml:"display,omitempty" json:"display,omitempty" jsonschema:"nullable"` VNC VNCOptions `yaml:"vnc,omitempty" json:"vnc,omitempty"` }