From 7dbcefaf20ce714c7549b3af610861a227c3dee5 Mon Sep 17 00:00:00 2001 From: amree Date: Sun, 6 Oct 2019 04:25:48 +0800 Subject: [PATCH 1/2] Update "Build an Image" Documentation We defined a user variable for the region but we're not using it. This PR will update the template to use that particular variable --- website/source/intro/getting-started/build-image.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/intro/getting-started/build-image.html.md b/website/source/intro/getting-started/build-image.html.md index 6ddd59914..cf4233b7c 100644 --- a/website/source/intro/getting-started/build-image.html.md +++ b/website/source/intro/getting-started/build-image.html.md @@ -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": { From d3f369494a6063fdc559b11b677bb2354a92b978 Mon Sep 17 00:00:00 2001 From: Samuel Noordhuis Date: Sun, 6 Oct 2019 20:14:04 +1100 Subject: [PATCH 2/2] Add support for SCSI controller selection --- builder/proxmox/config.go | 21 ++++++++++++-------- builder/proxmox/config_test.go | 4 ++++ builder/proxmox/step_start_vm.go | 1 + website/source/docs/builders/proxmox.html.md | 4 ++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/builder/proxmox/config.go b/builder/proxmox/config.go index 6889c8c07..05dd32b66 100644 --- a/builder/proxmox/config.go +++ b/builder/proxmox/config.go @@ -37,14 +37,15 @@ 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"` - 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"` + 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"` @@ -159,6 +160,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)...) diff --git a/builder/proxmox/config_test.go b/builder/proxmox/config_test.go index ec654dc54..ce6041ddd 100644 --- a/builder/proxmox/config_test.go +++ b/builder/proxmox/config_test.go @@ -94,6 +94,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) @@ -116,6 +117,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) { diff --git a/builder/proxmox/step_start_vm.go b/builder/proxmox/step_start_vm.go index 76663b33f..71e3fa15f 100644 --- a/builder/proxmox/step_start_vm.go +++ b/builder/proxmox/step_start_vm.go @@ -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 { diff --git a/website/source/docs/builders/proxmox.html.md b/website/source/docs/builders/proxmox.html.md index ca7c99ea3..3c5c8db55 100644 --- a/website/source/docs/builders/proxmox.html.md +++ b/website/source/docs/builders/proxmox.html.md @@ -152,6 +152,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