Store API sockets in runtime dir

This commit is contained in:
Thales Maciel 2026-01-29 14:59:57 -03:00
parent f8e7aedeb2
commit 68a223c463
No known key found for this signature in database
GPG key ID: 33112E6833C34679
2 changed files with 6 additions and 2 deletions

View file

@ -43,7 +43,7 @@ Each VM writes a metadata file at `state/vms/<id>/info` with the following field
- `created_at`: timestamp when the VM was launched.
- `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.
- `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).

6
run.sh
View file

@ -169,7 +169,11 @@ VM_TAG="${VM_ID:0:8}"
VM_DIR="$VM_ROOT/$VM_ID"
mkdir -p "$VM_DIR"
API_SOCK="$STATE/fc-$VM_TAG.sock"
RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
SOCK_DIR="$RUNTIME_DIR/banger"
sudo mkdir -p "$SOCK_DIR"
sudo chown "$(id -u):$(id -g)" "$SOCK_DIR"
API_SOCK="$SOCK_DIR/fc-$VM_TAG.sock"
LOG_FILE="$VM_DIR/firecracker.log"
TAP_DEV="tap-fc-$VM_TAG"