From 98e73218d9771f2bf1bf2202f186a1d37b76d2be Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 30 Jul 2020 16:45:02 +0200 Subject: [dnbd3/run-virt] Use dnbd3-server-proxy-fuse for local caching --- .../data/opt/openslx/scripts/systemd-dnbd3_proxy | 7 ++++++- .../data/opt/openslx/scripts/systemd-setup_dnbd3_proxy | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'core/modules/dnbd3-proxy-mode') diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy index 751e327c..9b645796 100755 --- a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy +++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy @@ -8,7 +8,12 @@ if [ -s "$ERRLOG" ]; then exec $(which dnbd3-server) -n --errormsg "$(cat "$ERRLOG")" -c /etc/dnbd3-server fi -exec $(which dnbd3-server) -n -c /etc/dnbd3-server +if [ -d "/mnt/dnbd3" ]; then + set -- -m /mnt/dnbd3 +else + set -- +fi +exec $(which dnbd3-server) -n -c /etc/dnbd3-server "$@" exit 1 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 11a0e31a..e5652758 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 @@ -139,6 +139,7 @@ if [ -n "$islocal" ]; then fi DNBD3_LOOKUP="false" DNBD3_SERVER_PENALTY="500000" + DNBD3_BGR_MIN_CLIENTS=1 MAX_REPLICATION_SIZE=500 # Use DNBD3 servers from openslx config and then patch it to say localhost @@ -151,6 +152,7 @@ else DNBD3_SPARSE="false" DNBD3_PRETEND_CLIENT="false" DNBD3_BGR="false" + DNBD3_BGR_MIN_CLIENTS=0 DNBD3_LOOKUP="false" DNBD3_AUTOFREE="18h" DNBD3_SERVER_PENALTY=2000 # no BGR = don't like other servers connecting so much @@ -234,6 +236,7 @@ serverPenalty=${DNBD3_SERVER_PENALTY} clientPenalty=0 isProxy=true backgroundReplication=${DNBD3_BGR} +bgrMinClients=${DNBD3_BGR_MIN_CLIENTS} lookupMissingForProxy=${DNBD3_LOOKUP} sparseFiles=${DNBD3_SPARSE} removeMissingImages=false @@ -256,10 +259,16 @@ chmod -R a+Xr "${DNBD3_CONF_DIR}" # create rpc.acl to allow the satellite only rm -f "${DNBD3_CONF_DIR}/rpc.acl" for SRV in ${SLX_KCL_SERVERS}; do - echo "$SRV ALL" >> "${DNBD3_CONF_DIR}/rpc.acl" -done + echo "$SRV ALL" +done >> "${DNBD3_CONF_DIR}/rpc.acl" +# And self +echo "127.0.0.1 STATS IMAGE_LIST" >> "${DNBD3_CONF_DIR}/rpc.acl" if [ -n "$islocal" ]; then + # Prepare, so dnbd3-server will be launched with -m + mkdir -p /mnt/dnbd3 + chown dnbd3:dnbd3 /mnt/dnbd3 + adduser dnbd3 fuse # Start service, is not symlinked when not in proxy mode systemctl --no-block start dnbd3-proxy.service fi -- cgit v1.2.3-55-g7522