Oracle VM Set CPU Pinning/Affinity – Part 13


Step 1: Login to Oracle VM server as root

[root@mgmtsrv ~]# ssh ovm.lab.local
root@ovm.lab.local's password:
Last login: Sun Dec 17 05:34:13 2017 from 10.10.10.1
[root@ovm ~]#

Step 2: Enable TCPS [Secure way to connect and perform the tasks]

[root@ovm ~]# cd /u01/app/oracle/ovm-manager-3/bin/
[root@ovm bin]# ./secureOvmmTcpGenKeyStore.sh
Generate OVMM TCP over SSL key store by following steps:
Enter keystore password: ## Enter the password ##
Re-enter new password: ## Re-enter the password ##
What is your first and last name?
[Unknown]: Ora Admin
What is the name of your organizational unit?
[Unknown]: LAB
What is the name of your organization?
[Unknown]: TEST
What is the name of your City or Locality?
[Unknown]: Chennai
What is the name of your State or Province?
[Unknown]: Tamil Nadu
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=Ora Admin, OU=LAB, O=TEST, L=Chennai, ST=Tamil Nadu, C=IN correct?
[no]: yes


Enter key password for
(RETURN if same as keystore password): ## Enter above given password ##
Re-enter new password: ## Re-enter above given password ##

[root@ovm bin]# ./secureOvmmTcp.sh
Enabling OVMM TCP over SSL service

Please enter the Oracle VM manager user name: admin

Please enter the Oracle VM manager user password: ## Enter Oracle VM Manager admin password ##

Please enter the password for TCPS key store : ## Enter above created key store password ##

The job of enabling OVMM TCPS service is committed, please restart OVMM to take effect.

Restart the OVMM daemon

[root@ovm bin]# /etc/init.d/ovmm restart
Stopping Oracle VM Manager [ OK ]
Starting Oracle VM Manager [ OK ]

Below netstat output show that TCPS port is listening in Oracle VM Manager.

[root@ovm ~]# netstat -antulp | grep 54322
tcp 0 0 :::54322 :::* LISTEN 9042/java

Step 3: Install the Oralce VM Utils

[root@ovm ~]# mkdir OVMM

Download the below zip file from Oracle Support site.

[root@ovm ~]# unzip -d OVMM p13602094_30_Linux-x86-64.zip
Archive: p13602094_30_Linux-x86-64.zip
inflating: OVMM/README.html
extracting: OVMM/ovm_util_3.4.99.10182.zip

[root@ovm ~]# cd OVMM/
[root@ovm OVMM]# ls
ovm_util_3.4.99.10182.zip README.html
[root@ovm OVMM]# unzip ovm_util_3.4.99.10182.zip
Archive: ovm_util_3.4.99.10182.zip
creating: ovm_util/
extracting: ovm_util/ovm-utils_2.1.zip
extracting: ovm_util/ovm_utils_2.0.1.zip
extracting: ovm_util/ovm-utils_1.0.2.zip
inflating: ovm_util/readme-2.0.1
inflating: ovm_util/readme-2.1.0
inflating: ovm_util/readme-1.0.2
[root@ovm OVMM]# cd ovm_util
[root@ovm ovm_util]# ls
ovm-utils_1.0.2.zip ovm-utils_2.1.zip readme-2.0.1
ovm_utils_2.0.1.zip readme-1.0.2 readme-2.1.0

Please use the readme file for the Oracle VM Manager version supported files. Here I’m using 3.3.3, so ovm_utils_2.0.1.zip file need to be used.

[root@ovm ovm_util]# less readme-2.0.1

[root@ovm ovm_util]# unzip -d /u01/app/oracle/ovm-manager-3 ovm_utils_2.0.1.zip Archive: ovm_utils_2.0.1.zip
creating: /u01/app/oracle/ovm-manager-3/ovm_utils/
creating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/
creating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/ovm_vmcontrol.8
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/ovm_vmhostd.8
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/ovm_vmdisks.8
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/ovm_reporestore.8
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/man/man8/ovm_vmmessage.8
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/ovm_vmdisks
creating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmMessage.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmRepoRestore.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmHostd.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmMessage$1.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmHostd$1.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmControl.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmHostd$InsecureTrustManager.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmDisks.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/class/OvmVmMessage$InsecureTrustManager.class
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/ovm_vmcontrol
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/ovm_vmhostd
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/vm-dump-metrics
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/ovm_reporestore
creating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/jython.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/log4j.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/OvmClient.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/OvmWsClient.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/ovm_shell.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/commons-logging-1.1.3.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/jline.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/lib/commons-logging.jar
inflating: /u01/app/oracle/ovm-manager-3/ovm_utils/ovm_vmmessage

[root@ovm ovm_util]# cd /u01/app/oracle/ovm-manager-3/ovm_utils


[root@ovm ovm_utils]# ls
class man ovm_vmcontrol ovm_vmhostd vm-dump-metrics
lib ovm_reporestore ovm_vmdisks ovm_vmmessage

Step 4: Verify the Oracle VM Server CPU topology and cpu list

Below command explains that Oracle VM Server has 2 Processors and 2 Cores per Processor, which means total 4 vcpu’s.

[root@ovs01 ~]# xenpm get-cpu-topology
CPU core socket node
CPU0 0 0 0
CPU1 1 0 0
CPU2 0 1 0
CPU3 1 1 0

Next I want to check which VM’s are using which CPUs. I have only one VM (0004fb0000060000524f9d3e43fd71f3) names as FirstVM which uses 2 vcpu threads. See CPU column (2,3).

[root@ovs01 ~]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000524f9d3e43fd71f3 2 0 2 -b- 390.9 any cpu
0004fb0000060000524f9d3e43fd71f3 2 1 3 -b- 29.2 any cpu
Domain-0 0 0 1 -b- 237.7 any cpu
Domain-0 0 1 0 r-- 278.1 any cpu
Domain-0 0 2 3 -b- 152.5 any cpu
Domain-0 0 3 2 -b- 241.0 any cpu

Step 5: Check whether CPU’s are pinned for the new VM.

[root@ovm ovm_utils]# ./ovm_vmcontrol -u admin -p ************ -h ovm.lab.local -v FirstVM -c vcpuget
Oracle VM VM Control utility 2.0.1.
Connecting with a secure connection.
Connected.
Command : vcpuget
No vcpu's pinned for this Virtual Machine
.

Above output shows that CPU’s are not pinned for the VM.

Step 6: Pin both CPUs to core 0 and 1.

It is recommend to reboot the VMs after CPU pinning to get the changes effective.

[root@ovm ovm_utils]# ./ovm_vmcontrol -u admin -p ************ -h ovm.lab.local -v FirstVM -c vcpuset -s 0,1
Oracle VM VM Control utility 2.0.1.
Connecting with a secure connection.
Connected.
Command : vcpuset
Pinning virtual CPUs
Pinning of virtual CPUs to physical threads '0,1' 'FirstVM' completed.

[root@ovm ovm_utils]# ./ovm_vmcontrol -u admin -p ************ -h ovm.lab.local -v FirstVM -c vcpuget
Oracle VM VM Control utility 2.0.1.
Connecting with a secure connection.
Connected.
Command : vcpuget
Current pinning of virtual CPUs to physical threads : 0,1

Step 7: Confirm the CPU pinning by access and run the below command in the Oracle VM Server.

[root@ovs01 ~]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000524f9d3e43fd71f3 2 0 0 -b- 401.6 0-1
0004fb0000060000524f9d3e43fd71f3 2 1 1 -b- 29.4 0-1
Domain-0 0 0 3 -b- 240.0 any cpu
Domain-0 0 1 3 r-- 282.2 any cpu
Domain-0 0 2 2 -b- 154.2 any cpu
Domain-0 0 3 0 -b- 244.2 any cpu

Step 8: Alternate method to set CPUs from Oracle VM server

[root@ovs01 ~]# xm vcpu-pin 2 all 2-3


[root@ovs01 ~]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000524f9d3e43fd71f3 2 0 3 -b- 409.8 2-3
0004fb0000060000524f9d3e43fd71f3 2 1 3 -b- 29.5 2-3
Domain-0 0 0 0 -b- 242.3 any cpu
Domain-0 0 1 2 -b- 285.7 any cpu
Domain-0 0 2 1 r-- 155.6 any cpu
Domain-0 0 3 0 -b- 247.2 any cpu