Store VM metadata as JSON

This commit is contained in:
Thales Maciel 2026-01-31 23:17:12 -03:00
parent bbd57d8dd2
commit 7af04b7535
No known key found for this signature in database
GPG key ID: 33112E6833C34679
11 changed files with 188 additions and 178 deletions

View file

@ -4,7 +4,7 @@ Minimal Firecracker launcher.
## Requirements
- Linux host with KVM (`/dev/kvm` access)
- `sudo`, `ip`, `curl`, `ssh`
- `sudo`, `ip`, `curl`, `ssh`, `jq`
- `dmsetup`, `losetup`, `blockdev` (device-mapper snapshot for rootfs)
- `e2cp`, `e2rm` (writes hostname and resolv.conf into rootfs snapshot)
@ -63,22 +63,9 @@ reboot
```
## VM Info File
Each VM writes a metadata file at `state/vms/<id>/info` with the following fields:
- `id`: unique identifier for the VM instance.
- `name`: VM name.
- `pid`: Firecracker process ID.
- `created_at`: timestamp when the VM was launched.
- `rootfs`: root filesystem image path used to launch the VM.
- `kernel`: kernel image path used to launch the VM.
- `guest_ip`: IP address assigned to the guest.
- `tap`: host TAP interface name attached to the bridge.
- `api_sock`: path to the Firecracker API socket (stored under `$XDG_RUNTIME_DIR/banger/` when available).
- `log`: path to the Firecracker log file.
- `base_loop`: loop device backing the base rootfs (if present).
- `cow_file`: copy-on-write image file (if present).
- `cow_loop`: loop device for the COW image (if present).
- `dm_name`: device-mapper name for the merged rootfs (if present).
- `dm_dev`: device-mapper device path for the merged rootfs (if present).
Each VM writes `state/vms/<id>/vm.json` with:
- `meta`: local metadata (id, name, pid, created_at, guest_ip, tap, api_sock, log, rootfs, kernel, snapshot info).
- `config`: full `/vm/config` response from Firecracker.
## Log Notes
- `PCI: Fatal: No config space access function found` and `MissingAddressRange` lines are expected with `pci=off` in `run.sh`.