diff options
author | Simon Rettberg | 2020-07-30 16:45:02 +0200 |
---|---|---|
committer | root | 2020-07-30 16:45:02 +0200 |
commit | 98e73218d9771f2bf1bf2202f186a1d37b76d2be (patch) | |
tree | 8a402e6790b4e6f6b3d067ef67a14f83c8f45582 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes | |
parent | [inc/autoclone] Restore cwdirectory (diff) | |
download | mltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.tar.gz mltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.tar.xz mltk-98e73218d9771f2bf1bf2202f186a1d37b76d2be.zip |
[dnbd3/run-virt] Use dnbd3-server-proxy-fuse for local caching
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc | 18 |
1 files changed, 15 insertions, 3 deletions
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..." |