eBPF-based security platform
testing: boot a second end-to-end node with an image identity
John Fastabend9a1f8228409d
diff --git a/.agents/skills/testing/SKILL.md b/.agents/skills/testing/SKILL.mdindex d1f0fd54..4ba812e4 100644--- a/.agents/skills/testing/SKILL.md+++ b/.agents/skills/testing/SKILL.md@@ -26,7 +26,15 @@ make -C testing helpThe end2end tier runs t9107 against the keepalive backend that`BACKEND_DIR` names, a checkout or a git URL, `../backend` by default;-without one t9107 skips, so say so when reporting the tier.+without one t9107 skips, so say so when reporting the tier. The tier+boots two VMs at once, each with its own swtpm: node A runs the tests,+node B (`make -C testing vm-node-end2end`, node mode of `vm/run.sh`)+takes `role=core` from `config-core` and waits; a test in node A reaches+it with `node_b` of `testing/end2end/node-b-lib.sh`. Node B's boot log is+`build/test-vm/end2end/node-b.log`, its state+`build/test-vm/vms/<name>-end2end-b/`. Both nodes declare the image of+`testing/vm/files/end2end.os-release` without a root hash, so the+backend binds them `declared`.Host tests run as they are. A target test, `t?1??`, runs in a fresh VMper family, which needs KVM, an unlimited `ulimit -l`, the test kerneldiff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstindex fb7b1b51..12b7d370 100644--- a/Documentation/contribute/testing/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -96,7 +96,8 @@ signed config image.``--dry-run`` plan* - ``t1007-test-vm-cli``- Test VM scripts: kernel selection, host dependencies, arm64- boot settings, the bundle stamp+ boot settings, the bundle stamp, node mode only for the second+ end-to-end node* - ``t1008-kernel-ami-config``- The slim kernel configuration for NitroTPM CRB, EC2, EFI and SSM* - ``t1009-upatch-isa``diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rstindex 34a417d2..41924257 100644--- a/Documentation/contribute/testing/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -606,7 +606,9 @@ Run the end-to-end tests------------------------``make -C testing end2end`` runs ``t9001`` on the host, then-:src:`testing/end2end/host.sh` plays the operator around one VM. It starts+:src:`testing/end2end/host.sh` plays the operator around two VMs, node A,+which runs the target tests, and node B beside it (see+:ref:`testing-two-nodes`). It startsan OCI registry, an OpenTelemetry Collector and ClickHouse in Dockercontainers pinned by digest. The registry and collector use a throwawayCA. It builds ``kernel-obs`` into a package with ``bpm build``, pushes@@ -656,6 +658,92 @@ ClickHouse, both through QEMU's address for the host. Without# make -C testing end2end BACKEND_DIR=/path/to/backend+.. _testing-two-nodes:++The two nodes+~~~~~~~~~~~~~++The tier boots two targets at once, each with its own software TPM and+so its own attestation key. Node A is the family's VM, named+``<name>-end2end``, and runs the target tests in number order. Node B,+``<name>-end2end-b``, boots beside it with ``make -C testing+vm-node-end2end``: the runner's node mode prepares it as it prepares node+A, runs no tests, starts no timers and leaves it running until ``host.sh``+stops it after node A. Each takes its role from a signed config image, as+``t9105`` configures node A:++.. list-table::+ :header-rows: 1+ :widths: 22 26 52++ * - Image+ - Labels+ - Points at+ * - ``config-end2end``+ - ``role=edge``+ - The tree ``shirudo/end2end-tree`` and the test's collector. Node+ A activates it in ``t9105``, and the ``kernel-obs`` operation+ selects ``role=edge``.+ * - ``config-edge``+ - ``role=edge``+ - The tree ``shirudo/pipeline-tree`` on the test's registry and the+ keepalive backend's collector, for a test that moves node A to+ that tree.+ * - ``config-core``+ - ``role=core``+ - The same as ``config-edge``. Node B activates it while it is+ prepared.++Both nodes declare an image: :src:`testing/vm/files/end2end.os-release`,+``IMAGE_ID=fleet-os`` and ``IMAGE_VERSION=end2end-1``, is added to their+``/etc/os-release``. Neither binds the image as ``verified``. Their root+is the stock cloud image in a writable overlay, not a dm-verity image,+and their kernel command line names no ``roothash=`` or ``usrhash=``, so+``image_root`` is ``null`` and the keepalive backend binds both nodes as+``declared``. Giving node A a root hash would mean building its root as a+verity image; the backend's own tests cover ``verified`` and+``root_mismatch`` with rows they insert.++After node A, ``host.sh`` checks node B: its evidence verifies, its+attestation key differs from node A's, its labels are ``role=core``, and+the keepalive body each node printed while it was prepared, in+``result/keepalive.json`` of its state directory, names the image above+and no root.++A test in node A reaches node B as root over SSH through+:src:`testing/end2end/node-b-lib.sh`. ``node_b_wait`` waits for node B to+be prepared and fails when it did not boot; ``node_b`` runs a command line+in node B's shell, with the test's standard input and output:++.. code-block:: sh++ . ./end2end/node-b-lib.sh+ node_b_wait || test_skip_all "node B did not boot"+ node_b /usr/local/bin/shirudo-runtime status --keepalive >"$W/node-b.json"+ node_b cat /var/lib/shirudo/bpm/upatch-tree/state.json+ node_b "cat >/etc/shirudo/end2end-ca.pem" <"$E2E/ca.pem"++``host.sh`` records the SSH port and key in+``build/test-vm/end2end/node-b/``, which node A reads through the+read-only checkout. Node B reaches the registry and the collectors through+QEMU's address for the host, as node A does, and has the checkout at+``/workspace/shirudo`` too. A tree at ``127.0.0.1:15443`` names its+packages there, so a test that syncs node B starts+``end2end/tcp_forward.py`` in it, as ``t9105`` does in node A, detached+from the SSH session:++.. code-block:: sh++ node_b "cd /workspace/shirudo/testing &&+ python3 end2end/tcp_forward.py 127.0.0.1:15443 10.0.2.2:15443 \+ /tmp/forward-ready </dev/null >/dev/null 2>&1 &"++Node B has 2 CPUs and ``TEST_VM_NODE_MEMORY``, ``2G`` by default; node A+keeps ``TEST_VM_CPUS`` and ``TEST_VM_MEMORY``. With the defaults the+guests take 6 GiB of host memory, and the registry, the two collectors+and the two ClickHouse servers come on top. ``host.sh`` prints node B's+memory use, and its boot log is ``build/test-vm/end2end/node-b.log``.+Select test scripts~~~~~~~~~~~~~~~~~~~diff --git a/testing/Makefile b/testing/Makefileindex 1c257bc5..7a780913 100644--- a/testing/Makefile+++ b/testing/Makefile@@ -244,7 +244,7 @@ vm-ssh:TEST_VM_WORK_DIR="$(TEST_VM_WORK_DIR)" $(ROOT)/testing/vm/run.sh --sshdefine run-target-vm-VM_MODE=test TEST_VM_SUITE="$(1)" VM_VERBOSE="$(TEST_VM_VERBOSE)" VM_NAME="$(2)" VM_TENANT="$(VM_TENANT)" \+VM_MODE=$(or $(4),test) TEST_VM_SUITE="$(1)" VM_VERBOSE="$(TEST_VM_VERBOSE)" VM_NAME="$(2)" VM_TENANT="$(VM_TENANT)" \TEST_VM_INITRD="$(3)" \TEST_VM_KERNEL="$(abspath $(VM_KERNEL_IMAGE))" \TEST_VM_KERNEL_ARTIFACT_DIR="$(abspath $(VM_KERNEL_ARTIFACT_DIR))" \@@ -279,7 +279,7 @@ FAMILIES := $(call family-list,[0-9])VM_SUITES := $(call family-list,1) end2endvm-tests = $(if $(filter 0,$(VM)),:,$(MAKE) $(addprefix vm-test-,$(1))).PHONY: $(addprefix unit/,$(UNIT_SUITES)) $(addprefix functional/,$(FAMILIES)) \- $(addprefix vm-test-,register $(VM_SUITES))+ $(addprefix vm-test-,register $(VM_SUITES)) vm-node-end2endall:+$(Q)$(MAKE) unit@@ -312,8 +312,15 @@ end2end: build-operator+$(Q)$(if $(filter 0,$(VM)),:,$(MAKE) test-vm-bundle && \TEST_VM_HOST_BUNDLE="$(abspath $(TEST_VM_BUNDLE_DIR))" \TEST_VM_HOST_PRIVATE_DIR="$(abspath $(TEST_VM_HOST_PRIVATE_DIR))" \+ MAKE="$(MAKE)" \$(ROOT)/testing/end2end/host.sh $(MAKE) -C $(ROOT)/testing vm-test-end2end)+# Node B of the end-to-end run, which end2end/host.sh boots beside the+# suite's VM and stops after it: prepared like that VM, but it runs no+# tests and stays up until it is stopped.+vm-node-end2end: $(VM_KERNEL_DEP) test-vm-bundle+ $(Q)$(call run-target-vm,end2end,$(if $(VM_NAME),$(VM_NAME)-end2end-b),1,node)+vm-test-tpm: vm-test-register$(addprefix vm-test-,register $(VM_SUITES)): vm-test-%: $(VM_KERNEL_DEP) test-vm-bundlediff --git a/testing/end2end/host.sh b/testing/end2end/host.shindex 8d6e04a1..cab2df33 100755--- a/testing/end2end/host.sh+++ b/testing/end2end/host.sh@@ -2,6 +2,8 @@# SPDX-License-Identifier: BSD-2-Clause# Copyright (c) 2026 Authors of shirudo# testing/end2end/host.sh -- run the operator side of the end-to-end VM test.+# Its arguments are the command that runs the suite in node A; node B, a+# second target with a TPM of its own, boots beside it.set -eu@@ -29,15 +31,69 @@ RESULT=$REPO/build/test-vm/vms/$VM_NAME-end2end/result/end2endPOLICY_FIXTURE=$TEST_VM_HOST_BUNDLE/fixtures/shirudo-test-policy-exec-graph.upatchCHECKER=$REPO/tools/quote-check/shirudo-quote-checkKEEPALIVE=$REPO/testing/fixtures/keepalive+NODE_B_DIR=$W/node-b+NODE_B_HOST=127.0.0.1+NODE_B_VM=$VM_NAME-end2end-b+NODE_B_RUN=$REPO/build/test-vm/vms/$NODE_B_VM+NODE_B_PID=+. "$REPO/testing/end2end/node-b-lib.sh"say() { printf 'end2end: %s\n' "$*"; }die() { printf 'end2end: %s\n' "$*" >&2; exit 1; }down() {+ node_b_downstack_downrm -rf -- "$TLS_DIR"}+# Boot node B beside node A, prepared like it but with the core role and no+# tests, and record in $NODE_B_DIR how to reach it.+node_b_boot() {+ mkdir -p "$NODE_B_DIR"+ if "${MAKE:-make}" -C "$REPO/testing" vm-node-end2end TEST_VM_CPUS=2 \+ TEST_VM_MEMORY="${TEST_VM_NODE_MEMORY:-2G}" >"$W/node-b.log" 2>&1 &&+ cp "$NODE_B_RUN/ssh.port" "$NODE_B_DIR/port" &&+ install -m 0600 "$NODE_B_RUN/ssh/id_ed25519" "$NODE_B_DIR/key"; then+ : >"$NODE_B_DIR/ready"+ else+ : >"$NODE_B_DIR/failed"+ fi+}++# Stop node B. A boot still under way ends when its VM stops, or comes up+# after the first stop and meets the second.+node_b_down() {+ node_b_stop+ [ -z "$NODE_B_PID" ] || wait "$NODE_B_PID" || :+ NODE_B_PID=+ node_b_stop+}++node_b_stop() {+ [ ! -d "$NODE_B_RUN" ] ||+ VM_NAME=$NODE_B_VM "$REPO/testing/vm/run.sh" --stop >/dev/null 2>&1 || :+}++# Check the keepalive body that node $1 printed at boot, file $2: the image+# it names is the one the os-release of the end-to-end nodes declares, with+# no root, and with $3 set, its config root is $3.+image_identity() {+ python3 - "$2" "$REPO/testing/vm/files/end2end.os-release" "${3-}" <<'PY' ||+import json, sys++body, release, config_root = sys.argv[1:4]+image = dict(line.split("=", 1) for line in open(release).read().splitlines()+ if "=" in line and not line.startswith("#"))+node = json.load(open(body))+assert node["image_id"] == image["IMAGE_ID"], node["image_id"]+assert node["image_version"] == image["IMAGE_VERSION"], node["image_version"]+assert node["image_root"] is None, node["image_root"]+assert not config_root or node["config_root"] == config_root, node["config_root"]+PY+ die "node $1 does not declare the image of the end-to-end nodes"+}+# The keepalive backend t9107 runs against, in $BACKEND: BACKEND_DIR, a# directory relative to the checkout or a git URL cloned into $W, by# default ../backend. Without the variable and without that directory@@ -146,7 +202,7 @@ sed -i '/^source = "kernel-obs.bpf.c"$/a\id = "kernel-obs"\\[upatches.tree.selector.labels]\-role = ["end2end"]' "$W/pkg/kernel-obs/Beefile"+role = ["edge"]' "$W/pkg/kernel-obs/Beefile"(cd "$W/pkg" && "$S" bpm build kernel-obs --version 1.0.0 --keys-dir "$KEYS")BEE=$W/pkg/kernel-obs-1.0.0.bee"$S" bpm push "$BEE" "oci://$REGISTRY/shirudo/kernel-obs" --keys-dir "$KEYS" \@@ -179,7 +235,9 @@ elsesay "no keepalive backend at ../backend and no BACKEND_DIR: t9107 skips"fi-say "the target, in $VM_NAME-end2end"+say "node A, in $VM_NAME-end2end, and node B, in $NODE_B_VM"+node_b_boot &+NODE_B_PID=$!"$@"say "the evidence verifies and records what was published"@@ -239,4 +297,40 @@ python3 "$REPO/testing/end2end/check-otlp.py" \"$W/out/otlp.json" "http://$CLICKHOUSE/" || \die "the collector or ClickHouse snapshots differ from the map exports"+say "node B booted with an attestation key and a role of its own"+wait "$NODE_B_PID" || :+NODE_B_PID=+node_b_wait 0 || {+ tail -n 40 "$W/node-b.log" >&2+ die "node B did not boot; see $W/node-b.log"+}+node_b "/usr/local/bin/shirudo-runtime attest --nonce=$(cat "$W/nonce")" \+ >"$W/node-b-evidence.json" || die "node B gave no evidence"+# Node B loads nothing of its own: a test gives it only what a tree holds.+ak_b=$(python3 -c 'import json, sys+evidence = json.load(open(sys.argv[1]))+assert not [r for r in evidence["eventlog"] if r["type"] == "upatch_load"]+print(evidence["ak"]["name"])' "$W/node-b-evidence.json") ||+ die "node B loaded an upatch while it was prepared"+"$S" attest verify --evidence="$W/node-b-evidence.json" \+ --nonce="$(cat "$W/nonce")" --ak-name="$ak_b" --allow-runtime-events \+ --require-initrd >"$W/node-b-verify.out" 2>&1 &&+ grep -qx 'verdict: ok' "$W/node-b-verify.out" || {+ cat "$W/node-b-verify.out" >&2+ die "the evidence of node B does not verify"+}+[ "$ak_b" != "$ak" ] || die "node A and node B share an attestation key"+[ "$(node_b cat /run/shirudo/config/etc/shirudo/node.labels)" = role=core ] ||+ die "node B is not labelled role=core"+image_identity A "$REPO/build/test-vm/vms/$VM_NAME-end2end/result/keepalive.json"+image_identity B "$NODE_B_RUN/result/keepalive.json" \+ "$(cat "$TEST_VM_HOST_BUNDLE/verity/config-core.root")"+for report in boot-memory host-memory; do+ [ ! -s "$NODE_B_RUN/result/$report" ] ||+ say "node B $report: $(tr '\n' ' ' <"$NODE_B_RUN/result/$report")"+done+node_b_down+rm -rf -- "$NODE_B_RUN/rootfs.qcow2" "$NODE_B_RUN/initrd.img" \+ "$NODE_B_RUN/seed.img" "$NODE_B_RUN/initrd-seed"+say "ok"diff --git a/testing/end2end/node-b-lib.sh b/testing/end2end/node-b-lib.shnew file mode 100644index 00000000..0256b071--- /dev/null+++ b/testing/end2end/node-b-lib.sh@@ -0,0 +1,35 @@+#!/bin/sh+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+#+# testing/end2end/node-b-lib.sh -- reach node B, the second target that+# end2end/host.sh boots beside the suite's VM, as root over SSH. A test in+# node A sources it as it is; host.sh sets NODE_B_DIR and NODE_B_HOST first.++# What host.sh records of node B: port, the host port of its SSH server,+# key, the key of its root, and ready once it is prepared, else failed.+: "${NODE_B_DIR:=/mnt/shirudo-src/build/test-vm/end2end/node-b}"+# Where node B's SSH port is forwarded: QEMU's address for the host, as+# node A sees it.+: "${NODE_B_HOST:=10.0.2.2}"++# Wait up to $1 seconds, 600 by default, for node B to be prepared. Fails+# at once when it did not boot.+node_b_wait() {+ node_b_tries=0+ until [ -e "$NODE_B_DIR/ready" ]; do+ [ ! -e "$NODE_B_DIR/failed" ] || return 1+ node_b_tries=$((node_b_tries + 1))+ [ "$node_b_tries" -le "${1:-600}" ] || return 1+ sleep 1+ done+}++# Run the command line $* in node B's root shell, with this standard input+# and output. The words are joined and parsed again there, as by ssh.+node_b() {+ ssh -F /dev/null -i "$NODE_B_DIR/key" -o IdentitiesOnly=yes \+ -o BatchMode=yes -o ConnectTimeout=10 -o LogLevel=ERROR \+ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \+ -p "$(cat "$NODE_B_DIR/port")" "root@$NODE_B_HOST" "$@"+}diff --git a/testing/functional/build/t1007-test-vm-cli.sh b/testing/functional/build/t1007-test-vm-cli.shindex 87db0fa7..ca52e9c1 100755--- a/testing/functional/build/t1007-test-vm-cli.sh+++ b/testing/functional/build/t1007-test-vm-cli.sh@@ -32,6 +32,21 @@ test_expect_success 'register protocols run only in an isolated pre-init test VMgrep -q "register suite requires test mode" "$WORK/register-initrd.out"'+test_expect_success 'node mode boots only the second node of the end2end suite' '+ ! VM_MODE=node TEST_VM_WORK_DIR="$WORK/node" \+ "$RUNNER" >"$WORK/node-upatch.out" 2>&1 &&+ grep -q "node mode boots the second node of the end2end suite only" \+ "$WORK/node-upatch.out" &&+ ! TEST_VM_SUITE=end2end VM_MODE=node TEST_VM_WORK_DIR="$WORK/node" \+ TEST_VM_KERNEL="$WORK/no-bzImage" "$RUNNER" \+ >"$WORK/node-end2end.out" 2>&1 &&+ grep -q "kernel image not found" "$WORK/node-end2end.out" &&+ grep -Fq "\$(call run-target-vm,end2end,\$(if \$(VM_NAME),\$(VM_NAME)-end2end-b),1,node)" \+ ../testing/Makefile &&+ grep -Fq "if [[ \"\$VM_MODE\" == node ]]" vm/guest.sh &&+ grep -Fq "image update /var/lib/shirudo/images/config-core" vm/guest.sh+'+test_expect_success 'test-vm requires a SHA-256 for a remote kernel' '! TEST_VM_WORK_DIR="$WORK/no-sha" \TEST_VM_KERNEL_URL=https://example.invalid/bzImage "$RUNNER" \@@ -487,7 +502,7 @@ test_expect_success 'test harness records a failed test title' 'test_expect_success 'make -C testing vm and test-vm share named mode support' 'grep -q "^[[:space:]]*vm:" ../testing/Makefile &&grep -q "VM_MODE=interactive" ../testing/Makefile &&- grep -q "VM_MODE=test" ../testing/Makefile &&+ grep -Fq "VM_MODE=\$(or \$(4),test)" ../testing/Makefile &&grep -Fq "VMS_DIR=\"\${VM_ROOT}/vms\"" vm/run.sh &&grep -Fq "mktemp -d \"\${VMS_DIR}/\${VM_MODE}\${VM_SUITE:+-\$VM_SUITE}-XXXXXX\"" \vm/run.sh &&diff --git a/testing/vm/files/end2end.os-release b/testing/vm/files/end2end.os-releasenew file mode 100644index 00000000..d6cade9e--- /dev/null+++ b/testing/vm/files/end2end.os-release@@ -0,0 +1,4 @@+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+IMAGE_ID=fleet-os+IMAGE_VERSION=end2end-1diff --git a/testing/vm/files/pipeline-tree.conf b/testing/vm/files/pipeline-tree.confnew file mode 100644index 00000000..ac01f83b--- /dev/null+++ b/testing/vm/files/pipeline-tree.conf@@ -0,0 +1,4 @@+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+endpoint = oci://127.0.0.1:15443/shirudo/pipeline-tree+reference = stablediff --git a/testing/vm/files/pipeline.conf b/testing/vm/files/pipeline.confnew file mode 100644index 00000000..93849ad5--- /dev/null+++ b/testing/vm/files/pipeline.conf@@ -0,0 +1,6 @@+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+eventlog.max_bytes = 0+map_export.tenant_id = tenant-pipeline+map_export.otel_endpoint = https://10.0.2.2:14320+map_export.otel_retries = 2diff --git a/testing/vm/guest.sh b/testing/vm/guest.shindex 61323de9..16d2795c 100755--- a/testing/vm/guest.sh+++ b/testing/vm/guest.sh@@ -247,9 +247,22 @@ configure_map_export()>/etc/shirudo/shirudo.conf}+# The end-to-end nodes run an image that the keepalive backend knows by+# its os-release id and version. Their root is the stock cloud image, not a+# dm-verity image, so the command line names no roothash= and the backend+# binds them as declared.+configure_image_identity()+{+ [[ "${TEST_VM_SUITE:-}" == end2end ]] || return 0+ cat /usr/lib/os-release "$LOWER/testing/vm/files/end2end.os-release" \+ >/etc/os-release.tmp+ mv -f /etc/os-release.tmp /etc/os-release+}+configure_oci_caconfigure_bpm_oci_repositoryconfigure_map_export+configure_image_identity[[ -s /etc/shirudo-test-vm-runtime ]] || {log "prepared runtime image is missing; run make -C testing bundle"@@ -416,6 +429,14 @@ if tpm.get("chain_matches_eventlog") is not True:raise SystemExit("register does not match the shirudo eventlog")PY+if [[ "$VM_MODE" == node ]]; then+ log "node B of the end2end suite takes the core role"+ "$SHIRUDO_BIN" image update /var/lib/shirudo/images/config-core+fi+if [[ "${TEST_VM_SUITE:-}" == end2end ]]; then+ "$SHIRUDO_BIN" status --keepalive >/mnt/shirudo-out/keepalive.json+fi+if [[ "${TEST_VM_LOCAL_STACK:-0}" == 1 ]]; then"$SHIRUDO_BIN" image update /var/lib/shirudo/images/config-local-stackinstall -d /etc/shirudo/bpm@@ -444,6 +465,11 @@ fireport_boot_memory+if [[ "$VM_MODE" == node ]]; then+ log "node prepared; node mode runs no tests and starts no timers"+ exit 0+fi+if [[ "$VM_MODE" == interactive ]]; then# init above was deliberately run directly so the current boot gets one# TPM measurement; enable the service only for future boots and start thediff --git a/testing/vm/image-fixtures.sh b/testing/vm/image-fixtures.shindex ff054848..effe5c20 100755--- a/testing/vm/image-fixtures.sh+++ b/testing/vm/image-fixtures.sh@@ -76,7 +76,7 @@ for name in config-boot-keys config-live-new-key config-live-revoke-a config-a cconfig-tree-stopped config-tree-fetched config-tree-fixes \config-tree-keepalive config-tree-unmatched \config-otel config-jsonl config-jsonl-bad config-interrupted config-end2end \- config-local-stack config-builtin config-untrusted; do+ config-edge config-core config-local-stack config-builtin config-untrusted; do[ "$name" != config-builtin ] || [ -n "$builtin_key" ] || continueroot="$output/source/$name"mkdir -p "$root/etc/shirudo" "$root/keys/trusted" "$root/keys/revoked"@@ -104,11 +104,18 @@ for name in config-boot-keys config-live-new-key config-live-revoke-a config-a c;;config-end2end)mkdir -p "$root/etc/shirudo/bpm"- printf 'role=end2end\n' >"$root/etc/shirudo/node.labels"+ printf 'role=edge\n' >"$root/etc/shirudo/node.labels"cp "$templates/end2end-tree.conf" \"$root/etc/shirudo/bpm/upatch-tree.conf"cp "$templates/end2end.conf" "$root/etc/shirudo/shirudo.conf";;+ config-edge|config-core)+ mkdir -p "$root/etc/shirudo/bpm"+ printf 'role=%s\n' "${name#config-}" >"$root/etc/shirudo/node.labels"+ cp "$templates/pipeline-tree.conf" \+ "$root/etc/shirudo/bpm/upatch-tree.conf"+ cp "$templates/pipeline.conf" "$root/etc/shirudo/shirudo.conf"+ ;;esaccp "$output/public/boot.der" "$root/keys/trusted/$boot_fp.der""$builder" keys vouch "$output/public/boot.der" \diff --git a/testing/vm/run.sh b/testing/vm/run.shindex cdb68739..32c59b7a 100755--- a/testing/vm/run.sh+++ b/testing/vm/run.sh@@ -5,9 +5,11 @@# Boot an Ubuntu guest with a selected Linux kernel and an swtpm vTPM.# In test mode it runs the target tests of the family TEST_VM_SUITE names,# or the TPM register tests for "register"; in interactive mode it prepares-# the guest and leaves QEMU and swtpm running.+# the guest and leaves QEMU and swtpm running. Node mode boots the second+# node of the end2end suite: prepared like the suite's VM, with no tests+# and no timers, and left running until TEST_VM_TIMEOUT or a --stop.#-# VM_MODE=test|interactive selects the mode. VM_NAME optionally selects a+# VM_MODE=test|interactive|node selects the mode. VM_NAME optionally selects a# stable state directory; if omitted, a unique name is allocated atomically.# VM_TENANT is used as the map-export tenant when OTEL export is enabled.# VM_VERBOSE=1 streams test-mode QEMU output to the terminal as well as the@@ -169,7 +171,11 @@ validate_mode()ficase "$VM_MODE" ininteractive|test) ;;- *) die "VM_MODE must be 'interactive' or 'test'" ;;+ node)+ [[ "$VM_SUITE" == end2end ]] ||+ die "node mode boots the second node of the end2end suite only"+ ;;+ *) die "VM_MODE must be 'interactive', 'test' or 'node'" ;;esaccase "$VM_SUITE" in'')@@ -1532,7 +1538,7 @@ cat >>"$USER_DATA" <<'EOF'fiprintf '%s\n' "$rc" >/mnt/shirudo-out/statussync- if [ "${VM_MODE:-test}" = interactive ] && [ "$rc" -eq 0 ]; then+ if [ "${VM_MODE:-test}" != test ] && [ "$rc" -eq 0 ]; thenwhile :; do sleep 3600; donefipoweroff@@ -1736,7 +1742,21 @@ capture_host_memory_report()HOST_MEMORY_REPORT="$report"}-if [[ "$VM_MODE" == interactive ]]; then+if [[ "$VM_MODE" == node ]]; then+ # Bounded like a test run, so that a node its caller lost stops.+ nohup timeout --signal=TERM --kill-after=30 "$VM_TIMEOUT" \+ "$QEMU_BIN" "${QEMU_ARGS[@]}" \+ >"$RUN_DIR/qemu.log" 2>&1 </dev/null &+ QEMU_PID=$!+ printf '%s\n' "$QEMU_PID" >"$RUN_DIR/qemu.pid"+ wait_for_ssh_listener+ wait_for_guest_status+ capture_host_memory_report+ LEAVE_RUNNING=1+ FINAL_STATUS=0+ log "node ready: name=$VM_NAME state=$RUN_DIR ssh_port=$SSH_PORT"+ print_memory_summary+elif [[ "$VM_MODE" == interactive ]]; thenif user_systemd_available; thenQEMU_UNIT_FILE="$RUN_DIR/qemu.unit"QEMU_UNIT="shirudo-vm-$VM_NAME-qemu.service"