Skip to content

Instantly share code, notes, and snippets.

@atomic-penguin
Last active December 30, 2015 09:19
Show Gist options
  • Save atomic-penguin/7808639 to your computer and use it in GitHub Desktop.
Save atomic-penguin/7808639 to your computer and use it in GitHub Desktop.
Centos/EL5 CPU hot add

CentOS/EL5 CPU hot add

VMWare allows you to hot add vCPUs to RHEL 5.5 and newer machines. However, you have to tell the OS to pick up the added vCPUs.

Enabling CPU hot add in VMWare

In the VMWare vSphere client, click Edit Settings on the Virtual Machine to open the Properties dialog. Next, go to the Options tab, find the Advanced->Memory/CPU Hotplug section, and select the radio button next to Enable CPU hot add only for this virtual machine. CPU hot add and remove is not yet supported on RHEL5, according to the Redhat KB article 15523.

You will have to reboot the Virtual Machine after enabling CPU hot add, to enable this option in the VM's BIOS.

Adding vCPUs in vSphere

Simply go to the Hardware tab on the Properties dialog. Select the CPU option, and increase the number of virtual sockets, e.g. change virtual sockets from 2 to 4.

Bringing the added vCPU(s) online

If I changed the vCPU configuration from 2 (sockets) x 2 (cores), to 4 (sockets) x 2 (cores) then I added 4 vCPU for a total of 8 vCPU cores. The vCPUs are zero-indexed in the sys pseudo-filesystem /sys/devices/systemp/cpu/cpuX where cpuX represents cpu0, cpu1, etc.

In order to bring the 4 added vCPU(s) online, one could run a simple bash loop to bring cpu4 through cpu7 online.

for i in 4 5 6 7
  do echo 1 > /sys/devices/system/cpu/cpu$i/online
done

You can verify the added vCPUs have been brought online by examining /proc/cpuinfo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment