One of the reasons why we started using Oracle VM was due to Oracle’s licensing policy with their products running on top of Oracle VM.

If you “pin” (or hard partition) the virtual machine to specific cores you don’t need to license whole server pool which the virtual machine runs on. Drawback is when you have commodity hardware with Oracle VM the only way to do CPU pinning is from the command line!

In case you have hyper threading enabled on your Oracle Virtual Server and have x86 Intel processors the licensing is quite straight forward:

VM has 8 vCPUs allocated which means you will need 2 core licenses for your Oracle product if hard partitioning/cpu pinning is used. This is due to Intel-based processor factor 0.5 and 8 vCPUs using total of 8 threads from 4 cores. 4c x 0.5 = 2. ūüôā
However you will need to be careful that you have the hard partitioning in place so you don’t need to license whole server pool. Also with hard partitioning in use you will not be able to use live migrate for your VM.

The actual CPU pinning with 3.4.2

I want to check what my OVS has in terms of vCPU’s I can allocate to one VM:

[root@OVS1 ~]# xm info

host : OVS1.local
release : 4.1.12-61.1.9.el6uek.x86_64
version : #2 SMP Tue Sep 13 22:53:36 PDT 2016
machine : x86_64
nr_cpus : 32
nr_nodes : 2
cores_per_socket : 8
threads_per_core : 2
cpu_mhz : 2700

In this server I have 2 CPU sockets with 8 cores each and 2 threads per core. This adds to total of 32 CPUs.

Next I want to check which VM’s are using which CPUs. As seen part of CPUs are allocated to dom0 already:

[root@OVS1 ~]# xm vcpu-list
Name        ID VCPU CPU State Time(s) CPU Affinity
Domain-0 0 0 0 -b- 36760.2 0
Domain-0 0 1 1 -b- 26625.9 1
Domain-0 0 2 2 -b- 46877.3 2
Domain-0 0 3 3 -b- 20995.3 3
Domain-0 0 4 4 -b- 38292.6 4
Domain-0 0 5 5 -b- 21067.0 5
Domain-0 0 6 6 -b- 89754.7 6
Domain-0 0 7 7 -b- 75418.8 7
Domain-0 0 8 8 -b- 47228.8 8
Domain-0 0 9 9 -b- 29581.8 9
Domain-0 0 10 10 -b- 35139.4 10
Domain-0 0 11 11 -b- 20257.9 11
Domain-0 0 12 12 -b- 27636.9 12
Domain-0 0 13 13 -b- 17393.8 13
Domain-0 0 14 14 -b- 27594.6 14
Domain-0 0 15 15 -b- 16195.1 15
Domain-0 0 16 16 -b- 97024.1 16
Domain-0 0 17 17 -b- 72472.6 17
Domain-0 0 18 18 -b- 86671.8 18
Domain-0 0 19 19 r-- 125745.7 19
0004fb0000060000c04cfa6f302883fa 23 0 21 -b- 4074.3 16-31
0004fb0000060000c04cfa6f302883fa 23 1 31 -b- 2706.9 16-31
0004fb0000060000c04cfa6f302883fa 23 2 23 -b- 1013.0 16-31
0004fb0000060000c04cfa6f302883fa 23 3 22 -b- 4148.8 16-31

I’m interested in VM¬†0004fb0000060000c04cfa6f302883fa named test_vm_1 which uses CPUs (threads) 21,22,23 & 31 currently. I have downloaded OVM tools which are found in patch 13602094 so I can use ovm vmtools to check current status:

[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h OVM1 -v test_vm_1 -c getvcpu
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : getvcpu
Getting pinned CPU list...
No CPU pinned for VM 'test_vm_1'

At the moment CPUs are not pinned. In Oracle VM release 3 you can use OVM tools to do the actual pinning:

[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h fOVM1 -v test_vm_1 -c setvcpu -s 21-24
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : setvcpu
Pinning vCPU '21-24' to VM 'test_vm_1'
Pin vCPU succeed.
[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h OVM1 -v test_vm_1 -c getvcpu
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : getvcpu
Getting pinned CPU list...
Current pinned CPU:21-24

But now after rebooting the VM with OVM 3.4.2 the CPUs are not getting pinned. This can be seen running the vcpu-list command:

[root@OVS1]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000c04cfa6f302883fa 23 0 23 -b- 8.7 16-31
0004fb0000060000c04cfa6f302883fa 23 1 28 -b- 2.0 16-31
0004fb0000060000c04cfa6f302883fa 23 2 31 -b- 1.9 16-31
0004fb0000060000c04cfa6f302883fa 23 3 21 -b- 1.6 16-31

In OVM 3.4.X I still need to login to actual physical OVS and run xm vcpu-pin which wasn’t required earlier with 3.3.X. After that the CPUs are pinned and CPU affinity shows up correctly:

[root@OVS1]# xm vcpu-pin 23 all 21-24
[root@OVS1]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000c04cfa6f302883fa 23 0 24 -b- 9.4 21-24
0004fb0000060000c04cfa6f302883fa 23 1 21 -b- 2.1 21-24
0004fb0000060000c04cfa6f302883fa 23 2 23 -b- 2.3 21-24
0004fb0000060000c04cfa6f302883fa 23 3 22 -b- 1.7 21-24

That’s it! You can also review your VM’s vm.cfg and you should see the CPU pinning in place there as well.

If you would use Oracle’s Private Cloud Appliance which is sort of pre-build Oracle VM you would have “trusted partitions” in use. Then you wouldn’t need to do this manually but all what would be required is OEM connection which Oracle can use (scary huh?)¬†and you would be set. If there would be possibility I would definitely be looking to migrate from “standard” Oracle VM to PCA. However PCA’s Oracle VM version is bit behind of current 3.4.2..

Couple Oracle’s documents also on hard partitioning which are useful and have above in more detail:

http://www.oracle.com/us/corporate/pricing/partitioning-070609.pdf
http://www.oracle.com/technetwork/server-storage/vm/ovm-hardpart-168217.pdf
Set CPU Pinning for VMs on Oracle VM 3.4.x (Doc ID 2213691.1)

5 thoughts on “Oracle VM 3.4.2 CPU pinning & licensing”

  1. Will HA feature be restricted after CPU pinning? For example, CPU 0 -7 are pinned by test-vm1 in OVM server 1 which encounter hardware failure. Could test-vm1 be able to failover to server 2 which CPU0-7 are being occupied?

        1. Yeah I was thinking it in terms of uncontrolled failure and when VM will be automatically migrated (even though it would be shutdown) to a different VM server. You wouldn’t have the CPU pinning in place if the VM would be automatically started and would need to pin it manually. So it would be a very thin line what you would need to license/wouldn’t need to.

          So since you would need to do it manually afterwards it wouldn’t really be a real HA configuration anymore? ūüôā

Leave a Reply

Your email address will not be published. Required fields are marked *