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.
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.
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.
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
.