Files
pxe-server/tests/vm/status.sh
cproudlock 45cf7be37a build-usb: whole webapp, hard sfdisk failure, ISO-derived boot params, image-file mode; tests/vm harness
- Copy the whole webapp/ tree (minus __pycache__) in build-usb.sh and
  build-proxmox-iso.sh, so config, services/, views/ and
  blancco_evidence_monthly.py reach the server.
- sfdisk --append failure now aborts; the CIDATA partition is the one
  starting exactly at the computed sector, and nothing that starts
  before it is ever formatted (the old fallback hit the ISO's EFI
  partition).
- Volume id and El Torito load sizes come from the ISO
  (xorriso -report_el_torito as_mkisofs); grub.cfg must contain
  autoinstall after patching.
- --image FILE SIZE|auto builds the same layout in a file without root
  (mkfs.vfat -C + mtools, sfdisk on the file). Plus --payload-root,
  --skip-enrollment/-bios/-drivers/-boot-tools, --yes.
- tests/vm: libvirt harness (pxetest-server, pxetest-client, isolated
  pxetest-imaging network) with fetch-iso/build-image/create/start/
  status/stop/destroy.
2026-10-15 08:55:40 -04:00

40 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Show the state of every pxetest-* object, the isolation check, the NIC
# MACs, the server's GE-side DHCP lease, and optionally a screenshot.
# Usage: tests/vm/status.sh [--shot DIR]
source "$(dirname "$0")/common.sh"
SHOT_DIR=""
[ "${1:-}" = "--shot" ] && SHOT_DIR="${2:?--shot needs a dir}"
if ! net_exists "$IMAGING_NET"; then n=absent; elif net_active "$IMAGING_NET"; then n=active; else n=inactive; fi
echo "network $IMAGING_NET: $n"
if net_active "$IMAGING_NET"; then
(assert_imaging_isolated && echo " isolation: OK (no forward, no ip, no host IPv4, only vnet ports)")
fi
for v in "$SERVER_DISK_VOL" "$USB_VOL" "$CLIENT_DISK_VOL"; do
if vol_exists "$v"; then
echo "volume $v: $(virsh vol-info --pool "$POOL" "$v" | awk '/Capacity|Allocation/{printf "%s %s %s ", $1, $2, $3}')"
else
echo "volume $v: absent"
fi
done
for vm in "$SERVER_VM" "$CLIENT_VM"; do
if dom_exists "$vm"; then
echo "domain $vm: $(dom_state "$vm")"
virsh domiflist "$vm" | tail -n +3 | grep -v '^$' | sed 's/^/ /'
if [ "$(dom_state "$vm")" = "running" ]; then
echo " VNC $(virsh vncdisplay "$vm" 2>/dev/null | head -1)"
if [ -n "$SHOT_DIR" ]; then
mkdir -p "$SHOT_DIR"
f="$SHOT_DIR/$vm-$(date +%H%M%S).ppm"
virsh screenshot "$vm" "$f" >/dev/null 2>&1 && echo " screenshot $f"
fi
fi
else
echo "domain $vm: absent"
fi
done
echo "GE-side DHCP leases for $SERVER_GE_MAC (on $GE_NET):"
virsh net-dhcp-leases "$GE_NET" --mac "$SERVER_GE_MAC" 2>/dev/null | tail -n +3 | grep -v '^$' | sed 's/^/ /' || true