Fix min swap value in make_swap.sh

We just discovered that a number of new servers have rather small swap
sizes. It appears this snuck in via change 782898 which tries to bound
the max swap size to 8GB. Unfortunately the input to parted expects MB
so we make a swap size of 8MB instead of 8GB.

Bump the min value to 8192 to fix this.

Change-Id: I76b5b7dd8ac76c2ecbab9064bcdf956394b3a770
This commit is contained in:
Clark Boylan 2021-05-14 14:09:11 -07:00
parent d4176aff5b
commit 5e43926b5e

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