hashicorp / hashicorp/packer-plugin-qemu
Allow both cdrom & disk to use the virtio interface
- Dominant language
- Go
- Stars
- 85
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
I'm running into this exact same issue with `qemu-system-aarch64` (running on a macbook m2)
except it's with the `virtio` interface.
https://github.com/hashicorp/packer-plugin-qemu/issues/35
```terraform
source "qemu" "vagrant" {
headless = true
cpu_model = "host"
memory = 2048
cpus = 4
disk_size = 210000
net_device = "virtio-net"
disk_interface = "virtio"
cdrom_interface = "virtio"
format = "qcow2"
accelerator = "hvf"
machine_type = "virt"
qemu_binary = "qemu-system-aarch64"
iso_url = "${var.iso_path}"
...
}
```
The issue is two fold.
1. I can only use the `virtio` interface for both the hdd + cdrom on this system. So I can't use `virtio-scsi`, `sata`, `ide`....etc
```
unsupported bus type 'virtio-scsi'
```
So I can't utilize this "fix" https://github.com/hashicorp/packer/issues/10211#issuecomment-778164090
As that comment shows, people were experiencing this exact issue years ago.
2. There's a device conflict:
The error I'm getting is
```
qemu-system-aarch64: -drive file=boot.iso,if=virtio,id=cdrom0,media=cdrom,index=0: drive with bus=0, unit=0 (index=0) exists](qemu-system-aarch64: -drive file=boot.iso,if=virtio,index=0,id=cdrom0,media=cdrom: drive with bus=0, unit=0 (index=0) exists)
```
Normally when I'm running `qemu` manually on my system, I use the following argument
```
-cdrom boot.iso
```
and that works fine. But `packer` seems very opinionated in this area and forces the use of the `-drive` argument
I would like to request one of the following two features.
1. Allow both cdrom & disk to use the `virtio` interfaces.
The same logic already exists here for the `virtio-scsi` interface:
https://github.com/hashicorp/packer-plugin-qemu/pull/40/commits/221d5f94ec7b9898eb5bbba29f61a88d6bfdee80
2. Create an additional `iso_manual_args` option (or something like that) that would be mutually exclusive with `iso_url(s)`
So that users could simply manually specify the cdrom args themselves.
Currently `packer` enforces the use of `iso_url`
```
One of iso_url or iso_urls must be specified
```
Contributor guide
Research direction
Start by tracing how the QEMU builder handles disk_interface, cdrom_interface, and iso_url, then compare that path with the existing virtio-scsi handling referenced in the issue. Done means either both disk and CD-ROM can use virtio without a device conflict, or a mutually exclusive manual ISO-arguments option is supported with appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100