Adjust capacity warning to 20GB

This commit is contained in:
j3s 2021-03-08 19:24:47 -06:00
parent a09c82ecfc
commit 040c36bbaf
1 changed files with 4 additions and 4 deletions

View File

@ -6,13 +6,13 @@ RAM_BYTES_TO_ALLOCATE="$1"
RAM_BYTES_AVAILABLE=$(grep -E "^(size|memory_available_bytes)" /proc/spl/kstat/zfs/arcstats | awk '{sum+=$3} END {printf "%.0f", sum}')
RAM_BYTES_REMAINDER="$((RAM_BYTES_AVAILABLE - RAM_BYTES_TO_ALLOCATE))"
if echo "$RAM_BYTES_TO_ALLOCATE" | grep -vqE "^[0-9]+$"; then
if echo "$RAM_BYTES_TO_ALLOCATE" | grep -vqE "^[0-9]+$"; then
echo "RAM_BYTES_TO_ALLOCATE \"$RAM_BYTES_TO_ALLOCATE\" must be an integer"
exit 1
fi
# I picked 10GB arbitrarily
if [ "$RAM_BYTES_REMAINDER" -le $((10 * 1024 * 1024 * 1024)) ]; then
# 20GB
if [ "$RAM_BYTES_REMAINDER" -le $((20 * 1024 * 1024 * 1024)) ]; then
echo "VM is requesting more RAM than $(hostname -f) has available."
echo "Bytes requested: $RAM_BYTES_TO_ALLOCATE"
echo "Bytes available: $RAM_BYTES_AVAILABLE"
@ -26,5 +26,5 @@ if [ "$IPV4_COUNT" -ge "$IPV4_LIMIT" ]; then
echo "IPv4 address limit reached"
exit 1
fi
echo "yes"