build-usb: --site-vars puts the per-site vars on CIDATA; harness pins the VM NIC MACs

tests/vm/build-image.sh writes site-vars.yml with pxe_nic_mac (isolated
network NIC) and corp_nic_mac (NAT NIC) and passes it to build-usb.sh.
This commit is contained in:
cproudlock
2026-10-15 08:56:45 -04:00
parent 29d815fbeb
commit 6dc9761e67
4 changed files with 43 additions and 5 deletions

View File

@@ -16,10 +16,16 @@ NIC MACs (fixed):
| VM | NIC | MAC | Network | Playbook var |
|--------|---------|---------------------|-------------------|-------------------|
| server | GE | `52:54:00:9e:10:01` | `default` NAT | `pxe_ge_mac` / corp_nic_mac |
| server | imaging | `52:54:00:9e:10:02` | `pxetest-imaging` | `pxe_imaging_mac` / pxe_nic_mac |
| server | GE | `52:54:00:9e:10:01` | `default` NAT | `corp_nic_mac` |
| server | imaging | `52:54:00:9e:10:02` | `pxetest-imaging` | `pxe_nic_mac` |
| client | - | `52:54:00:9e:10:03` | `pxetest-imaging` | - |
`build-image.sh` writes `$PXETEST_CACHE/site-vars.yml` with these two
MACs (`pxe_nic_mac`, `corp_nic_mac`) and passes it to `build-usb.sh
--site-vars`, so it lands on CIDATA as `playbook/site-vars.yml`. The
installer brings both NICs up with DHCP; the playbook renames them to
pxe0 / corp0 and pins pxe0 to 172.16.9.1.
The disk boots before the USB on purpose: a blank disk falls through to
the installer, and after the install the server boots its disk instead of
re-running autoinstall. CIDATA stays attached for the first-boot playbook.

View File

@@ -41,7 +41,18 @@ if [ -e "$USB_IMAGE" ] && [ ! -f "$USB_IMAGE" ]; then
die "$USB_IMAGE is not a regular file"
fi
# Site vars for the VM "site": pin the NICs by the fixed MACs from common.sh.
SITE_VARS="$PXETEST_CACHE/site-vars.yml"
cat >"$SITE_VARS" <<YML
---
# Generated by tests/vm/build-image.sh for the pxetest VMs.
pxe_nic_mac: "$SERVER_IMAGING_MAC" # pxetest-imaging (isolated)
corp_nic_mac: "$SERVER_GE_MAC" # libvirt default NAT ("GE/corp")
YML
log "site vars: pxe_nic_mac=$SERVER_IMAGING_MAC corp_nic_mac=$SERVER_GE_MAC"
"$REPO_ROOT/scripts/build-usb.sh" --yes --payload-root "$PXETEST_PAYLOAD_ROOT" \
--site-vars "$SITE_VARS" \
"${ARGS[@]}" --image "$USB_IMAGE" "$SIZE" "$UBUNTU_ISO"
BYTES=$(stat -c%s "$USB_IMAGE")

View File

@@ -168,5 +168,5 @@ for vm in "$SERVER_VM" "$CLIENT_VM"; do
done < <(virsh domiflist "$vm" | tail -n +3 | grep -v '^$')
done
log "ready. Playbook NIC pins for this site:"
log " pxe_imaging_mac: \"$SERVER_IMAGING_MAC\" (pxe_nic_mac)"
log " pxe_ge_mac: \"$SERVER_GE_MAC\" (corp_nic_mac)"
log " pxe_nic_mac: \"$SERVER_IMAGING_MAC\""
log " corp_nic_mac: \"$SERVER_GE_MAC\""