Add file-backed swap to prevent OOM

Without any swap space enabled, it's possible some intensive operation
can chew up all the memory on the test VM.  Enabling swap space will
prevent this for minor cases, but could lead to disk-thrashing if the
memory demand is excessive.

Since the test system never reboots, using a file-backed swap should
suffice. Though not ideal, it's easy to setup and doesn't require any
interactions with the cloud that owns the VM or the job that created it.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich 2017-08-29 15:53:10 -04:00
parent 173d56cc67
commit f65d548ac2

View file

@ -76,6 +76,13 @@
async: 600
poll: 10
when: ansible_distribution == 'Fedora'
- name: Setup swap to prevent kernel firing off the OOM killer
shell: |
truncate -s 8G /root/swap && \
export SWAPDEV=$(losetup --show -f /root/swap | head -1) && \
mkswap $SWAPDEV && \
swapon $SWAPDEV && \
swapon --show
- name: Make testing directories to conform to testing standards
file:
path: "{{ item }}"