-
Notifications
You must be signed in to change notification settings - Fork 28
run_qemu.sh: fix --rw option just broken by switch to -blockdev #213
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1862,7 +1862,18 @@ prepare_qcmd() | |
;; | ||
esac | ||
|
||
qcmd+=("-blockdev" "driver=file,node-name=maindisk,filename=$_arg_rootfs") | ||
if [[ $_arg_rw == 'on' ]]; then | ||
qcmd+=("-blockdev" "driver=file,node-name=maindisk,filename=${_arg_rootfs}") | ||
else | ||
local _overlay=${_arg_rootfs}-overlay.qcow2 | ||
rm -f "${_overlay}" | ||
qemu-img create -F raw -b "${_arg_rootfs}" -f qcow2 "${_overlay}" | ||
# "Finding your way through the QEMU parameter jungle" | ||
# -- Thomas Huth | ||
qcmd+=("-blockdev" "file,node-name=mainoverlay,filename=${_overlay}") | ||
qcmd+=("-blockdev" "qcow2,node-name=maindisk,file=mainoverlay") | ||
fi | ||
|
||
qcmd+=("-device" "virtio-blk,bus=pcie.0,drive=maindisk") | ||
|
||
if [ $_arg_direct_kernel = "on" ] && [ -n "$vmlinuz" ] && [ -n "$initrd" ]; then | ||
|
@@ -1903,6 +1914,7 @@ prepare_qcmd() | |
fi | ||
|
||
if [[ $_arg_rw == "off" ]]; then | ||
# Note this is only for the (deprecated) -drive and ignored by -blockdev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to just remove this block - considering we've fully moved away from -drive.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still use |
||
qcmd+=("-snapshot") | ||
fi | ||
|
||
|
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.
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.
Just out of curiosity, is there a way to 'apply' the overlay onto the raw image?
A workflow I've used in the past is to create an image using run_qemu with my kernel and anything else I need, and then use that raw image elsewhere, say an emulator or even dd it to a drive and use it on a real system. I'm not sure if something like this is frequently used/needed by others, but these changes (starting with -blockdev) would preclude doing this..
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.
You can "apply" and many other things using
qemu-img
but I think that's out of scope for run_qemu.sh. I mean, run_qemu.sh is already a wrapper of many other tools, I don't think we should addqemu-img
to that long list.The overlay is left behind (until the next run) so anyone is free to change their mind and apply it outside
run_qemu.sh
.This PR is designed to fix
--rw
which I just broke and bring it back exactly where it was. I don't see what it would preclude, can you elaborate? If nothing else I feel like it's opening more possibilities, including... becoming aqemu-img
wrapper, which I think is not a good idea.Uh oh!
There was an error while loading. Please reload this page.
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.
Oh yes I was not suggesting run_qemu should grow to provide this apply overlay functionality. More that if we ever wanted to do this kind of an "export a customized image" workflow, there was still /some/ way to accomplish that with the overlay. No issues merging this by me!