summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-30 16:45:02 +0200
committerroot2020-07-30 16:45:02 +0200
commit98e73218d9771f2bf1bf2202f186a1d37b76d2be (patch)
tree8a402e6790b4e6f6b3d067ef67a14f83c8f45582
parent[inc/autoclone] Restore cwdirectory (diff)
downloadmltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.tar.gz
mltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.tar.xz
mltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.zip
[dnbd3/run-virt] Use dnbd3-server-proxy-fuse for local caching
-rwxr-xr-xcore/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy7
-rwxr-xr-xcore/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy13
-rw-r--r--core/modules/dnbd3/module.build1
-rw-r--r--core/modules/dnbd3/module.conf2
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc18
5 files changed, 34 insertions, 7 deletions
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
diff --git a/core/modules/dnbd3/module.build b/core/modules/dnbd3/module.build
index 48fa7c7b..5f049e97 100644
--- a/core/modules/dnbd3/module.build
+++ b/core/modules/dnbd3/module.build
@@ -35,6 +35,7 @@ build() {
-DBUILD_FUSE_CLIENT=ON \
-DBUILD_KERNEL_MODULE=ON \
-DBUILD_SERVER=ON \
+ -DBUILD_SERVER_FUSE=ON \
-DBUILD_STRESSTEST=OFF \
"$MODULE_WORK_DIR/src/dnbd3" || perror "Could not cmake"
make dnbd3-client || perror "Could not make dnbd3-client"
diff --git a/core/modules/dnbd3/module.conf b/core/modules/dnbd3/module.conf
index 9e8bf304..a21ace25 100644
--- a/core/modules/dnbd3/module.conf
+++ b/core/modules/dnbd3/module.conf
@@ -1,6 +1,6 @@
#!/bin/bash
REQUIRED_MODULES="kernel"
-REQUIRED_GIT="https://git.openslx.org/dnbd3.git"
+REQUIRED_GIT="https://git.openslx.org/dnbd3.git||fuse_ll"
REQUIRED_BINARIES="
dnbd3-client
dnbd3-fuse
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
index 73a01800..49bb2087 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
@@ -29,6 +29,16 @@ cleanup_dnbd3() {
done
}
+setup_dnbd3_proxy () {
+ [ -d "/mnt/dnbd3/images" ] || return 1
+ writelog "Trying to access via dnbd3-server-fuse"
+ echo "${SRC_IMG_RELATIVE}:0" > "/mnt/dnbd3/control" || return 1
+ VM_DISKFILE_REVISION=0
+ VM_DISKFILE_RO="/mnt/dnbd3/images/${SRC_IMG_RELATIVE}:0"
+ writelog "Success."
+ return 0
+}
+
setup_dnbd3 () {
# Mount path for images mounted with dnbd3-fuse
declare -rg DNBD3_MOUNT_POINT="${TMPDIR}/dnbd3fuse.mnt"
@@ -127,12 +137,14 @@ setup_image_access() {
setup_image_access_default() {
# See if we should setup dnbd3 image access at all
- if ! check_dep dnbd3-fuse fusermount; then
- writelog "\tCan't use dnbd3 as dnbd3-fuse/fusermount binaries are not in PATH"
- elif ! isset SRC_IMG_RELATIVE; then
+ if ! isset SRC_IMG_RELATIVE; then
writelog "\tCan't use dnbd3 as SRC_IMG_RELATIVE is not set"
elif isempty SLX_DNBD3_SERVERS || [ "x${SLX_VM_DNBD3}" != "xyes" ]; then
writelog "\tCan't use dnbd3 as no servers are given in config, or SLX_VM_DNBD3 is not set to yes"
+ elif setup_dnbd3_proxy; then
+ writelog "\tImage setup done."
+ elif ! check_dep dnbd3-fuse fusermount; then
+ writelog "\tCan't use dnbd3 as dnbd3-fuse/fusermount binaries are not in PATH"
else
# register setup_dnbd3 as start hook after sourcing this include
writelog "Trying image access via DNBD3..."