When trying to increase or reduce the number of CPUs for a Virtual Machine, the task fails with the following error:
A specified parameter was not correct configspec.numcorespersocket
vSphere 7.X
vSphere 8.X
This happens when the number of CPUs that are assigned to the VM is not an integral divisor of VirtualMachineConfigSpec.numCPUs.
For Example:
The current VM has 32 cores, but you want to reduce that number to 24 cores. Under Edit Settings, VM Options, you see the following:
There is no option for 12 cores per socket because it is not an integral divisor of 32.
In order to allow changing the number of CPUs to any cores per socket configuration. Set the Cores per Socket to "Assign at power on". Then you can change the number of CPUs to any valid number of CPUs. The host will assign the number of CPUs per socket when the VM is powered on.
An alternative to this is to make the setting "Assign at power on", click OK, then go back into the VM Options and set it to whatever the new configuration should be.