mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-02 16:04:52 +08:00
feat: Implement extra disksize preset (#1074)
This commit is contained in:
parent
75daa31d36
commit
ea0d7ee6cd
13
src/disk.sh
13
src/disk.sh
@ -432,11 +432,18 @@ addDisk () {
|
|||||||
DIR=$(dirname "$DISK_FILE")
|
DIR=$(dirname "$DISK_FILE")
|
||||||
[ ! -d "$DIR" ] && return 0
|
[ ! -d "$DIR" ] && return 0
|
||||||
|
|
||||||
if [[ "${DISK_SPACE,,}" == "max" ]]; then
|
if [[ "${DISK_SPACE,,}" == "max" || "${DISK_SPACE,,}" == "half" ]]; then
|
||||||
|
|
||||||
local SPARE=536870912
|
local SPARE=2147483648
|
||||||
SPACE=$(df --output=avail -B 1 "$DIR" | tail -n 1)
|
SPACE=$(df --output=avail -B 1 "$DIR" | tail -n 1)
|
||||||
(( SPACE < SPARE )) && SPACE="$SPARE" || SPACE=$((SPACE-SPARE))
|
|
||||||
|
if [[ "${DISK_SPACE,,}" == "max" ]]; then
|
||||||
|
SPACE=$((SPACE-SPARE))
|
||||||
|
else
|
||||||
|
SPACE=$(( SPACE / 2 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
(( SPACE < SPARE )) && SPACE="$SPARE"
|
||||||
GB=$(( SPACE/1073741825 ))
|
GB=$(( SPACE/1073741825 ))
|
||||||
DISK_SPACE="${GB}G"
|
DISK_SPACE="${GB}G"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user