Added option for the graphics controller.
This commit is contained in:
parent
e9936cf0da
commit
ffa8b7de8a
|
@ -65,10 +65,16 @@ type Config struct {
|
|||
// When set to virtio, the NICs are VirtIO.
|
||||
NICType string `mapstructure:"nic_type" required:"false"`
|
||||
// The audio controller type to be used.
|
||||
// When set to ac97, the audio controller is ICH AC97 (default).
|
||||
// When set to ac97, the audio controller is ICH AC97. This is the default.
|
||||
// When set to hda, the audio controller is Intel HD Audio.
|
||||
// When set to sb16, the audio controller is SoundBlaster 16.
|
||||
AudioController string `mapstructure:"audio_controller" required:"false"`
|
||||
// The graphics controller type to be used.
|
||||
// When set to vboxvga, the graphics controller is VirtualBox VGA. This is the default.
|
||||
// When set to vboxsvga, the graphics controller is VirtualBox SVGA.
|
||||
// When set to vmsvga, the graphics controller is VMware SVGA.
|
||||
// When set to none, the graphics controller is disabled.
|
||||
GfxController string `mapstructure:"gfx_controller" required:"false"`
|
||||
// The guest OS type being installed. By default this is other, but you can
|
||||
// get dramatic performance improvements by setting this to the proper
|
||||
// value. To view all available values for this run VBoxManage list
|
||||
|
@ -225,6 +231,20 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||
errs, errors.New("NIC type can only be 82540EM, 82543GC, 82545EM, Am79C970A, Am79C973, Am79C960 or virtio"))
|
||||
}
|
||||
|
||||
if b.config.GfxController == "" {
|
||||
b.config.GfxController = "vboxvga"
|
||||
}
|
||||
switch b.config.GfxController {
|
||||
case "vboxvga", "vboxsvga", "vmsvga", "none":
|
||||
// do nothing
|
||||
default:
|
||||
errs = packersdk.MultiErrorAppend(
|
||||
errs, errors.New("Graphics controller type can only be vboxvga, vboxsvga, vmsvga, none"))
|
||||
}
|
||||
|
||||
if b.config.AudioController == "" {
|
||||
b.config.AudioController = "ac97"
|
||||
}
|
||||
switch b.config.AudioController {
|
||||
case "ac97", "hda", "sb16":
|
||||
// do nothing
|
||||
|
|
|
@ -26,7 +26,7 @@ func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multis
|
|||
|
||||
name := config.VMName
|
||||
|
||||
commands := make([][]string, 9)
|
||||
commands := make([][]string, 10)
|
||||
commands[0] = []string{
|
||||
"createvm", "--name", name,
|
||||
"--ostype", config.GuestOSType, "--register",
|
||||
|
@ -59,6 +59,7 @@ func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multis
|
|||
"--nictype6", config.NICType,
|
||||
"--nictype7", config.NICType,
|
||||
"--nictype8", config.NICType}
|
||||
commands[9] = []string{"modifyvm", name, "--graphicscontroller", config.GfxController}
|
||||
|
||||
ui.Say("Creating virtual machine...")
|
||||
for _, command := range commands {
|
||||
|
|
Loading…
Reference in New Issue