-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple port forwarding parameters in QEMU startup script #2575
Conversation
One thing that Im not sure about is where I should add the mention about it to the changelog file? 🤔 |
Yes please. In the
|
Build action triggered: https://github.com/flatcar/scripts/actions/runs/12742931278 |
changelog/changes/2025-01-10-qemu-startup-script-port-forwarding.md
Outdated
Show resolved
Hide resolved
build_library/qemu_template.sh
Outdated
for port in $PORT_FORWARDS; do | ||
host_port=$(echo "$port" | cut -d':' -f1) | ||
guest_port=$(echo "$port" | cut -d':' -f2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using shell built-ins makes me cry. 😛
for port in $PORT_FORWARDS; do | |
host_port=$(echo "$port" | cut -d':' -f1) | |
guest_port=$(echo "$port" | cut -d':' -f2) | |
for port in ${PORT_FORWARDS}; do | |
host_port=${port%:*} | |
guest_port=${port#*:} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks, feel free to squash your commits before merging. :) |
Add mention in the changelog Update changelog/changes/2025-01-10-qemu-startup-script-port-forwarding.md Co-authored-by: Mathieu Tortuyaux <mathieu.tortuyaux@gmail.com> Update build_library/qemu_template.sh Co-authored-by: Mathieu Tortuyaux <mathieu.tortuyaux@gmail.com> Adjust to review comments Review adjustments
4596a2e
to
1a7b995
Compare
Commits squashed |
Add support for multiple port forwarding parameters in QEMU startup script
This PR introduces a new feature to the
flatcar_qemu_startup.sh
script, allowing users to specify multiple port forwards using the-f
option. This enhancement improves the flexibility and usability of the script by enabling users to forward multiple ports from the host to the guest VM.Key Changes:
Added the
-f
option to specify port forwards in the formathost_port:guest_port
. Updated the script to process multiple-f
options and construct the appropriate QEMU command line arguments. Modified the usage instructions to include the new-f
option.How to Use:
To use the new port forwarding feature, specify the
-f
option followed by thehost_port:guest_port
pairs. Multiple-f
options can be used to forward multiple ports. For example:This command sets the VM memory to 6144 MB, forwards ports
25565
,25575
, and2223
, and uses a specified Ignition config file.Testing Done:
Verified that the script correctly processes multiple
-f
options and constructs the QEMU command line with the specified port forwards. Tested the script with various combinations of port forwards to ensure proper functionality. Example command used for testing:Confirmed that the VM starts with the specified port forwards and that the ports are accessible from the host.
changelog/
directory (user-facing change, bug fix, security fix, update)/boot
and/usr
size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.