Enabling and disabling RAM overcommitment
RAM overcommitment for virtual machines is only available if all of the compute nodes have enough swap space.
Prerequisites
- A swap file is created, as described in Adding swap space.
To enable RAM overcommitment for virtual machines
Use the command vinfra service compute create
or vinfra service compute set
with the --custom-param
or --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 disable RAM overcommitment for virtual machines
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:
# /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.