Enabling and disabling RAM overcommitment

RAM overcommitment for virtual machines is only available if all of the compute nodes have enough swap space.

You can enable RAM overcommitment when creating the compute cluster or afterwards by using either the --custom-param or --nova-compute-ram-allocation-ratio option (refer to vinfra service compute create or Changing compute cluster parameters). 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 disable RAM overcommitment for virtual machines, change the ratio to 1:

# 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. Execute the following:

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

Run this script on each node in the compute cluster to remove the swap file from all of the compute nodes.