Documentation
¶
Index ¶
- Constants
- Variables
- func Convert(x, y any, comment string) error
- func DiskFSLabel(name string) string
- func ExistingLimaVersion(instDir string) string
- func FSLabelMaxLen(fsType string) int
- func FillCopyToHostDefaults(rule *limatype.CopyToHost, instDir string, user limatype.User, ...)
- func FillDefault(ctx context.Context, y, d, o *limatype.LimaYAML, filePath string, warn bool)
- func FillPortForwardDefaults(rule *limatype.PortForward, instDir string, user limatype.User, ...)
- func FirstUsernetIndex(l *limatype.LimaYAML) int
- func HostLoopbackEnabled(l *limatype.LimaYAML) bool
- func HostResolverEnabled(l *limatype.LimaYAML) bool
- func IsExistingInstanceDir(dir string) bool
- func IsSupportedWindowsShell(shell string) bool
- func Load(ctx context.Context, b []byte, filePath string) (*limatype.LimaYAML, error)
- func LoadWithWarnings(ctx context.Context, b []byte, filePath string) (*limatype.LimaYAML, error)
- func MACAddress(uniqueID string) string
- func Marshal(y *limatype.LimaYAML, stream bool) ([]byte, error)
- func MountTag(location, mountPoint string) string
- func ResolveArch(s *string) limatype.Arch
- func ResolveOS(s *string) limatype.OS
- func Unmarshal(data []byte, y *limatype.LimaYAML, comment string) error
- func Validate(y *limatype.LimaYAML, warn bool) error
- func ValidateAgainstLatestConfig(ctx context.Context, yNew, yLatest []byte) error
- type ContainerdYAML
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 DefaultDiskFSType = "ext4"
DefaultDiskFSType is the filesystem an additional disk is formatted with when `additionalDisks[].fsType` is not set. It must match the default applied by boot.Linux/05-lima-disks.sh.
Variables ¶
var (
IPv4loopback1 = net.IPv4(127, 0, 0, 1)
)
var SupportedWindowsShells = []string{"cmd.exe", "powershell.exe", "pwsh.exe"}
Functions ¶
func DiskFSLabel ¶ added in v2.3.0
DiskFSLabel returns the filesystem label that an additional disk named name is formatted with, before any filesystem-specific truncation.
func ExistingLimaVersion ¶
ExistingLimaVersion returns the version that created the instance, the empty string for instances created before Lima v0.20 (which have no recorded version), or the current version when the instance doesn't exist yet.
func FSLabelMaxLen ¶ added in v2.3.0
FSLabelMaxLen returns the maximum filesystem label length, in bytes, accepted by fsType, or 0 if Lima does not know that limit.
mkfs enforces the limit differently depending on the filesystem: mkfs.ext4 truncates an over-long label silently, while mkfs.xfs rejects it outright. Lima therefore clamps the label in boot.Linux/05-lima-disks.sh, and the limits here must stay in sync with the ones in that script. For an fsType not listed here, the limit (and even whether mkfs.$fsType accepts a label at all) is unknown, so the boot script omits the label rather than guess.
This affects the label only. Lima does not identify a disk by its label, so a name too long to fit is not an error.
func FillCopyToHostDefaults ¶
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 FirstUsernetIndex ¶
FirstUsernetIndex gets the index of first usernet network under l.Network[]. Returns -1 if no usernet network found.
func HostLoopbackEnabled ¶ added in v2.3.0
HostLoopbackEnabled returns whether the guest may reach the host's loopback services via `host.lima.internal`. A nil value is treated as true, which is the builtin default.
func HostResolverEnabled ¶ added in v2.3.0
func IsExistingInstanceDir ¶
func IsSupportedWindowsShell ¶ added in v2.2.0
func Load ¶
Load loads the yaml and fulfills unspecified fields with the default values.
Load does not validate. Use Validate for validation.
func LoadWithWarnings ¶
LoadWithWarnings will call FillDefaults with warnings enabled (e.g. when the username is not valid on Linux and must be replaced by "Lima"). It is called when creating or editing an instance.
func MACAddress ¶
func MountTag ¶ added in v2.1.0
MountTag generates a stable mount tag from location and mountPoint. Both paths are hashed to handle the same location mounted to multiple mount points.
func ResolveArch ¶
func ValidateAgainstLatestConfig ¶
ValidateAgainstLatestConfig validates the values between the latest YAML and the updated(New) YAML. This validates configuration rules that disallow certain changes, such as shrinking the disk.