Hyper.Node.FireVMM.Daemon (Hyper v0.1.0)

Copy Markdown View Source

The jailed firecracker OS process for one microVM, as a static child of Hyper.Node.FireVMM.Core.

A trap_exit GenServer that owns firecracker's lifetime end to end:

  • on every (re)start it resets any stale jail left by a prior incarnation — the firecracker jailer refuses to reuse an existing chroot — then launches the jailer under a linked MuonTrap.Daemon. The supervised process is hyper-suidhelper jailer ..., which execves into the jailer (same pid).
  • if firecracker exits, the linked MuonTrap.Daemon exits and this server stops with that reason, so Core's :one_for_all cold-boots the pair.
  • on teardown it guarantees firecracker is dead: MuonTrap's port-close kills by process group, but the jailer setsids firecracker into its own session, so it escapes that kill and would leak (holding the cgroup, the rootfs dm device, loop devices). terminate/2 therefore runs the helper's cgroup.kill teardown (ChrootJail.remove), which SIGKILLs the whole leaf cgroup regardless of session. The same call on (re)start cleans up after a prior incarnation the BEAM could not (a SIGKILL'd node leaves no terminate/2); the periodic Hyper.Node.Reaper is the final backstop.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)