From 65f71daf734035ab80a1a1fe4517d9bf5e428d89 Mon Sep 17 00:00:00 2001 From: Matthias Schmitz Date: Mon, 21 Jul 2014 23:01:08 +0200 Subject: [PATCH] Allow 'tcg' as accelerator in builder-qemu * Using 'tcg' as accelerator for qemu-system allows packer to run in a virtual machine as no kvm or xen support is needed. * Also document the default behavior if no accelerator is given in the documentation. --- builder/qemu/builder.go | 4 ++-- website/source/docs/builders/qemu.html.markdown | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 7f404a566..f320c9480 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -249,9 +249,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, errors.New("invalid format, only 'qcow2' or 'raw' are allowed")) } - if !(b.config.Accelerator == "kvm" || b.config.Accelerator == "xen") { + if !(b.config.Accelerator == "kvm" || b.config.Accelerator == "xen" || b.config.Accelerator == "tcg") { errs = packer.MultiErrorAppend( - errs, errors.New("invalid format, only 'kvm' or 'xen' are allowed")) + errs, errors.New("invalid format, only 'kvm', 'xen' or 'tcg' are allowed")) } if _, ok := netDevice[b.config.NetDevice]; !ok { diff --git a/website/source/docs/builders/qemu.html.markdown b/website/source/docs/builders/qemu.html.markdown index 2430c737f..1d36d88ce 100644 --- a/website/source/docs/builders/qemu.html.markdown +++ b/website/source/docs/builders/qemu.html.markdown @@ -91,8 +91,8 @@ each category, the available options are alphabetized and described. ### Optional: * `accelerator` (string) - The accelerator type to use when running the VM. - This may have a value of either "kvm" or "xen" and you must have that - support in on the machine on which you run the builder. + This may have a value of either "kvm", "xen" or "tcg" and you must have that + support on the machine on which you run the builder. By default "kvm" is used. * `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