Hyper.Node.FireVMM.VmLinux.Provider (Hyper v0.1.0)

Copy Markdown View Source

Installs the guest-kernel (vmlinux) images for the current architecture into Hyper.Cfg.Dirs.vmlinux_install_dir/0 (<work_dir>/redist/vmlinux).

The available kernels and their SHA-256 sums come from the statically-embedded Hyper.Node.FireVMM.VmLinux.Manifest. ensure_installed/0 installs every build for this node's architecture and is idempotent: if all the expected images are already present it returns :ok without touching the network. Otherwise it fetches each missing image via Redist.File (download, SHA-256 verify, install).

This is the download-side counterpart to operator-provided kernels; see Hyper.Node.Vmlinux, which prefers an operator-configured path and falls back to default_path/1 here.

Summary

Functions

Absolute path to the default (highest-version) kernel for arch. The returned path is only guaranteed to exist for the node's current architecture (the one ensure_installed/0 installs).

Ensure every kernel for this node's architecture is installed.

Install state of builds under dir: :ok if every asset file is present with the manifest's SHA-256; {:error, :not_installed} if none are; {:error, :bad_install} if only some are (a partial/corrupt install - Redist.File keeps existing files, so the remedy is to wipe and reinstall).

Absolute path to the installed kernel for build name (e.g. "x86_64-6.1"). The returned path is only guaranteed to exist for the node's current architecture (the one ensure_installed/0 installs).

Functions

default_path(arch)

@spec default_path(Sys.Arch.t()) ::
  {:ok, Path.t()} | {:error, {:no_kernel, Sys.Arch.t()}}

Absolute path to the default (highest-version) kernel for arch. The returned path is only guaranteed to exist for the node's current architecture (the one ensure_installed/0 installs).

ensure_installed()

@spec ensure_installed() :: :ok | {:error, term()}

Ensure every kernel for this node's architecture is installed.

install_state(dir, builds)

@spec install_state(Path.t(), [Hyper.Node.FireVMM.VmLinux.Manifest.Build.t()]) ::
  :ok | {:error, :not_installed | :bad_install}

Install state of builds under dir: :ok if every asset file is present with the manifest's SHA-256; {:error, :not_installed} if none are; {:error, :bad_install} if only some are (a partial/corrupt install - Redist.File keeps existing files, so the remedy is to wipe and reinstall).

Presence alone is not enough: after a manifest bump the old release's kernels sit at the same asset paths, and skipping the hash check would keep booting guests on the previous release forever.

path(name)

@spec path(String.t()) :: {:ok, Path.t()} | {:error, {:unknown_build, String.t()}}

Absolute path to the installed kernel for build name (e.g. "x86_64-6.1"). The returned path is only guaranteed to exist for the node's current architecture (the one ensure_installed/0 installs).