Solaris LDOM Cheat Sheet

Editing Solaris LDOM Virtualization Cheat Sheet


Simple ldom commands

To Show all network devices including virtual switches:

# dladm show-link

To list all domains on a physical machine (short form):

$ ldm list

And switch p is provided to produce parsable output for easier script writing:

 $ ldm list -p

If you need detailed info for the domains (long form):

$ ldm list -l

You can filter it for a particular ldom:

$ ldm list -l dwdb4 

To activate a virtual machine simply use:

$ ldm start dwdb4       # if it returns an error indicating the LDOM is not bound use ldm bind dwdb4 first and then try to start it again.

Then we have to boot the virtual machine. Go to System Console (OK prompt) by telneting to the VM Console port (usually starts at 5000)

$ telnet localhost 5002

Now you are in OK prompt and simply type boot to boot the machine.

ok boot


For more info consult Oracle® VM Server for SPARC 3.2 Administration Guide at https://docs.oracle.com/cd/E48724_01/html/E48732/index.html.

Disks for VMs

To find the disks associated to a particular VM on the hypervisor run

# ldm ls -o disk dwdb4_cl

Changing the number of vcpus

To assign a particular number of vcpu to a domain (virtual machine):

$ ldm set-vcpu 4 dwdb4      # it assigns 4 virtual CPU to a domain/machine called dwdb4

Or you can simply add a particular number of vcpu to a domain (virtual machine):

$ ldm add-vcpu 2 dwdb4      # it adds 2 virtual CPU to a domain/machine called dwdb4

Calculating CPU utilization for each vcpu

You can use p switch again for parsable output:

$ ldm list -p -l dwdb4 

And if you want to find out the utilization of each vcpu:

$ ldm list -p -l dwdb4 | grep strand

Now we are ready to pull out the exact numbers using awk and sed:

$ ldm list -p -l dwdb4|grep strand|awk -F'|' '{print $4}'|sed 's/util=//; s/%//'


Dynamic changing the number of vcpus

Solaris provides a policy-based resource manager that automatically adds or removes CPUs from a running domain based on its utilization and relative priority.

Policies can be prioritized to ensure that important domains obtain preferential access to resources. They can also be enabled or disabled manually or based on time of day for different prime shift and off-hours policies.

Policy rules specify the number of CPUs that a domain has, bounded by min and max values and based on their utilization.

The following policy controls the number of CPUs for domain dwdb4, is named high-usage, and is in effect between 9:00 and 18:00. The lower and upper CPU utilization settings are 25% and 75% CPU busy, respectively. The number of CPUs is adjusted between 2 and 16: One CPU is added or removed at a time (the attack and decay values). For example, if the CPU utilization exceeds 75%, a CPU is added unless dwdb4 already has 16 CPUs.

$ ldm add-policy tod-begin=09:00 tod-end=18:00 util-lower=25 util-upper=75 vcpu-min=2 vcpu-max=16 attack=1 decay=1 priority=1 name=high-usage dwdb4
  • The number of CPUs is adjusted between vcpu-min and vcpu-max based on util-upper and util-lower CPU busy percentages.
  • If CPU utilization exceeds the value of util-upper, virtual CPUs are added to the domain until the number is between vcpu-min and vcpu-max.
  • If the utilization drops below util-lower, virtual CPUs are removed from the domain until the number is between vcpu-min and vcpu-max.
  • If vcpu-min is reached, no more virtual CPUs can be dynamically removed. If vcpu-max is reached, no more virtual CPUs can be dynamically added. Manual changes to the number of CPUs can still be made.
  • Multiple policies can be in effect, and are optionally controlled by tod-begin and tod-end (time of day) values.