launch-node : cap to 8gb swap

If you're donated a really nice, big server from a friendly provider
like Vexxhost, you need to cap the amount of swap you make or you fill
up the entire root disk.

Change-Id: Ide965f7df8db84a6bbfe3294c9c5b85f0dd7367f
This commit is contained in:
Ian Wienand 2021-03-25 16:34:15 +11:00
parent 9f11fc5c75
commit 2e629bfb96
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ if [ `grep SwapTotal /proc/meminfo | awk '{ print $2; }'` -eq 0 ]; then
MEMKB=`grep MemTotal /proc/meminfo | awk '{print $2; }'`
# Use the nearest power of two in MB as the swap size.
# This ensures that the partitions below are aligned properly.
MEM=`python3 -c "import math ; print(2**int(round(math.log($MEMKB/1024, 2))))"`
MEM=`python3 -c "import math ; print(min(2**int(round(math.log($MEMKB/1024, 2))),8))"`
# Avoid using config drive device for swap
if [ -n "$DEV" ] && ! blkid | grep $DEV | grep TYPE ; then