Open haydenmuhl opened 2 years ago
Unless I hear otherwise, I will start playing around with implementing option 1. It seems like the most general use case.
I'm having the same issue. I'd like to have the ISO, dynamically-created CD / FDD AND additional custom drives attached to the virtual machine. Consider that QEMU's command line arguments a) can be specified multiple times for the same type of device b) have strict ordering since objects might reference other objects, the current design of qemuargs
creates multiple issues in this setup:
qemuargs
, since dynamically-created CD have a random file nameqemuargs = [["-drive", "..."]]
because a -drive
element removes all previous -drive
elementsqemuargs = [["-set", "drive.drive0.file=xxx"]]
to override the OS disk, but it only succeeded half of the times (maybe because of Golang's randomized map iteration)It's better that we have a method to append arguments in an order-preserving way.
For now, I'm considering some workarounds, each of which comes with some caveats:
qemu-system-x86_64.exe
, which is a little tricky to implement on Windows (while very straightforward on a POSIX-compliant shell)
Please search the existing issues for relevant feature requests, and use the reaction feature (https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to add upvotes to pre-existing requests.
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Description
The qemuargs option has the following warning.
I'm was building an image that required an additional ISO besides the bootable ISO specified in
iso_url
. It caught me by surprise thatiso_url
and the default hard drive silently disappeared because of this. The downstream errors that I saw were very confusing. For example, inline shell provisioners only worked if they contained a single command. If they contained more than one command they would not execute, because the script upload failed.I will admit, this is a failure on my part to read the documentation in detail, but it took me two months to finally figure out what was going wrong. A big, noisy, descriptive error up front could have saved me a lot of time.
Use Case(s)
An easier way to add additional drives to a qemu VM. For example, we boot our VMs with an iPXE ISO image, for its clean interface for inputing boot parameters. If an OS installs from a disk, such as another ISO image, supplying that additional ISO image triggers this problem.
Potential configuration
If a
-drive
argument is supplied, raise an error, and require a different configuration.Option 1: A flag to explicitly disable the default cdrom and hard drive.
Option 2: A
drives
array, where additional drives can be declared in a structured manner.These options aren't mutually exclusive.
Potential References
https://www.packer.io/docs/builders/qemu#qemuargs