Merge pull request #1407 from hiroyuki-sato/patch_for_packer
builder/qemu: add machine_type option for qemu builder.
This commit is contained in:
commit
18a4a4d5ea
|
@ -67,6 +67,7 @@ type config struct {
|
|||
ISOChecksum string `mapstructure:"iso_checksum"`
|
||||
ISOChecksumType string `mapstructure:"iso_checksum_type"`
|
||||
ISOUrls []string `mapstructure:"iso_urls"`
|
||||
MachineType string `mapstructure:"machine_type"`
|
||||
NetDevice string `mapstructure:"net_device"`
|
||||
OutputDir string `mapstructure:"output_directory"`
|
||||
QemuArgs [][]string `mapstructure:"qemuargs"`
|
||||
|
@ -127,6 +128,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
b.config.HTTPPortMax = 9000
|
||||
}
|
||||
|
||||
if b.config.MachineType == "" {
|
||||
b.config.MachineType = "pc-1.0"
|
||||
}
|
||||
|
||||
if b.config.OutputDir == "" {
|
||||
b.config.OutputDir = fmt.Sprintf("output-%s", b.config.PackerBuildName)
|
||||
}
|
||||
|
@ -205,6 +210,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
"shutdown_timeout": &b.config.RawShutdownTimeout,
|
||||
"ssh_wait_timeout": &b.config.RawSSHWaitTimeout,
|
||||
"accelerator": &b.config.Accelerator,
|
||||
"machine_type": &b.config.MachineType,
|
||||
"net_device": &b.config.NetDevice,
|
||||
"disk_interface": &b.config.DiskInterface,
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
|
|||
|
||||
defaultArgs := make(map[string]string)
|
||||
defaultArgs["-name"] = vmName
|
||||
defaultArgs["-machine"] = fmt.Sprintf("type=pc-1.0,accel=%s", config.Accelerator)
|
||||
defaultArgs["-machine"] = fmt.Sprintf("type=%s,accel=%s", config.MachineType, config.Accelerator)
|
||||
defaultArgs["-display"] = guiArgument
|
||||
defaultArgs["-netdev"] = "user,id=user.0"
|
||||
defaultArgs["-device"] = fmt.Sprintf("%s,netdev=user.0", config.NetDevice)
|
||||
|
|
Loading…
Reference in New Issue