# qemu-tool settings for the two-VM quickstart: one emulated gfx1250, one
# emulated NVMe and one emulated RDMA NIC per guest.
#
# This is the file README.md's Quick Start and
# .github/workflows/qemu-minimal-report-for-quickstart.yml both use, through
# `qemu-tool quick-start`. Keep it that way: the lane exists so the documented
# path cannot rot, and that only works while the two run the same thing.
#
# It is bundled in the wheel, so `qemu-tool quick-start` finds it without a
# checkout and needs no --env-file.
#
# Same keys and same list semantics as qemu/env/scale-out -- read that file
# first; this one only records what the quickstart needs differently, and why.
#
# Generated to a scratch directory by the script, never over the committed
# stack: qemu/compose/vfio-user-ernic-rocjitsu-scale-out/docker-compose.yml is
# generated from qemu/env/scale-out and `gen-compose --check` compares the two.

# ---------------------------------------------------------------------------
# Fleet shape
# ---------------------------------------------------------------------------

# Two: the smallest fleet that can move a byte between guests. It proves the
# stack works, never that the mesh scales -- issue 18 is invisible at two
# nodes, because with a single peer the wrong answer is also the right one.
VM_COUNT=2

VM_NAME_PREFIX=quickstart

# ---------------------------------------------------------------------------
# Images -- containers AND qcow2, one build stamp across all four
# ---------------------------------------------------------------------------
#
# One build stamp (20261030.gadc94af) with ernic.8f35f4a and rocjitsu.73c3cf3.
# The generator asserts this: a guest driver and a host rocm-ernic server from
# different builds do not fail cleanly across the vfio-user/DSR boundary, they
# wedge. Move all four together.
#
# This quickstart deliberately runs AHEAD of qemu/env/scale-out, which is
# still on 20261030.gadc94af. The fleet file is what a long soak is pinned to
# and what the committed stack is generated from, so it moves on purpose; this
# one is the shop window and should show the current build. The two are
# independent -- the stamp check is per settings file, not across them.
QEMU_IMAGE=docker.io/sbates130272/batesste-ci-images-ubuntu-qemu-libvfio-user:20261030.gadc94af-qemu11.1.3-vfu.5b9c722
ERNIC_IMAGE=docker.io/sbates130272/batesste-ci-images-ubuntu-rocm-ernic:20261030.gadc94af-ernic.8f35f4a-vfu.5b9c722
ROCJITSU_IMAGE=docker.io/sbates130272/batesste-ci-images-ubuntu-rocm-rocjitsu:20261030.gadc94af-rocjitsu.73c3cf3

# The published guest, as an OCI artifact -- not a runnable image. `qemu-tool
# gen-vm --backing-image` does the `oras pull` and the decompression. This is
# what makes the quickstart quick: the disk already carries the mainline
# kernel, the ionic-ernic DKMS modules, the udev naming rules, rdma-core,
# perftest and ROCm 10.1, so nothing is built here.
VM_BACKING_IMAGE=docker.io/sbates130272/batesste-ci-images-ubuntu-qcow2-gen-ernic-rocjitsu:20261030.gadc94af-vm.resolute-ernic-rocjitsu-qm.ae551b3-qcow2

# The image bakes its own account; it is not a cloud image cloud-init is about
# to personalise, and gen-vm --backing-image returns before cloud-init
# (gen_vm.py:78-81). These must match what the disk already has or the
# generated inventory hands Ansible a user that does not exist -- which
# presents as "Permission denied" with the guest perfectly healthy.
#
# `ubuntu` is the fleet-wide login account, matching qemu/env/scale-out. The
# published ernic-rocjitsu qcow2 bakes only `batesste`, so this quickstart
# depends on the backing image having been given an `ubuntu` account first --
# that is what ansible/playbooks/vm-ernic-fleet.yml's ernic_fleet_guest role
# creates, and the bake note at the top of that playbook explains why the one
# gen-vm run that talks to the published image still needs --username
# batesste. Point VM_BACKING_IMAGE at the published qcow2 unprepared and the
# quickstart cannot log in.
#
# The matching keypair ships as an ORAS REFERRER next to the qcow2, not inside
# it; `qemu-tool quick-start` pulls it.
VM_USERNAME=ubuntu
VM_PASSWORD=changeme

# ---------------------------------------------------------------------------
# Per-guest resources
# ---------------------------------------------------------------------------

# Do not drop below 4. ionic_lif_size() derives its EQ count from
# num_online_cpus() and ionic_create_rdma_admin() rejects fewer than
# IONIC_EQ_COUNT_MIN, so ionic_rdma never probes and the only symptom is
# "Failed to register ibdev" in the guest log.
VM_VCPUS=4
VM_VMEM=4096

# Shared memory for the vfio-user memfd backend, >= VM_VMEM MiB per VM. Both
# have to fit in /dev/shm at once, so this quickstart wants ~10g free there.
VM_SHM_SIZE=5g

# `qemu-tool quick-start` overrides the three above from nproc and MemTotal,
# writing an env.sized layer beside the stack rather than editing this file --
# so a run on a small host does not look like a settings change in the diff.
# That is on by default; --no-size-from-host takes the values written here.
# The floors above are still floors: the sizing clamps to 4 vCPU and 4 GiB.

# rocjitsu GPU config, a filename under /usr/local/share/rocjitsu/configs/
# inside the rocjitsu image.
ROCJITSU_CONFIG=gfx1250_mi455x.json

# One emulated NVMe per guest. run-vm creates the backing qcow2 itself
# (<vm-name>-nvme1 under VM_IMAGES_DIR), so there is no gen-vm step to pair
# with this the way there is for the root disk.
VM_NVME=1

# Put each vfio-user device behind its own pcie-root-port. Without it a device
# with no bus= lands on pcie.0 as a conventional PCI endpoint, and the guest's
# ionic reports "0.000 Gb/s available PCIe bandwidth (Unknown x255 link)".
VM_VFIO_USER_ROOT_PORT=true

# ---------------------------------------------------------------------------
# Host paths
# ---------------------------------------------------------------------------

# The package default. Change it with VM_IMAGES_DIR here rather than on the
# command line: gen-vm, run-vm and the compose bind mounts all read it.
VM_IMAGES_DIR=/var/lib/qemu-tool/images

# Required at VM_COUNT > 1: both guests open one backing file, which needs
# backing.file.locking=off (run_vm.py:267-269).
VM_BACKING_SHARED=true

# ---------------------------------------------------------------------------
# Fleet wiring
# ---------------------------------------------------------------------------

# /16 the containers are addressed out of. Every service gets a fixed address
# and nothing resolves a service name at run time -- Docker's embedded DNS
# saturates under a start burst, and a worker that dies and reconnects burns a
# mesh node id it never gets back. Change this only to dodge a collision.
FLEET_NET_PREFIX=172.31

ERNIC_TCP_PORT=6320
VM_SSH_PORT_BASE=2222
ERNIC_MAC_PREFIX=72:6f:63:6d

# Guests get .11 upward. Avoid .1: the mesh manager claims it as its DHCP
# server_ip and intercepts ARP for it, so a VM that takes .1 is unreachable in
# a way that looks like a driver fault (AGENTS.md issue 1).
ERNIC_GUEST_SUBNET=192.168.100

# ERNIC_TAP is what makes inter-node anything possible. The TCP mesh carries
# RDMA payload only, so without a TAP the guests have no Ethernet, ARP goes
# unanswered, and ib_send_bw cannot do its out-of-band exchange -- which is
# precisely the test the quickstart runs. It costs one short-lived privileged
# sidecar per VM.
ERNIC_TAP=true

# Docker's default soft nofile is 1024 and the mesh manager leaks a descriptor
# per evicted node. Raising it does not fix the leak, it buys the run enough
# headroom to finish.
ERNIC_NOFILE=65536

# Where each rocm-ernic writes its stats dump (-S). The quickstart reads
# total_bytes_sent from it to prove the RDMA test's bytes crossed the mesh,
# which a passing ib_send_bw on its own does not.
ERNIC_STATS_PORT=9840

# Forward node-exporter (9100) and amd-metrics-exporter (9488) from every
# guest through its QEMU container to the fleet Docker network. Each VM is a
# separate container (own network namespace) so both VMs can bind the same
# port without conflict. Prometheus reaches them at the container fleet-net
# IPs (172.31.3.1, 172.31.3.2, ...); the ports are NOT exposed on the host.
VM_EXTRA_HOSTFWD=tcp::9100-:9100,tcp::9488-:9488,tcp::9879-:9879,tcp::9490-:9490

# ---------------------------------------------------------------------------
# Observability
# ---------------------------------------------------------------------------
#
# Prometheus and Grafana come up with the stack. Prometheus is emitted
# unconditionally by the generator; this is the switch for Grafana, and
# `qemu-tool quick-start` selects `--profile metrics` so both actually run.
# It is on because the ernic dashboard is the only place a new user can watch
# the RDMA test move bytes, and a monitoring stack nobody switched on monitors
# nothing. `--no-metrics` leaves both out.
#
# PROM_DATA_DIR and GRAFANA_DATA_DIR are deliberately NOT set here. Their
# defaults are under /var/lib/qemu-tool, which on a fresh host is root-owned
# -- and the two containers then want it chowned to uid 65534 and 472
# respectively. quick-start writes both to directories beside the generated
# stack instead, which needs no root and no chown, and puts the TSDB where
# somebody would think to look for it.
GRAFANA_ENABLE=true

# Loki and the LMCache coordinator are real parts of the scale-out stack and
# beside the point here. LMCACHE_ENABLE also decides whether the coordinator
# service and its scrape jobs are GENERATED, not merely whether they run, so
# turning it off keeps the generated stack to what this quickstart boots.
LMCACHE_ENABLE=false
LOGS_ENABLE=true

# Path to the repo root, resolved relative to the compose stack directory.
# `qemu-tool quick-start` overrides it with an absolute path, because the
# stack is generated to a scratch directory rather than used in place.
QEMU_TOOL_SRC=../../..
