How to configure swap for overcloud nodes
Environment
- Red Hat OpenStack Platform 13
Issue
- How can we configure swap for all overcloud nodes?
Resolution
-
There are two options available
-
To have independent partition for swap
- Recreate flavours for overcloud roles with adding swap amount, before you run before deploying overcloud
$ source ~/stackrc
$ openstack flavor delete control
$ openstack flavor create --ram 4096 --vcpus 1 --disk 40 --swap 10 \
--property resources:CUSTOM_BAREMETAL=1 --property resources:DISK_GB=0 \
--property resources:MEMORY_MB=0 --property resources:VCPU=0 --property capabilities:boot_option=local \
--property capabilities:profile=control control
- Specify the template file to enable swap in
openstack overcloud deploy
$ openstack overcloud deploy --templates \
...
-e /usr/share/openstack-tripleo-heat-templates/environments/enable-swap-partition.yaml
- To have "/swap" file on root file system and use it as loopback swap device
- Include the following tememplate in
openstack overcloud deploy
- Include the following tememplate in
$ openstack overcloud deploy --templates \
...
-e /usr/share/openstack-tripleo-heat-templates/environments/enable-swap.yaml
swap_size_megabytesshould be set in the templates to have expected size of swap
swap_size_megabytes:
type: string
description: Amount of swap space to allocate in megabytes
default: '4096'
Root Cause
- Ironic creates a swap partition with the label "swap1" when it launch a baremetal instance with the flavour which has swap amount configured
Diagnostic Steps
WARNING When creating a swap partition on a compute node, it's possible that operations that maps a large amount of memory hitting the swap can kill the I/O of the block device. For example, when spawning an SR-IOV instance, qemu will map all the RAM assigned to the instance. If most of this RAM would hit the swap, it might cause a system lock up on the compute node. See this This content is not included.bugzilla for more information.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.