Enabling and disabling RAM overcommitment

RAM overcommitment for virtual machines is only available if a compute node has enough swap space. If you want to enable RAM overcommitment for the entire compute cluster, ensure that enough swap space exists on all of the compute nodes.

Prerequisites

To enable RAM overcommitment per cluster

Use the command vinfra service compute set with the --nova-compute-ram-allocation-ratio option. For example, to set the RAM overcommitment ratio to 1.5, run:

# vinfra service compute set --nova-compute-ram-allocation-ratio 1.5

To check that the ratio is successfully modified, execute the vinfra service compute show command:

# vinfra service compute show
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| <...>        | <...>                                     |
| options      | cpu_model: ''                             |
|              | custom_params:                            |
|              | - config_file: nova.conf                  |
|              |   property: ram_allocation_ratio          |
|              |   section: DEFAULT                        |
|              |   service_name: nova-compute              |
|              |   value: 1.5                              |
| <...>        | <...>                                     |
+--------------+-------------------------------------------+

To enable RAM overcommitment per node

Use the command vinfra service compute set with the --nova-compute-ram-allocation-ratio option and specify particular nodes with the --nodes option. For example, to set the RAM overcommitment ratio to 1.5 on the node node001, run:

# vinfra service compute set --nova-compute-ram-allocation-ratio 1.5 --nodes node001

To check that the ratio is successfully modified, execute the vinfra service compute node show command:

# vinfra service compute node show node001
+----------------+------------------------------------------+
| Field          | Value                                    |
+----------------+------------------------------------------+
| custom_params  | - config_file: nova.conf                 |
|                |   property: ram_allocation_ratio         |
|                |   section: DEFAULT                       |
|                |   service_name: nova-compute             |
|                |   value: 1.5                             |
| fenced_reason  |                                          |
| host           | node001.vstoragedomain                   |
| <...>          | <...>                                    |
+----------------+------------------------------------------+

To disable RAM overcommitment per cluster

Change the ratio to 1 by running:

# vinfra service compute set --nova-compute-ram-allocation-ratio 1

In this case, the swap space is not required anymore and the swap file can be removed. Run this script on each node in the compute cluster to remove the swap file from all of the compute nodes:

# /usr/libexec/vstorage-ui-agent/bin/configure-swap.sh --remove-all

To disable RAM overcommitment per node

Change the node overcommitment ratio to the default cluster value by setting it to 0:

# vinfra service compute set --nova-compute-ram-allocation-ratio 0 --node node001

In this case, the swap space is not required anymore and the swap file can be removed. Run this script on the required node to remove the swap file from it:

# /usr/libexec/vstorage-ui-agent/bin/configure-swap.sh --remove-all