Skip to main content

Module handlers

Module handlers 

Source
Expand description

Axum handlers per 20-firecracker-api.md § 2.

Three handler categories:

  • Read-only fast path (§ 5.1) — GET /, GET /version, GET /vm/config, GET /machine-config, GET /balloon, GET /balloon/statistics, GET /mmds. These read directly from ArcSwap and never touch the VMM channel, so a long-running PUT /snapshot/load cannot cause liveness probes to time out.
  • Mutating — every PUT/PATCH/DELETE/POST. Validates the JSON body via Raw<T> → T::TryFrom, validates phase, dispatches to the VMM through RuntimeApiController, applies the per-class timeout.
  • Fallback — unknown paths translated to 400 Bad Request per the upstream shape (squib has no 404; see 20 § 3).

Functions§

delete_drive
DELETE /drives/{id}.
delete_network
DELETE /network-interfaces/{id}.
delete_pmem
DELETE /pmem/{id}.
fallback
Fallback for unmatched paths — translate to 400 with a fault_message.
get_balloon
GET /balloon — read-only mirror.
get_balloon_statistics
GET /balloon/statistics — read-only mirror.
get_hotplug_memory
GET /hotplug/memory — read-only mirror.
get_machine_config
GET /machine-config — read-only mirror of the last-applied machine config (or an empty object pre-boot).
get_mmds
GET /mmds — return the MMDS data store tree.
get_root
GET /InstanceInfo. Read-only fast path; never touches the VMM channel.
get_version
GET /version — Firecracker-compat version string.
get_vm_config
GET /vm/config — materialized VmmConfig (read-only fast path).
patch_balloon
PATCH /balloon.
patch_balloon_hinting
PATCH /balloon/hinting/{op} handler. The op is validated against start | status | stop.
patch_balloon_statistics
PATCH /balloon/statistics.
patch_drive
PATCH /drives/{id}.
patch_hotplug_memory
PATCH /hotplug/memory.
patch_machine_config
PATCH /machine-config.
patch_mmds
PATCH /mmds — JSON-merge-patch the data store.
patch_network
PATCH /network-interfaces/{id}.
patch_pmem
PATCH /pmem/{id}.
patch_vm
PATCH /vm — pause/resume.
put_actions
PUT /actions.
put_balloon
PUT /balloon.
put_boot_source
PUT /boot-source.
put_cpu_config
PUT /cpu-config.
put_drive
PUT /drives/{id}. The URL {id} must match the body drive_id.
put_entropy
PUT /entropy.
put_hotplug_memory
PUT /hotplug/memory.
put_logger
PUT /logger.
put_machine_config
PUT /machine-config.
put_metrics
PUT /metrics.
put_mmds
PUT /mmds — replace the data store.
put_mmds_config
PUT /mmds/config.
put_network
PUT /network-interfaces/{id}.
put_pmem
PUT /pmem/{id}.
put_serial
PUT /serial.
put_snapshot_create
PUT /snapshot/create.
put_snapshot_load
PUT /snapshot/load.
put_vsock
PUT /vsock.