Packer: qemu builder net_device validation too aggressive

Created on 24 Mar 2019  ·  6Comments  ·  Source: hashicorp/packer

I think the hardcoded list of allowed values for net_device in qemu builds may have lagged behind the available virtual NIC's that qemu now offers. For example, virtio-net-device is offered by qemu-system-aarch64, but this value is rejected by packer for net_device.

bug buildeqemu community-supported plugin good first issue

Most helpful comment

I think the chain of commands that can be used to get (more or less definite?) list is something like this

// get all machine types
qemu-system-* -machine help
// get all accelerators
qemu-system-* -accel help



md5-eb94101bcd858dbce629be740afba1db



qemu-system-* -machine type={machine-type-from-above},accel={accel-from-above} -device help



md5-492def491e767bab526c7ae16b80ebbc



$ qemu-system-arm -machine type=xyz
qemu-system-arm: -machine type=xyz: unsupported machine type
Use -machine help to list supported machines

So as long as Packer can transparently pass that error to the user I think we could just avoid the static validation altogether? 🤔

This is on QEMU 3.1.0 - it may be worth checking 2.x.x too, but I doubt it will be much different.

All 6 comments

Hey, thanks. Do you know of a list of allowed values I could refer to in order to update the validation?

I think the chain of commands that can be used to get (more or less definite?) list is something like this

// get all machine types
qemu-system-* -machine help
// get all accelerators
qemu-system-* -accel help



md5-eb94101bcd858dbce629be740afba1db



qemu-system-* -machine type={machine-type-from-above},accel={accel-from-above} -device help



md5-492def491e767bab526c7ae16b80ebbc



$ qemu-system-arm -machine type=xyz
qemu-system-arm: -machine type=xyz: unsupported machine type
Use -machine help to list supported machines

So as long as Packer can transparently pass that error to the user I think we could just avoid the static validation altogether? 🤔

This is on QEMU 3.1.0 - it may be worth checking 2.x.x too, but I doubt it will be much different.

For now, it may better to turn off validation and allow good builds to succeed, with proper validation reintroduced later. That would represent a more practical false positive / false negative situation. The current code makes it hard to manage qemu guests.

That's fair. I'm happy to stop validating as long as the error bubbles up properly.

I ran into this issue myself with a powerpc machine since the sungem adapter isn't available in the default list.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frezbo picture frezbo  ·  3Comments

znerd picture znerd  ·  3Comments

Tensho picture Tensho  ·  3Comments

jesse-c picture jesse-c  ·  3Comments

brettswift picture brettswift  ·  3Comments