Hyper.Node.Img.Mutable (Hyper v0.1.0)

Copy Markdown View Source

The per-VM mutable rootfs. On start it activates (or reuses) the image's read-only Img.Server, takes a reference on it, reads the composed device's size, and asks the node ThinPool for a thin volume with that device as a read-only external origin. blk_path/1 is the mutable host device the VM boots from (staged into the jail by mknod from this path).

Mutable layers live in their own DynamicSupervisor, separate from the shared read-only Img.Servers; the firecracker VM is handed this layer directly and cannot be booted from a bare Hyper.Img.

Monitor-refcounted like Img.Server/Layer.Server: the VM supervisor holds it; when the last holder dies it idle-reaps, destroying its thin volume in terminate/2 and releasing the image (which, if it was the last holder, tears down the RO chain in turn).

Summary

Functions

vm_ids of every live mutable layer on this node.

Returns a specification to start this module under a supervisor.

The volume's identity for forking: which image it serves, its thin name/id in the node pool, its device path, and the composed RO origin it reads through.

Release the calling process's hold on the writable volume.

Functions

acquire(server)

@spec acquire(GenServer.server()) :: :ok

acquire(server, holder)

@spec acquire(GenServer.server(), pid()) :: :ok

active_vm_ids()

@spec active_vm_ids() :: [Hyper.Vm.Id.t()]

vm_ids of every live mutable layer on this node.

blk_path(server)

@spec blk_path(GenServer.server()) :: Path.t()

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

describe(server)

@spec describe(GenServer.server()) :: %{
  img_id: Hyper.Img.id(),
  thin_name: String.t(),
  thin_id: non_neg_integer(),
  blk_path: Path.t(),
  origin_dev: Path.t()
}

The volume's identity for forking: which image it serves, its thin name/id in the node pool, its device path, and the composed RO origin it reads through.

release(server)

@spec release(GenServer.server()) :: :ok

Release the calling process's hold on the writable volume.

The VM-supervisor holder is released via its monitor :DOWN, not this function.

start_link(opts)

@spec start_link(Hyper.Node.Img.Mutable.Opts.t()) :: GenServer.on_start()