# qemu-tool settings.
#
# Copy to qemu/.env and edit. One file drives all three consumers:
#
#   qemu-tool gen-vm     VM_* keys below map 1:1 to the CLI flags
#   qemu-tool run-vm     (VM_VCPUS is --vcpus, VM_IMAGES_DIR is --images, ...)
#   qemu-tool compose    everything here is handed to docker compose
#
# Precedence, lowest to highest: built-in defaults, --domain XML, this file,
# explicit CLI flags. An empty value is ignored, so commenting a key out and
# setting it to nothing are equivalent.
#
# qemu-tool looks for the file in this order, first hit wins:
#
#   --env-file FILE
#   $QEMU_TOOL_ENV
#   ./.env            (current directory)
#   qemu/.env         (source checkout)
#   /etc/qemu-tool/env (installed .deb)
#
# The syntax is the docker compose env-file syntax -- KEY=value, one per line,
# no shell expansion -- because docker compose reads this same file verbatim.

# ---------------------------------------------------------------------------
# Container images
# ---------------------------------------------------------------------------

# Used by every compose stack. The three are built against the same
# libvfio-user revision (vfu.*) and must be moved together.
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

# ---------------------------------------------------------------------------
# VM identity and resources  (qemu-tool gen-vm / run-vm / compose)
# ---------------------------------------------------------------------------

# Basename of the qcow2, without the extension. Must not contain a comma: a
# comma terminates a QEMU option value and corrupts -name, -uuid and -drive.
VM_NAME=qemu-minimal

# Directory holding the qcow2 images. Backing files must live here too.
VM_IMAGES_DIR=/var/lib/qemu-tool/images

# Do not drop VM_VCPUS below 4 on an ernic stack: 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. The only symptom is
# "Failed to register ibdev" in the guest log.
VM_VCPUS=4
VM_VMEM=8192

# SSH port forwarded from the qemu container to the host.
VM_SSH_PORT=2222

# Management NIC MAC. Left unset, it is derived from VM_SSH_PORT as
# 52:54:00:00:<hi>:<lo>. Set it only for an image whose netplan matches on a
# specific MAC -- one built elsewhere, or one this gen-vm built before
# 3969f07. Since 3969f07 it writes a netplan that matches on interface name
# instead, so images built by it today do not need this.
#VM_MAC=52:54:00:12:34:56

# amd64 | arm64 | riscv64
VM_ARCH=amd64

# ---------------------------------------------------------------------------
# gen-vm only
# ---------------------------------------------------------------------------

# VM_SIZE=64
# VM_RELEASE=resolute
# VM_SSH_KEY_FILE=~/.ssh/id_rsa.pub
# VM_USERNAME=ubuntu
# VM_USER_ID=1000
# VM_PASSWORD=password
# VM_PACKAGES=/usr/share/qemu-tool/packages-default
# VM_COMPACT=true
# VM_BACKING_FILE=
# VM_ANSIBLE_PLAYBOOK=
# VM_CA_CERT_FILE=

# ---------------------------------------------------------------------------
# run-vm only
# ---------------------------------------------------------------------------

# VM_FILESYSTEM=
# VM_NVME=
# VM_PCI_HOSTDEV=
# VM_VFIO_USERDEV=
# VM_MCAST_GROUP=
# VM_QMP_SOCKET=
# VM_EXTRA_HOSTFWD=
# VM_DATA_NIC_QUEUES=0
# VM_BACKING_SHARED=false
# VM_QEMU_GUEST_AGENT=true
# VM_QEMU_PATH=

# One-shot actions (--force, --dry-run, --restore-image, --ansible-only,
# --nvme-recreate) are deliberately not readable from this file. They are
# per-invocation decisions, not configuration.

# ---------------------------------------------------------------------------
# Compose-only settings
# ---------------------------------------------------------------------------

# Shared memory for the vfio-user memfd backend. Must be >= VM_VMEM MiB.
VM_SHM_SIZE=8g

# Path to the qemu-minimal repo root, used to install qemu-tool into the qemu
# container. Resolved relative to the compose stack directory.
QEMU_TOOL_SRC=../../..

# rocjitsu GPU config, a filename under /usr/local/share/rocjitsu/configs/
# inside the rocjitsu image. Available configs include:
#   gfx1250_mi455x.json  gfx950_mi355x.json  gfx942_cdna3.json  gfx1100_w7900.json
ROCJITSU_CONFIG=gfx1250_mi455x.json

# Number of vfio-user device server replicas, for the ernic-rocjitsu stack.
ERNIC_COUNT=1
ROCJITSU_COUNT=1

# vfio-user-ernic-2vm only. Each VM needs its own qcow2 overlay, though both
# may share one backing file -- use gen-vm --restore-image for the second.
VM1_NAME=qemu-minimal
VM2_NAME=qemu-minimal-2
VM1_SSH_PORT=2222
VM2_SSH_PORT=2223

# TCP port the ernic manager listens on; the workers connect to it.
ERNIC_TCP_PORT=6320

# MAC addresses for each ernic NIC. Must be unique across the mesh.
ERNIC1_MAC=72:6f:63:6d:00:01
ERNIC2_MAC=72:6f:63:6d:00:02
