host

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package host is what this machine can give a VM.

Index

Constants

View Source
const WHPXOn = "DISM /Online /Enable-Feature /FeatureName:HypervisorPlatform /All"

WHPXOn is what an administrator runs, once, then reboots, for QEMU to use WHPX.

Variables

View Source
var CPUs = func() int { return runtime.NumCPU() }

CPUs is the host's CPU count, 0 when it cannot be told.

View Source
var MemGiB = func() int { return int(memory.TotalMemory() >> 30) }

MemGiB is the host's RAM in GiB, 0 when it cannot be told.

Functions

func Cap

func Cap(kind string, val int, warn io.Writer) int

Cap is the value of --cpus (kind "cpus") or --memory ("memory", GiB) to apply: above this host's share, clamped, with a notice; else as asked. 0 (nothing asked) and a host that cannot be read leave it alone: guessing low would hand a 1-CPU VM to a 64-core host.

func Divisor

func Divisor() (div int, bad string, invalid bool)

Divisor is the number the host's resources are divided by to get a VM's share: AGENT_VM_HOST_SHARE, or 2 when it is unset or is not a positive integer. In the second case invalid is true and bad is what the variable holds.

func FreeGiB

func FreeGiB(dir string) (int, bool)

FreeGiB is the space free for an unprivileged user on dir's file system.

func LinuxPrereqs

func LinuxPrereqs(w io.Writer) bool

LinuxPrereqs checks what Lima needs to run a QEMU VM on Linux, and says how to get it: without this, a failed start says only that it failed. True elsewhere.

func WSLVersion

func WSLVersion() int

WSLVersion is 2 or 1 under WSL, from the kernel release, 0 elsewhere.

func WarnDiskSpace

func WarnDiskSpace(dir string, want int, warn io.Writer)

WarnDiskSpace warns when the file system of dir has less free space than a disk of want GiB. Disks are sparse, allocated as they fill: a warning, not an error.

func WindowsPrereqs

func WindowsPrereqs(out, w io.Writer) bool

WindowsPrereqs checks for QEMU, which Lima runs on Windows. Whether the "Windows Hypervisor Platform" feature is on cannot be read without administrator rights: a host without it fails at the first start, where WindowsStartHint explains it. winget's QEMU does not add itself to PATH: its default folder goes on PATH for this process. True elsewhere.

func WindowsStartHint

func WindowsStartHint(w io.Writer, logs ...string)

WindowsStartHint explains, after a failed start on Windows whose logs show QEMU could not use WHPX, how to turn it on.

Types

This section is empty.

Jump to

Keyboard shortcuts

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