vm

package
v0.1.52 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureGuestAgent

func EnsureGuestAgent(ctx context.Context, klimaxHome string) (string, error)

EnsureGuestAgent returns the path to the cached lima guest agent binary for the current host architecture, downloading it from Lima's GitHub release if not already present.

Cache location: <klimaxHome>/share/lima/lima-guestagent.Linux-<arch>-<limaVer>.gz

func EnsureImageDisk added in v0.1.52

func EnsureImageDisk(ctx context.Context, name, size string) error

EnsureImageDisk creates the persistent Lima data disk backing the guest's container image store (/var/lib/containerd), if it does not already exist.

Named Lima disks live in $LIMA_HOME/_disk/<name> — outside the instance directory — and deliberately survive `klimax destroy`. That is the whole point: `destroy` otherwise discards the unpacked image store (kindest/node, registry:2, and any locally built images, which no mirror can restore).

Lima itself partitions and formats the disk on first attach (Disk.Format), and unlocks it when the instance stops, so re-creating the VM re-attaches the same disk with its contents intact.

func GuestAgentCachePath added in v0.1.51

func GuestAgentCachePath(klimaxHome string) string

GuestAgentCachePath returns where the guest agent matching this binary's Lima module version is cached. The filename is version-stamped, so bumping the Lima module points at a new path and the matching agent is re-downloaded (guest and host agents must be the same version — a stale cached agent could break the hostagent protocol). Earlier versions linger until 'klimax prune' removes them.

Types

type Manager

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

Manager handles the Lima VM lifecycle for a named klimax instance.

func New

func New(name, klimaxHome string) *Manager

New creates a Manager for the given Lima instance name.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context) error

Delete removes the VM and all its data. The instance must be stopped first (or pass force=true, which forcibly kills it).

func (*Manager) EnsureRunning

func (m *Manager) EnsureRunning(ctx context.Context, cfg *config.Config, showLogs bool) (*limatype.Instance, error)

EnsureRunning is idempotent: creates the instance if it doesn't exist, starts it if it's stopped, and returns the running instance. When showLogs is true, Lima's host-agent logs are streamed to stderr in real time and Lima's built-in cloud-init progress display is enabled.

func (*Manager) Inspect

func (m *Manager) Inspect(ctx context.Context) (*limatype.Instance, error)

Inspect returns the current state of the instance. Returns (nil, nil) if the instance does not exist.

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop gracefully shuts down the VM.

Jump to

Keyboard shortcuts

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