Merge pull request #2581 from John15321/fix-port-forwarding-qemustartscript

fix: Dynamically create netdev arguments to correctly include commas
This commit is contained in:
Mathieu Tortuyaux 2025-01-17 11:18:06 +01:00 committed by GitHub
commit c2d18cf193
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -302,7 +302,7 @@ case "${VM_BOARD}" in
qemu-system-x86_64 \ qemu-system-x86_64 \
-name "$VM_NAME" \ -name "$VM_NAME" \
-m ${VM_MEMORY} \ -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 \ -device virtio-net-pci,netdev=eth0 \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ -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 \ qemu-system-aarch64 \
-name "$VM_NAME" \ -name "$VM_NAME" \
-m ${VM_MEMORY} \ -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 \ -device virtio-net-device,netdev=eth0 \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
"$@" "$@"

View File

@ -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))