You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/docs/GO_AGENT_ATTACH_CONTRACT.md

2.2 KiB

Go Agent host-bound attach contract

agent/internal/domaincreateattach is the next boundary after domain_create_plan/domain_create_validate. It is a greenfield contract and does not read or translate the Python engine or an old database.

What it proves

Build accepts a typed EFI/x86_64/q35/no-Secure-Boot domain policy, a loader path and disk intents that a future Agent resolver is expected to supply, the expected immutable NoCloud manifest, and a script digest. BuildWithLoaderProvider can obtain the loader through the fresh-observation seam, but this package does not itself prove volume ownership or resolver generation. It then, without changing the host:

  1. renders and validates host-bound base XML with the selected loader;
  2. verifies the fixed NoCloud artifact and first-boot inclusion bit;
  3. validates every resolved disk path against the configured storage-root allowlist; and
  4. returns a deterministic, safe identity (domain_xml_hash, disk-plan hash, seed manifest and plan_hash).

The base XML intentionally contains no <disk>, <interface>, or network configuration. Disk attachments are typed {volume_id, slot, readonly} values with an agent-side path that is excluded from JSON. The Plan accessors expose the host-only values only to a future executor; its Result is the journal/API projection.

What it does not prove

This package does not write or attach a CIDATA image, allocate or create a volume, call libvirt, define/start a domain, or modify network state. A future executor must re-open the loader, seed directory, and disk paths using a no-follow/openat-style boundary immediately before mutation, then perform explicit define/read-back and cleanup reconciliation. The current filesystem checks are a preflight gate, not a TOCTOU proof.

Missing or unreadable host inputs are classified as uncertain; malformed typed policy, seed mismatch, loader policy violations, and storage allowlist violations are definitive failures. No raw script, network document, host path, or domain XML is included in the safe result. A successful result is only an input-validation checkpoint, not an attach/create success or a proof that a guest will execute the startup script.