From 0f0fa2ff7ada6b4a767a8deac943f224595bdee9 Mon Sep 17 00:00:00 2001 From: Jan Bronicki Date: Wed, 15 Jan 2025 13:59:54 +0100 Subject: [PATCH] fix: Dynamically create netdev arguments to correctly include commas docs: Add entrance to the changelog about the fix Update changelog/changes/2025-01-15-qemu-startup-script-comma-fix.md Co-authored-by: Mathieu Tortuyaux --- build_library/qemu_template.sh | 4 ++-- .../bugfixes/2025-01-15-qemu-startup-script-comma-fix.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog/bugfixes/2025-01-15-qemu-startup-script-comma-fix.md diff --git a/build_library/qemu_template.sh b/build_library/qemu_template.sh index af0a46ab743..4e2d5266f3d 100755 --- a/build_library/qemu_template.sh +++ b/build_library/qemu_template.sh @@ -302,7 +302,7 @@ case "${VM_BOARD}" in qemu-system-x86_64 \ -name "$VM_NAME" \ -m ${VM_MEMORY} \ - -netdev user,id=eth0,${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \ + -netdev user,id=eth0${QEMU_FORWARDED_PORTS:+,}${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \ -device virtio-net-pci,netdev=eth0 \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ "$@" @@ -311,7 +311,7 @@ case "${VM_BOARD}" in qemu-system-aarch64 \ -name "$VM_NAME" \ -m ${VM_MEMORY} \ - -netdev user,id=eth0,${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \ + -netdev user,id=eth0${QEMU_FORWARDED_PORTS:+,}${QEMU_FORWARDED_PORTS},hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \ -device virtio-net-device,netdev=eth0 \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ "$@" diff --git a/changelog/bugfixes/2025-01-15-qemu-startup-script-comma-fix.md b/changelog/bugfixes/2025-01-15-qemu-startup-script-comma-fix.md new file mode 100644 index 00000000000..04e2658ecab --- /dev/null +++ b/changelog/bugfixes/2025-01-15-qemu-startup-script-comma-fix.md @@ -0,0 +1 @@ +- Fixed creating netdev arguments to correctly include commas when no port forwards are passed ([flatcar/scripts#2581](https://github.com/flatcar/scripts/pull/2581))