mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-04 07:27:19 +08:00
feat: Validate configured RAM (#924)
This commit is contained in:
parent
5e6f931433
commit
36af9a3483
@ -20,12 +20,18 @@ if [[ "$RAM_CHECK" != [Nn]* ]]; then
|
|||||||
AVAIL_GB=$(( RAM_AVAIL/1073741824 ))
|
AVAIL_GB=$(( RAM_AVAIL/1073741824 ))
|
||||||
|
|
||||||
if (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
if (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
||||||
error "Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
msg="Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
||||||
exit 17
|
[[ "${FS,,}" != "zfs" ]] && error "$msg" && exit 17
|
||||||
fi
|
info "$msg"
|
||||||
|
else
|
||||||
if (( (RAM_WANTED + (RAM_SPARE * 3)) > RAM_AVAIL )); then
|
if (( (RAM_WANTED + (RAM_SPARE * 3)) > RAM_AVAIL )); then
|
||||||
warn "your configured RAM_SIZE of $WANTED_GB GB is very close to the $AVAIL_GB GB of memory available, please consider a lower value."
|
msg="your configured RAM_SIZE of $WANTED_GB GB is very close to the $AVAIL_GB GB of memory available, please consider a lower value."
|
||||||
|
if [[ "${FS,,}" != "zfs" ]]; then
|
||||||
|
warn "$msg"
|
||||||
|
else
|
||||||
|
info "$msg"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
13
src/reset.sh
13
src/reset.sh
@ -132,15 +132,12 @@ SPACE_GB=$(( (SPACE + 1073741823)/1073741824 ))
|
|||||||
echo "❯ CPU: ${CPU} | RAM: $AVAIL_GB/$TOTAL_GB GB | DISK: $SPACE_GB GB (${FS}) | KERNEL: ${SYS}..."
|
echo "❯ CPU: ${CPU} | RAM: $AVAIL_GB/$TOTAL_GB GB | DISK: $SPACE_GB GB (${FS}) | KERNEL: ${SYS}..."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Check memory
|
# Check available memory
|
||||||
|
|
||||||
[[ "${FS,,}" == "zfs" ]] && RAM_CHECK="N"
|
if [[ "$RAM_CHECK" != [Nn]* ]] && (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
||||||
|
msg="Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
||||||
if [[ "$RAM_CHECK" != [Nn]* ]]; then
|
[[ "${FS,,}" != "zfs" ]] && error "$msg" && exit 17
|
||||||
if (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
info "$msg"
|
||||||
error "Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
|
||||||
exit 17
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleanup files
|
# Cleanup files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user