builder/qemu: add use_default_display option

If set, won't set `-display dsl` as a default argument. Useful for osx
compatibility.
This commit is contained in:
Matthew Hooker 2016-12-16 17:33:33 -08:00
parent a2d196ee9b
commit 0339fcc442
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
3 changed files with 32 additions and 25 deletions

View File

@ -104,6 +104,7 @@ type Config struct {
ShutdownCommand string `mapstructure:"shutdown_command"`
SSHHostPortMin uint `mapstructure:"ssh_host_port_min"`
SSHHostPortMax uint `mapstructure:"ssh_host_port_max"`
UseDefaultDisplay bool `mapstructure:"use_default_display"`
VNCBindAddress string `mapstructure:"vnc_bind_address"`
VNCPortMin uint `mapstructure:"vnc_port_min"`
VNCPortMax uint `mapstructure:"vnc_port_max"`

View File

@ -124,7 +124,9 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
}
} else {
if qemuMajor >= 2 {
if !config.UseDefaultDisplay {
defaultArgs["-display"] = "sdl"
}
} else {
ui.Message("WARNING: The version of qemu on your host doesn't support display mode.\n" +
"The display parameter will be ignored.")

View File

@ -236,6 +236,10 @@ Linux server and have not enabled X11 forwarding (`ssh -X`).
switch/value pairs. Any value specified as an empty string is ignored. All
values after the switch are concatenated with no separator.
- `use_default_display` (boolean) - If true, do not pass a `-display` option
to qemu, allowing it to choose the default. This may be needed when running
under OS X.
\~> **Warning:** The qemu command line allows extreme flexibility, so beware
of conflicting arguments causing failures of your run. For instance, using
--no-acpi could break the ability to send power signal type commands (e.g.,