- Add VM provisioning, cleanup, and setup scripts - Add Jenkins pipeline with parameterized builds - Add comprehensive documentation - Support for parallel test execution with QCOW2 linked clones
26 lines
637 B
Bash
Executable File
26 lines
637 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
VM_NAME="$1"
|
|
|
|
if [ -z "$VM_NAME" ]; then
|
|
echo "Usage: $0 <vm_name>"
|
|
exit 1
|
|
fi
|
|
|
|
echo "[Cleanup] Starting cleanup for VM: $VM_NAME"
|
|
|
|
# Force stop VM
|
|
echo "[Cleanup] Destroying VM..."
|
|
sudo virsh destroy "$VM_NAME" 2>/dev/null || echo "[Cleanup] VM was not running"
|
|
|
|
# Remove VM definition
|
|
echo "[Cleanup] Undefining VM..."
|
|
sudo virsh undefine "$VM_NAME" 2>/dev/null || echo "[Cleanup] VM definition already removed"
|
|
|
|
# Remove disk image
|
|
echo "[Cleanup] Removing disk image..."
|
|
sudo rm -f "/var/lib/libvirt/images/${VM_NAME}.qcow2" || echo "[Cleanup] Disk already removed"
|
|
|
|
echo "[Cleanup] Complete for $VM_NAME"
|