Merge pull request #8199 from brickstool/f-proxmox-add-scsi-controller-support

[Proxmox] Add support for SCSI controller selection
This commit is contained in:
Megan Marsh 2019-10-07 10:37:54 -07:00 committed by GitHub
commit deda067355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View File

@ -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)...)

View File

@ -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) {

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

@ -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