Added logic to the vmware-iso builder that appends the number of cores per socket to the vmx in `stepCreateVmx`.

This commit is contained in:
Ali Rizvi-Santiago 2019-01-11 19:00:54 -06:00
parent 062c62eed8
commit 4894873971
1 changed files with 8 additions and 1 deletions

View File

@ -429,12 +429,19 @@ func (s *stepCreateVMX) Run(_ context.Context, state multistep.StateBag) multist
s.tempDir = vmxDir
}
/// Now to handle options that will modify the template
/// Now to handle options that will modify the template without using "vmxTemplateData"
vmxData := vmwcommon.ParseVMX(vmxContents)
// If no cpus were specified, then remove the entry to use the default
if vmxData["numvcpus"] == "" {
delete(vmxData, "numvcpus")
}
// If some number of cores were specified, then update "cpuid.coresPerSocket" with the requested value
if config.HWConfig.CoreCount > 0 {
vmxData["cpuid.corespersocket"] = strconv.Itoa(config.HWConfig.CoreCount)
}
/// Write the vmxData to the vmxPath
vmxPath := filepath.Join(vmxDir, config.VMName+".vmx")
if err := vmwcommon.WriteVMX(vmxPath, vmxData); err != nil {