Merge branch 'master' into f-proxmox-cpu-type-support

This commit is contained in:
Adrien Delorme 2019-10-08 10:34:53 +02:00 committed by GitHub
commit ef4db8b158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 10 deletions

View File

@ -37,15 +37,16 @@ type Config struct {
VMName string `mapstructure:"vm_name"`
VMID int `mapstructure:"vm_id"`
Memory int `mapstructure:"memory"`
Cores int `mapstructure:"cores"`
Sockets int `mapstructure:"sockets"`
CPUType string `mapstructure:"cpu_type"`
OS string `mapstructure:"os"`
NICs []nicConfig `mapstructure:"network_adapters"`
Disks []diskConfig `mapstructure:"disks"`
ISOFile string `mapstructure:"iso_file"`
Agent bool `mapstructure:"qemu_agent"`
Memory int `mapstructure:"memory"`
Cores int `mapstructure:"cores"`
CPUType string `mapstructure:"cpu_type"`
Sockets int `mapstructure:"sockets"`
OS string `mapstructure:"os"`
NICs []nicConfig `mapstructure:"network_adapters"`
Disks []diskConfig `mapstructure:"disks"`
ISOFile string `mapstructure:"iso_file"`
Agent bool `mapstructure:"qemu_agent"`
SCSIController string `mapstructure:"scsi_controller"`
TemplateName string `mapstructure:"template_name"`
TemplateDescription string `mapstructure:"template_description"`
@ -164,6 +165,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs = packer.MultiErrorAppend(errs, errors.New(fmt.Sprintf("disk format must be specified for pool type %q", c.Disks[idx].StoragePoolType)))
}
}
if c.SCSIController == "" {
log.Printf("SCSI controller not set, using default 'lsi'")
c.SCSIController = "lsi"
}
errs = packer.MultiErrorAppend(errs, c.Comm.Prepare(&c.ctx)...)
errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare(&c.ctx)...)

View File

@ -95,6 +95,7 @@ func TestBasicExampleFromDocsIsValid(t *testing.T) {
// NIC 0 model not set, using default 'e1000'
// Disk 0 cache mode not set, using default 'none'
// Agent not set, default is true
// SCSI controller not set, using default 'lsi'
if b.config.Memory != 512 {
t.Errorf("Expected Memory to be 512, got %d", b.config.Memory)
@ -120,6 +121,9 @@ func TestBasicExampleFromDocsIsValid(t *testing.T) {
if b.config.Agent != true {
t.Errorf("Expected Agent to be true, got %t", b.config.Agent)
}
if b.config.SCSIController != "lsi" {
t.Errorf("Expected SCSI controller to be 'lsi', got %s", b.config.SCSIController)
}
}
func TestAgentSetToFalse(t *testing.T) {

View File

@ -40,6 +40,7 @@ func (s *stepStartVM) Run(ctx context.Context, state multistep.StateBag) multist
QemuIso: c.ISOFile,
QemuNetworks: generateProxmoxNetworkAdapters(c.NICs),
QemuDisks: generateProxmoxDisks(c.Disks),
Scsihw: c.SCSIController,
}
if c.VMID == 0 {

View File

@ -156,6 +156,10 @@ builder.
then `qemu-guest-agent` must be installed on the guest. When disabled, then
`ssh_host` should be used. Defaults to `true`.
- `scsi_controller` (string) - The SCSI controller model to emulate. Can be `lsi`,
`lsi53c810`, `virtio-scsi-pci`, `virtio-scsi-single`, `megasas`, or `pvscsi`.
Defaults to `lsi`.
## Example: Fedora with kickstart
Here is a basic example creating a Fedora 29 server image with a Kickstart

View File

@ -235,7 +235,7 @@ Now save the following text in a file named `firstrun.json`:
"access_key": "{{user `aws_access_key`}}",
"ami_name": "packer-linux-aws-demo-{{timestamp}}",
"instance_type": "t2.micro",
"region": "us-east-1",
"region": "{{user `region`}}",
"secret_key": "{{user `aws_secret_key`}}",
"source_ami_filter": {
"filters": {