Hyper.Node.FireVMM (Hyper v0.1.0)

Copy Markdown View Source

Supervises a single Firecracker microVM, split into four independent children so no lifecycle invariant rides on the ordering of a flat child list:

  1. Hyper.Node.FireVMM.Core - the daemon container + :gen_statem controller, coupled under :one_for_all (a controller crash also discards the daemon, so no VM is orphaned). All order-sensitivity is contained there.
  2. Hyper.Node.FireVMM.Client - the API client. It depends only on vm_id (it derives the socket itself) and on nothing else in the tree, so it is an independent peer: its crashes don't disturb the core, and a core restart doesn't cycle it.
  3. Hyper.Node.FireVMM.Agent.Relay - the host-side gRPC relay that bridges inbound Unix-socket connections to the in-guest agent over vsock. Restart is :transient: an abnormal crash (unexpected accept error) is restarted; a clean stop (:shutdown from the supervisor) is not.
  4. Hyper.Node.FireVMM.Meter - the per-VM compute meter, sampling the VM's cgroup cpu.stat into Hyper.Metering.Usage billing windows. Deliberately the last child: it stops first at teardown, capturing the final usage window before the daemon removes the cgroup.

Strategy is :one_for_one: the four children are restarted independently.

Summary

Functions

Returns a specification to start this module under a supervisor.

The scheduler period of each VM.

Test whether the system can run firecracker VMMs.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cpu_period()

@spec cpu_period() :: Unit.Time.t()

The scheduler period of each VM.

start_link(opts)

test_system()

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

Test whether the system can run firecracker VMMs.