You are here

CPU Pinning and the vm.cfg File

In this section, we show how to view the CPU pinning in a virtual machine's vm.cfg file. Each virtual machine has a vm.cfg file which controls the virual machine's resource allocations. vm.cfg files are managed by Oracle VM Manager, editing vm.cfg files by hand is not recomended and will cause unexpected results.
 
Before you can view a virtual machine's vm.cfg file, you must locate it.
 
To list all of the virtual machines vm.cfg files in an Oracle VM server pool, as root, access one of the Oracle VM pool members and type:
# find /OVS/Repositories -type f -name vm.cfg -exec grep -iH simple_name {} \;
 
To list a specific virtual machine's vm.cfg file, as root, access one of the Oracle VM pool members and type:
# find /OVS/Repositories -type f -name vm.cfg -exec grep -iH simple_name {} \; | grep <VIRTUAL MACHINE NAME>
 
Note: Replace <VIRTUAL MACHINE NAME> with the virtual machines name.
 
Once the vm.cfg file has been located, it can be viewed using Vim (vi). Vim is the default text editor for Oracle VM Server.
 
Let’s locate and view a virtual machine's default “unpinned” vm.cfg file. The virtual machine's vm.cfg file can be located by accessing one of the Oracle VM servers in the pool, and as root, type:
find /OVS/Repositories -type f -name vm.cfg -exec grep -iH simple_name {} \; | grep yum-chekov
/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualMachines/0004fb0000060000dbf90ab3718822c0/vm.cfg:OVM_simple_name = 'yum-chekov'
 
Note: Substitute yum-chekov with the name of your virtual machine.
Please note the maxvcpus = 2 and the vcpus = 2 entries.
 
# vi /OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualMachines/0004fb0000060000dbf90ab3718822c0/vm.cfg
vif = ['mac=00:21:f6:00:00:52,bridge=0004fb001025f15', 'mac=00:21:f6:00:00:69,bridge=192.168.3.0']
OVM_simple_name = 'yum-chekov'
disk = ['file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb00001200001715425de783bb2a.img,xvda,w', 'file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb0000120000b400de1a5c40d6dc.img,xvdb,w', 'file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb00001200005266f7966823c7c8.img,xvdc,w']
uuid = '0004fb00-0006-0000-dbf9-0ab3718822c0'
on_reboot = 'restart'
boot = 'c'
cpu_weight = 27500
memory = 1024
cpu_cap = 0
maxvcpus = 2
OVM_high_availability = True
maxmem = 1024
timer_mode = 0
OVM_description = ''
on_poweroff = 'destroy'
on_crash = 'restart'
bootloader = '/usr/bin/pygrub'
name = '0004fb0000060000dbf90ab3718822c0'
guest_os_type = 'linux'
vfb = ['type=vnc,vncunused=1,vnclisten=127.0.0.1,keymap=en-us']
vcpus = 2
OVM_os_type = 'Oracle Linux 5'
OVM_cpu_compat_group = None
OVM_domain_type = 'xen_pvm'
:q!
 
The maxvcpus = 2 entry defines the maximum CPU count for the virtual machine. In this example, maxvcpus = 2 means that the virtual machine can have up to two CPUs (CPUs actually mean CPU cores or threads). The vcpus = 2 entry defines the initially allocated number of CPUs. If the virtual machine has maxvcpus = 2 with vcpus = 1, 1 additional CPU could be allocated using Oracle VM Manager up to the maxvcpus = 2 vaule. 
 
Listing the above virtual machine CPU pinning with ovm_vmcontrol would show that the virtual machine is not pinned. The next example shows the output from ovm_vmcontrol on an unpinned virtual machine.
 
./ovm_vmcontrol -u admin -p password -h localhost -v yum-chekov -c vcpuget
Oracle VM VM Control utility 0.5.2.
Connected.
Command : vcpuget
Virtual Machine 'yum-sulu' has no pinned vcpus.
 
The next vm.cfg example shows a new line in the vm.cfg file, cpus = '1,2'. The cpus = '1,2' entry shows that the virtual machine’s CPUs are pinned to the Oracle VM server’s CPU cores 1 and 2. The following example vm.cfg CPU pinning was set by typing the following command:
 
# ./ovm_vmcontrol -u admin -p password -h localhost -v yum-chekov -c vcpuset -s 1,2
Oracle VM VM Control utility 0.5.2.
Connected.
Command : vcpuset
Pinning virtual CPUs
Pinning of virtual CPUs to physical threads  '1,2' 'yum-chekov' completed.
 
Please note the vcpus = 2 entry, one line above the cpus = '1,2' entry. The vcpus = 2 entry defines the allocated number of CPUs. 
 
# vi /OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualMachines/0004fb0000060000dbf90ab3718822c0/vm.cfg
vif = ['mac=00:21:f6:00:00:52,bridge=0004fb001025f15', 'mac=00:21:f6:00:00:69,bridge=192.168.3.0']
OVM_simple_name = 'yum-chekov'
disk = ['file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb00001200001715425de783bb2a.img,xvda,w', 'file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb0000120000b400de1a5c40d6dc.img,xvdb,w', 'file:/OVS/Repositories/0004fb000003000000c6307a0210108c/VirtualDisks/0004fb00001200005266f7966823c7c8.img,xvdc,w']
uuid = '0004fb00-0006-0000-dbf9-0ab3718822c0'
on_reboot = 'restart'
boot = 'c'
cpu_weight = 27500
memory = 1024
cpu_cap = 0
maxvcpus = 2
OVM_high_availability = True
maxmem = 1024
timer_mode = 0
OVM_description = ''
on_poweroff = 'destroy'
on_crash = 'restart'
bootloader = '/usr/bin/pygrub'
name = '0004fb0000060000dbf90ab3718822c0'
guest_os_type = 'linux'
vfb = ['type=vnc,vncunused=1,vnclisten=127.0.0.1,keymap=en-us']
vcpus = 2
cpus = '1,2'
OVM_os_type = 'Oracle Linux 5'
OVM_cpu_compat_group = None
OVM_domain_type = 'xen_pvm'
:wq!
 
The above example vm.cfg file shows a hard partitioned virtual machine with two CPUs using 1 Oracle processor license. The virtual machine’s CPUs are pinned to the Oracle VM Server’s CPU cores 1 and 2.

Download PDF Now!