Add support for multiple port forwarding parameters in QEMU startup script#2575
Merged
tormath1 merged 1 commit intoflatcar:mainfrom Jan 13, 2025
Merged
Add support for multiple port forwarding parameters in QEMU startup script#2575tormath1 merged 1 commit intoflatcar:mainfrom
tormath1 merged 1 commit intoflatcar:mainfrom
Conversation
Member
Author
|
One thing that Im not sure about is where I should add the mention about it to the changelog file? 🤔 |
Contributor
Yes please. In the
|
|
Build action triggered: https://github.com/flatcar/scripts/actions/runs/12742931278 |
tormath1
reviewed
Jan 10, 2025
tormath1
reviewed
Jan 10, 2025
changelog/changes/2025-01-10-qemu-startup-script-port-forwarding.md
Outdated
Show resolved
Hide resolved
chewi
requested changes
Jan 10, 2025
build_library/qemu_template.sh
Outdated
Comment on lines
213
to
215
| for port in $PORT_FORWARDS; do | ||
| host_port=$(echo "$port" | cut -d':' -f1) | ||
| guest_port=$(echo "$port" | cut -d':' -f2) |
Contributor
There was a problem hiding this comment.
Not using shell built-ins makes me cry. 😛
Suggested change
| 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#*:} |
chewi
approved these changes
Jan 10, 2025
tormath1
approved these changes
Jan 13, 2025
Contributor
|
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
Member
Author
|
Commits squashed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for multiple port forwarding parameters in QEMU startup script
This PR introduces a new feature to the
flatcar_qemu_startup.shscript, allowing users to specify multiple port forwards using the-foption. 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
-foption to specify port forwards in the formathost_port:guest_port. Updated the script to process multiple-foptions and construct the appropriate QEMU command line arguments. Modified the usage instructions to include the new-foption.How to Use:
To use the new port forwarding feature, specify the
-foption followed by thehost_port:guest_portpairs. Multiple-foptions 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
-foptions 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)/bootand/usrsize, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.