For certain hypervisors and guest operating systems, users can configure cores per socket for virtual CPUs to take greater advantage of physical processing power.
By default the cores per socket attribute is not set and the default is one core per socket. This means that 1 virtual CPU uses 1 physical core (and one CPU socket), even if more cores are available.
Set Cores per Socket
Changes to cores per socket take effect as follows:
- If you edit a template, the change will apply to all VMs created from the template after the change is made.
- If you edit a VM, the change will apply after the reconfigure is completed.
API Example of Set Cores per Socket
To set cores per socket of a VM template with the Abiquo API:
- Get a VM template. See https://wiki.abiquo.com/api/latest/VirtualMachineTemplatesResource.html#get-a-virtual-machine-template
- Edit the resulting VM template, for example:
- Change "cpuRequired" : 1 to "cpuRequired" : 8
- Add the attribute: "coresPerSocket" : 4
- This is an optional attribute that is not present in the example
- Update the VM template with a put request. The put request will return the resulting template.
To set cores per socket for a VM, set the "cpu" attribute to a multiple of cores per socket.
Set Cores per socket in VM templates and VMs in the UI
- Set the total number of cores in the GUI by changing the # CPU field, (like "cpu" and "cpuRequired" in the API).
- It must be a multiple of the cores per socket
- The minimum value must be the number of cores per socket, because the VM requires at least one socket
- Template Min CPU and Max CPU should also be multiples of cores per socket
- Set the cores per socket.
Screenshot: Set cores per socket in VM templates
Privilege: Manage VM templates from Apps library
Screenshot: Set cores per socket in VMs
Check the following:
- Your hypervisor will have a limit on the number of cores per socket, depending on the hypervisor version and license.
- If an error displays that the total number of cores is not divisible by the cores When you set the cores per socket, check that you also
Otherwise, your request may fail with a message that the total number of cores is not divisible by the cores per socket.
- Set the total number of vCPUs to a multiple of the cores per socket
- Set enough cores to fill at least one socket.