Documentation
¶
Overview ¶
Package host is what this machine can give a VM.
Index ¶
- Constants
- Variables
- func Cap(kind string, val int, warn io.Writer) int
- func Divisor() (div int, bad string, invalid bool)
- func FreeGiB(dir string) (int, bool)
- func LinuxPrereqs(w io.Writer) bool
- func WSLVersion() int
- func WarnDiskSpace(dir string, want int, warn io.Writer)
- func WindowsPrereqs(out, w io.Writer) bool
- func WindowsStartHint(w io.Writer, logs ...string)
Constants ¶
const WHPXOn = "DISM /Online /Enable-Feature /FeatureName:HypervisorPlatform /All"
WHPXOn is what an administrator runs, once, then reboots, for QEMU to use WHPX.
Variables ¶
var CPUs = func() int { return runtime.NumCPU() }
CPUs is the host's CPU count, 0 when it cannot be told.
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 ¶
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 ¶
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 LinuxPrereqs ¶
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 ¶
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 ¶
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 ¶
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.