Files
pxe-server/tests/vm/stop.sh
cproudlock 576955785d Faster shopfloor-setup sync, prompt spacing, XP-era test client
- Deploy shopfloor-setup with rsync instead of the copy module: the
  ~4 GB tree took about 4 minutes on every re-run because copy checksums
  each file. rsync transfers only changes; changed only when it did.
- iPXE drops a trailing space, so 'Machine number:' ran into the typed
  digits. The space now comes from a hex 20 setting.
- tests/vm: pxetest-xp is a permanent client (SeaBIOS, qemu32 32-bit CPU,
  rtl8139, 1 GiB, IDE disk) for the i686 Clonezilla path; start.sh xp.
  Only one client may run at a time across all three.
2026-10-15 21:43:33 -04:00

30 lines
985 B
Bash
Executable File

#!/bin/bash
# Shut pxetest VMs down (ACPI, then force after a timeout). Keeps them
# defined. Idempotent.
# Usage: tests/vm/stop.sh [server|client|client2|xp|all] (default: all)
source "$(dirname "$0")/common.sh"
which="${1:-all}"
case "$which" in
server) vms=("$SERVER_VM") ;;
client) vms=("$CLIENT_VM") ;;
client2|nosb) vms=("$CLIENT2_VM") ;;
xp|client3) vms=("$CLIENT3_VM") ;;
all) vms=("${ALL_CLIENTS[@]}" "$SERVER_VM") ;;
*) die "usage: $0 [server|client|client2|xp|all]" ;;
esac
for vm in "${vms[@]}"; do
dom_exists "$vm" || continue
[ "$(dom_state "$vm")" = "shut off" ] && { log "$vm already off"; continue; }
virsh shutdown "$vm" >/dev/null 2>&1 || true
for _ in $(seq 1 60); do
[ "$(dom_state "$vm")" = "shut off" ] && break
sleep 1
done
if [ "$(dom_state "$vm")" != "shut off" ]; then
log "$vm ignored ACPI shutdown; forcing off"
virsh destroy "$vm" >/dev/null
fi
log "$vm off"
done