wip: save current ks debugging state before bisect revert
All accumulated changes to kickstart template, test infrastructure, and dnsmasq config. None of these produce a clean boot yet — saving state before reverting to baseline for bisection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
bastion/tests/integration/helpers/vm-screenshot.sh
Executable file
33
bastion/tests/integration/helpers/vm-screenshot.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Capture a screenshot of a libvirt VM and convert to PNG for viewing.
|
||||
# Usage: vm-screenshot.sh [VM_NAME] [OUTPUT_PATH]
|
||||
VM_NAME="${1:-lab-pxe-test}"
|
||||
OUTPUT="${2:-/tmp/vm-screenshot.png}"
|
||||
PPM="/tmp/vm-screenshot-$$.ppm"
|
||||
|
||||
if ! sudo virsh domstate "$VM_NAME" &>/dev/null; then
|
||||
echo "ERROR: VM '$VM_NAME' not found or not running" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo virsh screenshot "$VM_NAME" "$PPM" --screen 0 2>/dev/null
|
||||
if [ ! -f "$PPM" ]; then
|
||||
echo "ERROR: screenshot failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert to PNG (ppm -> png)
|
||||
if command -v convert &>/dev/null; then
|
||||
convert "$PPM" "$OUTPUT"
|
||||
elif command -v ffmpeg &>/dev/null; then
|
||||
ffmpeg -y -i "$PPM" "$OUTPUT" 2>/dev/null
|
||||
elif command -v pnmtopng &>/dev/null; then
|
||||
pnmtopng "$PPM" > "$OUTPUT"
|
||||
else
|
||||
# fallback: just copy the PPM (Read tool can handle it)
|
||||
cp "$PPM" "${OUTPUT%.png}.ppm"
|
||||
OUTPUT="${OUTPUT%.png}.ppm"
|
||||
fi
|
||||
|
||||
rm -f "$PPM"
|
||||
echo "$OUTPUT"
|
||||
Reference in New Issue
Block a user