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

@ -84,30 +84,31 @@ type Config struct {
Comm communicator.Config `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"`
common.FloppyConfig `mapstructure:",squash"` common.FloppyConfig `mapstructure:",squash"`
ISOSkipCache bool `mapstructure:"iso_skip_cache"` ISOSkipCache bool `mapstructure:"iso_skip_cache"`
Accelerator string `mapstructure:"accelerator"` Accelerator string `mapstructure:"accelerator"`
BootCommand []string `mapstructure:"boot_command"` BootCommand []string `mapstructure:"boot_command"`
DiskInterface string `mapstructure:"disk_interface"` DiskInterface string `mapstructure:"disk_interface"`
DiskSize uint `mapstructure:"disk_size"` DiskSize uint `mapstructure:"disk_size"`
DiskCache string `mapstructure:"disk_cache"` DiskCache string `mapstructure:"disk_cache"`
DiskDiscard string `mapstructure:"disk_discard"` DiskDiscard string `mapstructure:"disk_discard"`
SkipCompaction bool `mapstructure:"skip_compaction"` SkipCompaction bool `mapstructure:"skip_compaction"`
DiskCompression bool `mapstructure:"disk_compression"` DiskCompression bool `mapstructure:"disk_compression"`
Format string `mapstructure:"format"` Format string `mapstructure:"format"`
Headless bool `mapstructure:"headless"` Headless bool `mapstructure:"headless"`
DiskImage bool `mapstructure:"disk_image"` DiskImage bool `mapstructure:"disk_image"`
MachineType string `mapstructure:"machine_type"` MachineType string `mapstructure:"machine_type"`
NetDevice string `mapstructure:"net_device"` NetDevice string `mapstructure:"net_device"`
OutputDir string `mapstructure:"output_directory"` OutputDir string `mapstructure:"output_directory"`
QemuArgs [][]string `mapstructure:"qemuargs"` QemuArgs [][]string `mapstructure:"qemuargs"`
QemuBinary string `mapstructure:"qemu_binary"` QemuBinary string `mapstructure:"qemu_binary"`
ShutdownCommand string `mapstructure:"shutdown_command"` ShutdownCommand string `mapstructure:"shutdown_command"`
SSHHostPortMin uint `mapstructure:"ssh_host_port_min"` SSHHostPortMin uint `mapstructure:"ssh_host_port_min"`
SSHHostPortMax uint `mapstructure:"ssh_host_port_max"` SSHHostPortMax uint `mapstructure:"ssh_host_port_max"`
VNCBindAddress string `mapstructure:"vnc_bind_address"` UseDefaultDisplay bool `mapstructure:"use_default_display"`
VNCPortMin uint `mapstructure:"vnc_port_min"` VNCBindAddress string `mapstructure:"vnc_bind_address"`
VNCPortMax uint `mapstructure:"vnc_port_max"` VNCPortMin uint `mapstructure:"vnc_port_min"`
VMName string `mapstructure:"vm_name"` VNCPortMax uint `mapstructure:"vnc_port_max"`
VMName string `mapstructure:"vm_name"`
// These are deprecated, but we keep them around for BC // These are deprecated, but we keep them around for BC
// TODO(@mitchellh): remove // TODO(@mitchellh): remove

View File

@ -124,7 +124,9 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
} }
} else { } else {
if qemuMajor >= 2 { if qemuMajor >= 2 {
defaultArgs["-display"] = "sdl" if !config.UseDefaultDisplay {
defaultArgs["-display"] = "sdl"
}
} else { } else {
ui.Message("WARNING: The version of qemu on your host doesn't support display mode.\n" + ui.Message("WARNING: The version of qemu on your host doesn't support display mode.\n" +
"The display parameter will be ignored.") "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 switch/value pairs. Any value specified as an empty string is ignored. All
values after the switch are concatenated with no separator. 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 \~> **Warning:** The qemu command line allows extreme flexibility, so beware
of conflicting arguments causing failures of your run. For instance, using 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., --no-acpi could break the ability to send power signal type commands (e.g.,