add support for hvf accelerator to qemu builder

This commit is contained in:
Adam Robinson 2018-04-25 10:50:58 -04:00
parent bda2d8c947
commit 29b89e63b8
2 changed files with 10 additions and 3 deletions

View File

@ -27,6 +27,7 @@ var accels = map[string]struct{}{
"tcg": {}, "tcg": {},
"xen": {}, "xen": {},
"hax": {}, "hax": {},
"hvf": {},
} }
var netDevice = map[string]bool{ var netDevice = map[string]bool{
@ -255,7 +256,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
if _, ok := accels[b.config.Accelerator]; !ok { if _, ok := accels[b.config.Accelerator]; !ok {
errs = packer.MultiErrorAppend( errs = packer.MultiErrorAppend(
errs, errors.New("invalid accelerator, only 'kvm', 'tcg', 'xen', 'hax', or 'none' are allowed")) errs, errors.New("invalid accelerator, only 'kvm', 'tcg', 'xen', 'hax', 'hvf', or 'none' are allowed"))
} }
if _, ok := netDevice[b.config.NetDevice]; !ok { if _, ok := netDevice[b.config.NetDevice]; !ok {

View File

@ -112,8 +112,8 @@ Linux server and have not enabled X11 forwarding (`ssh -X`).
### Optional: ### Optional:
- `accelerator` (string) - The accelerator type to use when running the VM. - `accelerator` (string) - The accelerator type to use when running the VM.
This may be `none`, `kvm`, `tcg`, `hax`, or `xen`. The appropriate software This may be `none`, `kvm`, `tcg`, `hax`, `hvf`, or `xen`. The appropriate
must have already been installed on your build machine to use the software must have already been installed on your build machine to use the
accelerator you specified. When no accelerator is specified, Packer will try accelerator you specified. When no accelerator is specified, Packer will try
to use `kvm` if it is available but will default to `tcg` otherwise. to use `kvm` if it is available but will default to `tcg` otherwise.
@ -121,6 +121,12 @@ Linux server and have not enabled X11 forwarding (`ssh -X`).
upstream issue which can be tracked upstream issue which can be tracked
[here](https://github.com/intel/haxm/issues/20). [here](https://github.com/intel/haxm/issues/20).
-> The `hvf` accelerator is new and experimental as of
[QEMU 2.12.0](https://wiki.qemu.org/ChangeLog/2.12#Host_support).
You may encounter issues unrelated to Packer when using it. You may need to
add [ "-global", "virtio-pci.disable-modern=on" ] to `qemuargs` depending on the
guest operating system.
- `boot_command` (array of strings) - This is an array of commands to type - `boot_command` (array of strings) - This is an array of commands to type
when the virtual machine is first booted. The goal of these commands should when the virtual machine is first booted. The goal of these commands should
be to type just enough to initialize the operating system installer. Special be to type just enough to initialize the operating system installer. Special