Merge pull request #7676 from ltrager/master

Add display template option for qemu.
This commit is contained in:
Megan Marsh 2019-11-07 15:41:17 -08:00 committed by GitHub
commit 98c94ab8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -299,6 +299,10 @@ type Config struct {
// to qemu, allowing it to choose the default. This may be needed when running
// under macOS, and getting errors about sdl not being available.
UseDefaultDisplay bool `mapstructure:"use_default_display" required:"false"`
// What QEMU -display option to use. Defaults to gtk, use none to not pass the
// -display option allowing QEMU to choose the default. This may be needed when
// running under macOS, and getting errors about sdl not being available.
Display string `mapstructure:"display" required:"false"`
// The IP address that should be
// binded to for VNC. By default packer will use 127.0.0.1 for this. If you
// wish to bind to all interfaces use 0.0.0.0.

View File

@ -170,8 +170,12 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
}
} else {
if qemuVersion.GreaterThanOrEqual(v2) {
if !config.UseDefaultDisplay {
defaultArgs["-display"] = "sdl"
if len(config.Display) > 0 {
if config.Display != "none" {
defaultArgs["-display"] = config.Display
}
} else if !config.UseDefaultDisplay {
defaultArgs["-display"] = "gtk"
}
} else {
ui.Message("WARNING: The version of qemu on your host doesn't support display mode.\n" +

View File

@ -199,6 +199,10 @@
to qemu, allowing it to choose the default. This may be needed when running
under macOS, and getting errors about sdl not being available.
- `display` (string) - What QEMU -display option to use. Defaults to gtk, use none to not pass the
-display option allowing QEMU to choose the default. This may be needed when
running under macOS, and getting errors about sdl not being available.
- `vnc_bind_address` (string) - The IP address that should be
binded to for VNC. By default packer will use 127.0.0.1 for this. If you
wish to bind to all interfaces use 0.0.0.0.