diff --git a/README.md b/README.md index ca241908e..eb250de0a 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Destination: * `linked_clone` - create VM as a linked clone from latest snapshot. `false` by default. Hardware customization: -* `cpus` - number of CPU sockets. Inherited from source VM by default. +* `CPUs` - number of CPU sockets. Inherited from source VM by default. * `ram` - Amount of RAM in megabytes. Inherited from source VM by default. Post-processing: @@ -92,7 +92,7 @@ Post-processing: "datastore": "datastore1", "linked_clone": true, - "cpus": 2, + "CPUs": 2, "ram": 8192, "ssh_username": "root", diff --git a/config.go b/config.go index d3ed61457..641b97810 100644 --- a/config.go +++ b/config.go @@ -36,7 +36,7 @@ type Config struct { ShutdownTimeout time.Duration // Customization - Cpus string `mapstructure:"cpus"` + CPUs string `mapstructure:"CPUs"` ShutdownCommand string `mapstructure:"shutdown_command"` Ram string `mapstructure:"RAM"` CreateSnapshot bool `mapstructure:"create_snapshot"` @@ -83,9 +83,9 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } // Verify numeric parameters if present - if c.Cpus != "" { - if _, err = strconv.Atoi(c.Cpus); err != nil { - errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of cpu sockets")) + if c.CPUs != "" { + if _, err = strconv.Atoi(c.CPUs); err != nil { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("Invalid number of CPU sockets")) } } if c.Ram != "" { diff --git a/config_test.go b/config_test.go index 0e2de650c..63ff36b82 100644 --- a/config_test.go +++ b/config_test.go @@ -13,7 +13,7 @@ func TestMinimalConfig(t *testing.T) { func TestInvalidCpu(t *testing.T) { raw := minimalConfig() - raw["cpus"] = "string" + raw["CPUs"] = "string" _, warns, errs := NewConfig(raw) testConfigErr(t, warns, errs) } diff --git a/step_configure_hw.go b/step_configure_hw.go index 3f2b235e9..de91d7e4f 100644 --- a/step_configure_hw.go +++ b/step_configure_hw.go @@ -25,14 +25,14 @@ func (s *StepConfigureHW) Run(state multistep.StateBag) multistep.StepAction { var confSpec types.VirtualMachineConfigSpec parametersFlag := ConfigParametersFlag{} // configure HW - if s.config.Cpus != "" { - cpus, err := strconv.Atoi(s.config.Cpus) + if s.config.CPUs != "" { + CPUs, err := strconv.Atoi(s.config.CPUs) if err != nil { state.Put("error", err) return multistep.ActionHalt } - confSpec.NumCPUs = int32(cpus) + confSpec.NumCPUs = int32(CPUs) parametersFlag.NumCPUsPtr = &(confSpec.NumCPUs) } if s.config.Ram != "" {