aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/lib')
-rwxr-xr-xscripts/testing/lib/vm-utils.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/testing/lib/vm-utils.sh b/scripts/testing/lib/vm-utils.sh
index f86e583..6d9f6f6 100755
--- a/scripts/testing/lib/vm-utils.sh
+++ b/scripts/testing/lib/vm-utils.sh
@@ -14,6 +14,12 @@ VM_CPUS="${VM_CPUS:-4}"
VM_RAM="${VM_RAM:-4096}" # MB
VM_DISK_SIZE="${VM_DISK_SIZE:-50}" # GB
+# Filesystem profile: selects which base image + archangel config the harness
+# targets. "btrfs" is the historical default (its image name stays unsuffixed
+# so existing base images keep working); "zfs" gets its own image, since the
+# two on-disk layouts can't share a disk. Honoured by init_vm_paths below.
+FS_PROFILE="${FS_PROFILE:-btrfs}"
+
# SSH configuration
SSH_PORT="${SSH_PORT:-2222}"
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10"
@@ -42,8 +48,17 @@ init_vm_paths() {
local images_dir="${1:-$VM_IMAGES_DIR}"
[ -z "$images_dir" ] && fatal "VM_IMAGES_DIR not set"
+ case "$FS_PROFILE" in
+ btrfs|zfs) ;;
+ *) fatal "Invalid FS_PROFILE: $FS_PROFILE (must be 'btrfs' or 'zfs')" ;;
+ esac
+
VM_IMAGES_DIR="$images_dir"
- DISK_PATH="$VM_IMAGES_DIR/archsetup-base.qcow2"
+ # btrfs keeps the legacy unsuffixed name; other profiles get a suffix so
+ # their images sit side by side without clobbering each other.
+ local img_suffix=""
+ [ "$FS_PROFILE" != "btrfs" ] && img_suffix="-$FS_PROFILE"
+ DISK_PATH="$VM_IMAGES_DIR/archsetup-base${img_suffix}.qcow2"
OVMF_VARS="$VM_IMAGES_DIR/OVMF_VARS.fd"
PID_FILE="$VM_IMAGES_DIR/qemu.pid"
MONITOR_SOCK="$VM_IMAGES_DIR/qemu-monitor.sock"