CPU vs vCPU in VM template

I kind of understand the concept of vcpu. You can assign as many vcpus as you like and the scheduler will assign a VM’s tasks to on the same number of physical cpus if they are available. If physical cpus are not available, those tasks basically wait until the assigned cpu is free.

So, what is the significance of assigning a cpu value and a vcpu value in a VM template? For example, what does it mean if I assign 1 cpu and 4 vcpu? and vice versa. Thanks!

1 Like

Hi,

Think of cpu and vcpu this way:

CPU: amount of the host cpu reserved for this VM. This is used by the scheduler, and it guides the number of VMs sento to a host.
A host with 4 cores (shown as cpu = 400) can run

  • 1 vm with cpu=4
  • or 2 VMs with cpu=2
  • or 8 VMs with cpu=0.5

This value has no effect on the actual VM at the hypervisor level.

vCPU: defines the number of cpus for the actual VM. Or put another way: number of cpus that the guest sees. This value has no effect on the VM placement or quota usage.

6 Likes

Hi @cmartin,

Perfect explanation. Is there a way to not display CPU value in the template and instead display the vCPU? Considering your last example, when user clicks on a template with 0.5 CPU and 8 vCPU what he sees in capacity section is CPU 0.5 even though inside the VM shows 8 cores.

Thanks for your explanation.

Are you talking about the cloud view? We don’t have a setting you can use to do that.

If you want to modify the Sunstone code, read:
http://docs.opennebula.org/4.14/integration/references/sunstone_dev.html

The file you need to modify is provision-tab.js:

1 Like