Site icon UnixArena

How to Dynamically add the resources in Oracle VM for SPARC ?

The beauty of LDOM or Oracle VM for SPARC is that resources can be dynamically added or removed from the domains(Primary/Guest). This will help you to perform the load balancing between the guest domains on the physical server. Dynamic resource allocation is only possible if the guest domain operating system is booted.If you add the resource during the guest domain OS start-up, allocation will fail. 

Note:Solaris operating system support dynamic resources allocation.
Oracle VM for SPARC Tutorial:
[checklist]

[/checklist]

Here we will see how to add/remove resources dynamically when the guest domain is up and running.Before performing any resource management, please make sure you have enough resources on the system .(use “# ldm list-devices -a” to find free resources)

1.List the running domains from the control domain aka primary domain.

bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.2%  7h 48m
ldom2            active     -n----  5000    4     4G       0.1%  9h 28m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 7m

As per the above output,all the domains are in active state.Which means domains are in powered.(Login to the ldoms and verify OS is up or not .)

2.Add four more virtual CPU’s to ldom2 guest domain.

-bash-3.2# ldm add-vcpu 4 ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.3%  7h 48m
ldom2            active     -n----  5000    8     4G       0.3%  9h 28m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 7m

You can see number of vcpu has been increased from 4 to 8 for ldom2.

3.Number CPU’s can added by directly setting the new value.For an example, Currently ldom2 has just 8 vcpu .If you want to add four more, you just give the below command.

-bash-3.2# ldm set-vcpu 12 ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.3%  7h 49m
ldom2            active     -n----  5000    12    4G       0.1%  9h 29m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 8m

4.CPU also can be removed using set command. Currently ldom2 has 12 vcpu’s. If you want to remove 8 from that, just give the below command.

-bash-3.2# ldm set-vcpu 4 ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.4%  7h 49m
ldom2            active     -n----  5000    4     4G       3.4%  9h 29m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 8m
-bash-3.2#

5.Removing vcpu also can be done using remove-vpcu command.

-bash-3.2# ldm remove-vcpu 2 ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.2%  7h 52m
ldom2            active     -n----  5000    2     6G       0.2%  9h 32m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 11m
-bash-3.2#

6. Dynamic memory management also same like the cpu management. You need to use  “memory” keyword instead of “vcpu”. To set the new memory size to the running domain,use the below commands.If the new value size is higher than the current one ,memory will be added .If the new value is lesser than the existing one, memory size will be reduced to the guest domains.

-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.2%  7h 51m
ldom2            active     -n----  5000    4     4G       0.1%  9h 30m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 10m
-bash-3.2# ldm set-memory 8G ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.2%  7h 51m
ldom2            active     -n----  5000    4     8G       0.2%  9h 31m
ldom2clone       active     -n----  5001    8     8G       0.1%  7h 10m

7.We can also use the below method to increase the physical memory of guest domains.

-bash-3.2# ldm add-memory 2G ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.3%  7h 51m
ldom2            active     -n----  5000    4     10G      0.1%  9h 31m
ldom2clone       active     -n----  5001    8     8G       0.2%  7h 10m

8. Like remove option in vcpu, remove-memory option is used to reduce the memory size to the guest domain.

-bash-3.2# ldm remove-memory 4G ldom2
-bash-3.2# ldm ls-domain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
primary          active     -n-cv-  SP      14    4128M    0.4%  7h 52m
ldom2            active     -n----  5000    4     6G       0.5%  9h 32m
ldom2clone       active     -n----  5001    8     8G       0.2%  7h 11m
-bash-3.2#

Other resources like virtual disk also can be added on fly to the virtual machine.Here I am creating a ZFS level LUN for test purpose.

-bash-3.2# zfs create -V 25G pool1/uavol1
-bash-3.2# zfs list
NAME               USED  AVAIL  REFER  MOUNTPOINT
pool1             25.4G   248G    31K  /pool1
pool1/clonevol1   96.3M   248G  4.75G  -
pool1/uavol1      25.3G   248G  4.70G  -
pool1/vol1        25.3G   269G  4.70G  -

Adding the disk to virtual disk service. (vds0)

-bash-3.2# ldm add-vdiskserverdevice /dev/zvol/dsk/pool1/uavol1 uavol1@primary-vds0

Assigning the LUN to guest domain from the virtual disk service.

-bash-3.2# ldm add-vdisk uavdisk uavol1@primary-vds0 ldom2

Connect to the server and scan the newly assiged LUN.

-bash-3.2# ldm ls-domain
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME
primary active -n-cv- SP 14 4128M 0.2% 8h
ldom2 active -n---- 5000 2 6G 0.2% 9h 40m
ldom2clone active -n---- 5001 8 8G 0.1% 7h 19m
-bash-3.2# telnet 192.168.2.28 5000
Trying 192.168.2.28...
Connected to 192.168.2.28.
Escape character is '^]'.

Connecting to console "ldom2" in group "ldom2" ....
Press ~? for control options ..

ldom2-208 console login: root
Password:
# devfsadm
# echo |format

To terminate the ldom console, use “ctrl” + “]” key sequence to back to the control domain.
You can also see the lun from the guest domain “OK” prompt. Let me halt the domain and start it.

-bash-3.2# ldm stop-domain ldom2
LDom ldom2 stopped
-bash-3.2# ldm start-domain ldom2
LDom ldom2 started

Connect to the guest domain console again.

-bash-3.2# telnet 192.168.2.28 5000
Trying 192.168.2.28...
Connected to 192.168.2.28.
Escape character is '^]'.

Connecting to console "ldom2" in group "ldom2" ....
Press ~? for control options ..

{0} ok devalias
uavdisk                  /virtual-devices@100/channel-devices@200/disk@0
iso_ldom2                /virtual-devices@100/channel-devices@200/disk@2
vdisk1_dom2              /virtual-devices@100/channel-devices@200/disk@1
vnet0                    /virtual-devices@100/channel-devices@200/network@0
net                      /virtual-devices@100/channel-devices@200/network@0
disk                     /virtual-devices@100/channel-devices@200/disk@1
virtual-console          /virtual-devices/console@1
name                     aliases

You can see the newly assigned disk in the OBP level as well.So the bottom line is that resource management is very simple and effective  in LDOM aka oracle VM for SPARC.

Hope you too liked the Oracle VM for SPARC resource management. Thank you for visiting UnixArena.

Exit mobile version