From 408a4aeed4d87396028a5975bd6e4e1f244bd8a0 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Thu, 8 Oct 2026 16:30:43 +0200 Subject: [PATCH] qemu_template: fix -S flag when '-- -snapshot' was provided This change fixes a corner case in #4310 when the new '-S' option introduced in that PR was not provided, but the classic '-- -snapshot' pass-through option is used. Since the PR explicitly sets 'snapshot=off' on all disks individually, and since per-disk options override global options, '-- -snapshot' is effectively ignored. Signed-off-by: Thilo Fromm --- build_library/qemu_template.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build_library/qemu_template.sh b/build_library/qemu_template.sh index 1e58e9257b8..1fc6140aa18 100755 --- a/build_library/qemu_template.sh +++ b/build_library/qemu_template.sh @@ -22,7 +22,7 @@ SAFE_ARGS=0 FORWARDED_PORTS="" PRIMARY_DISK_OPTS="" DISKS=() -SNAPSHOT="off" +SNAPSHOT="" USAGE="Usage: $0 [-a authorized_keys] [--] [qemu options...] Options: -i FILE File containing an Ignition config @@ -133,7 +133,7 @@ while [ $# -ge 1 ]; do VM_INITRD="$2" shift 2 ;; -S|-snapshot) - SNAPSHOT="on" + SNAPSHOT=",snapshot=on" shift ;; -v|-verbose) set -x @@ -276,14 +276,14 @@ if [ -n "${CONFIG_DRIVE}" ]; then fi if [ -n "${CONFIG_IMAGE}" ]; then - set -- -drive if=virtio,file="${CONFIG_IMAGE}",snapshot="${SNAPSHOT}" "$@" + set -- -drive if=virtio,file="${CONFIG_IMAGE}${SNAPSHOT}" "$@" fi if [ -n "${VM_IMAGE}" ]; then if [[ ,${PRIMARY_DISK_OPTS}, = *,drive=* || ,${PRIMARY_DISK_OPTS}, = *,bootindex=* ]]; then die "Can't override drive or bootindex options for primary disk" fi - set -- -drive if=none,id=blk,file="${VM_IMAGE}",snapshot="${SNAPSHOT}" \ + set -- -drive if=none,id=blk,file="${VM_IMAGE}${SNAPSHOT}" \ -device virtio-blk-pci,drive=blk,bootindex=1${PRIMARY_DISK_OPTS:+,}${PRIMARY_DISK_OPTS:-} "$@" fi @@ -299,7 +299,7 @@ for disk in "${DISKS[@]}"; do disk_opts= fi set -- \ - -drive "if=none,id=${disk_id},file=${disk_path},snapshot=${SNAPSHOT}" \ + -drive "if=none,id=${disk_id},file=${disk_path}${SNAPSHOT}" \ -device "virtio-blk-pci,drive=${disk_id}${disk_opts:+,}${disk_opts:-}" \ "${@}" done @@ -324,7 +324,7 @@ fi if [ -n "${VM_PFLASH_RO}" ] && [ -n "${VM_PFLASH_RW}" ]; then set -- \ -drive if=pflash,unit=0,file="${VM_PFLASH_RO}",format=qcow2,readonly=on \ - -drive if=pflash,unit=1,file="${VM_PFLASH_RW}",format=qcow2,snapshot="${SNAPSHOT}" "$@" + -drive if=pflash,unit=1,file="${VM_PFLASH_RW}",format=qcow2"${SNAPSHOT}" "$@" fi if [ -n "${IGNITION_CONFIG_FILE}" ]; then