summaryrefslogtreecommitdiffstats
path: root/core/modules/dnbd3-proxy-mode
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-18 17:18:51 +0200
committerSimon Rettberg2018-07-18 17:18:51 +0200
commit2fd55af0b5e3583e8cfc048441b5a09afd308fab (patch)
tree89feaffa247904c405bb84efa03a52c1b3fc8fed /core/modules/dnbd3-proxy-mode
parent[rfs-*] Use SMBIOS UUID as UID for DHCP requests (diff)
downloadmltk-2fd55af0b5e3583e8cfc048441b5a09afd308fab.tar.gz
mltk-2fd55af0b5e3583e8cfc048441b5a09afd308fab.tar.xz
mltk-2fd55af0b5e3583e8cfc048441b5a09afd308fab.zip
[dnbd3-proxy] Scale maxReplicationSize according to cache partition
Diffstat (limited to 'core/modules/dnbd3-proxy-mode')
-rwxr-xr-xcore/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy
index ff889fde..c9a4997c 100755
--- a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy
+++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy
@@ -87,7 +87,7 @@ if [ -n "${SLX_DNBD3_SPARSE}" ]; then
DNBD3_SPARSE="true"
fi
# Determine if we need sparse mode, or override BGR
-cache_size=$(disksize "$DNBD3_DATA_DIR")
+cache_size=$(disksize "$DNBD3_DATA_DIR") # MB
if ! [ "$cache_size" -gt 120000 ]; then
# less than 120GiB or NaN, force
[ "$DNBD3_BGR" = "true" ] && slxlog -s -e "dnbd3-setup-small" "Cache partition < 120GiB, forcing background replication OFF and sparse mode ON"
@@ -100,6 +100,9 @@ elif [ "$cache_size" -gt 2000000 ]; then
DNBD3_SPARSE="false"
fi
+MAX_REPLICATION_SIZE=$(( cache_size / 6 ))
+[ "$MAX_REPLICATION_SIZE" -lt 100000 ] && MAX_REPLICATION_SIZE=100000
+
DNBD3_PORT=5003
rm -f "${DNBD3_CONF_DIR}/server.conf"
# Refer to http://git.openslx.org/dnbd3.git/tree/conf for configuration options
@@ -117,6 +120,9 @@ removeMissingImages=false
uplinkTimeout=5000
clientTimeout=15000
+[limits]
+maxReplicationSize=${MAX_REPLICATION_SIZE}M
+
[logging]
consoleMask=ERROR WARNING MINOR INFO
EOF