diff options
author | Sebastian | 2016-04-25 12:01:08 +0200 |
---|---|---|
committer | Sebastian | 2016-04-25 12:01:08 +0200 |
commit | 5acda3eaeabae9045609539303a8c12c4ce401f1 (patch) | |
tree | 7e71975f8570b05aafe2ea6ec0e242a8912387bb /core/modules/dnbd3 | |
parent | initial commit (diff) | |
download | mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.gz mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.xz mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.zip |
merge with latest dev version
Diffstat (limited to 'core/modules/dnbd3')
-rw-r--r-- | core/modules/dnbd3/TODO | 1 | ||||
-rw-r--r-- | core/modules/dnbd3/data/etc/fuse.conf | 8 | ||||
-rw-r--r-- | core/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service | 11 | ||||
l--------- | core/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service | 1 | ||||
-rw-r--r-- | core/modules/dnbd3/data/etc/udev/rules.d/90-dnbd3.rules | 1 | ||||
-rw-r--r-- | core/modules/dnbd3/data/opt/openslx/scripts/pam_script_auth.d/10-fuse | 6 | ||||
-rwxr-xr-x | core/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 | 16 | ||||
-rw-r--r-- | core/modules/dnbd3/module.build | 45 | ||||
-rw-r--r-- | core/modules/dnbd3/module.conf | 10 | ||||
-rw-r--r-- | core/modules/dnbd3/module.conf.debian | 8 | ||||
-rw-r--r-- | core/modules/dnbd3/module.conf.opensuse | 8 | ||||
-rw-r--r-- | core/modules/dnbd3/module.conf.ubuntu | 9 |
12 files changed, 124 insertions, 0 deletions
diff --git a/core/modules/dnbd3/TODO b/core/modules/dnbd3/TODO new file mode 100644 index 00000000..6203c18f --- /dev/null +++ b/core/modules/dnbd3/TODO @@ -0,0 +1 @@ +update to new config scheme diff --git a/core/modules/dnbd3/data/etc/fuse.conf b/core/modules/dnbd3/data/etc/fuse.conf new file mode 100644 index 00000000..926d936f --- /dev/null +++ b/core/modules/dnbd3/data/etc/fuse.conf @@ -0,0 +1,8 @@ +# /etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE) + +# Set the maximum number of FUSE mounts allowed to non-root users. +# The default is 1000. +#mount_max = 1000 + +# Allow non-root users to specify the allow_other or allow_root mount options. +user_allow_other diff --git a/core/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service b/core/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service new file mode 100644 index 00000000..516cbfa2 --- /dev/null +++ b/core/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service @@ -0,0 +1,11 @@ +[Unit] +Description=Setup dnbd3 kernel module and user space daemon +After=sysinit.target +Before=shutdown.target +DefaultDependencies=no + +[Service] +ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3 +ExecStop=/opt/openslx/bin/dnbd3-client --kill +ExecStopPost=/opt/openslx/bin/rm /var/run/dnbd3.socket +Restart=on-abort diff --git a/core/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service b/core/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service new file mode 120000 index 00000000..05dd4ac2 --- /dev/null +++ b/core/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service @@ -0,0 +1 @@ +../setup-dnbd3.service
\ No newline at end of file diff --git a/core/modules/dnbd3/data/etc/udev/rules.d/90-dnbd3.rules b/core/modules/dnbd3/data/etc/udev/rules.d/90-dnbd3.rules new file mode 100644 index 00000000..0eb1f52d --- /dev/null +++ b/core/modules/dnbd3/data/etc/udev/rules.d/90-dnbd3.rules @@ -0,0 +1 @@ +KERNEL=="dnbd*", SUBSYSTEM=="block", MODE="0664" diff --git a/core/modules/dnbd3/data/opt/openslx/scripts/pam_script_auth.d/10-fuse b/core/modules/dnbd3/data/opt/openslx/scripts/pam_script_auth.d/10-fuse new file mode 100644 index 00000000..85d8a75a --- /dev/null +++ b/core/modules/dnbd3/data/opt/openslx/scripts/pam_script_auth.d/10-fuse @@ -0,0 +1,6 @@ + +adduser "${PAM_USER}" "fuse" +ret=$? +[ "$ret" -ne "0" ] && slxlog "pam-auth-fuse" "Could not add $PAM_USER to group 'fuse'" +true + diff --git a/core/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 b/core/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 new file mode 100755 index 00000000..e519b1b8 --- /dev/null +++ b/core/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 @@ -0,0 +1,16 @@ +#!/bin/ash + +if ! insmod /lib/modules/dnbd3/dnbd3.ko; then + slxlog "dnbd3-kernel" "Error loading dnbd3 client kernel module" + exit 1 +fi + +[ -e "/dev/dnbd0" ] || exit 1 +for i in /dev/dnbd*; do + echo 8192 > "/sys/block/dnbd${i#/dev/dnbd}/queue/nr_requests" +done + +exec /opt/openslx/bin/dnbd3-client --daemon +slxlog "dnbd3-daemon" "Error launching dnbd3-client daemon" +exit 1 + diff --git a/core/modules/dnbd3/module.build b/core/modules/dnbd3/module.build new file mode 100644 index 00000000..e7c91f45 --- /dev/null +++ b/core/modules/dnbd3/module.build @@ -0,0 +1,45 @@ +fetch_source() { + mkdir -p "src/kmod" + if [ ! -d "src/dnbd3" ]; then + git clone "$REQUIRED_GIT" "src/dnbd3" || perror "Could not clone dnbd3 git repo" + fi + cd src/dnbd3 + #git checkout "$REQUIRED_BRANCH" || perror "Could not checkout requested branch $REQUIRED_BRANCH" + git checkout "$REQUIRED_COMMIT" || perror "Could not checkout requested commit $REQUIRED_COMMIT" + cd - + cp src/dnbd3/Kbuild.in src/dnbd3/src/*.{c,h} src/dnbd3/src/kernel/*.{c,h} src/kmod/ || perror "Could not copy kernel module source files" + cat > "src/kmod/Makefile" <<HEREEND +include \$(PWD)/Kbuild.in + +ifndef KDIR + KDIR = /lib/modules/\$(shell uname -r)/build +endif + +all: + make -C "\$(KDIR)" "M=\$(PWD)" modules + +clean: + make -C "\$(KDIR)" "M=\$(PWD)" clean +HEREEND +} + +build() { + cd "$MODULE_WORK_DIR/src/kmod" || perror "Could not CD to standalone dnbd3 kmod dir" + make MODULE_NAME=dnbd3 KDIR="$KERNEL_HEADERS_DIR" || perror "Could not compile kernel module" + mkdir -p "$MODULE_BUILD_DIR/lib/modules/dnbd3" || perror "Could not create lib/modules/dnbd3" + mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Coould not create opt/openslx/bin" + cp "$MODULE_WORK_DIR/src/kmod/dnbd3.ko" "$MODULE_BUILD_DIR/lib/modules/dnbd3/" || perror "could not cp dnbd3.ko" + cd "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Could not cd to build dir for client binary" + cmake "$MODULE_WORK_DIR/src/dnbd3" || perror "Could not cmake" + make dnbd3-client || perror "Could not make dnbd3-client" + make dnbd3-fuse || perror "Could not make dnbd3-fuse" + chown root:root "dnbd3-client" "dnbd3-fuse" + chmod +xs "dnbd3-client" + chmod +x "dnbd3-fuse" + cd "$MODULE_WORK_DIR" +} + +post_copy() { + : +} + diff --git a/core/modules/dnbd3/module.conf b/core/modules/dnbd3/module.conf new file mode 100644 index 00000000..29442db7 --- /dev/null +++ b/core/modules/dnbd3/module.conf @@ -0,0 +1,10 @@ +REQUIRED_MODULES="kernel" +REQUIRED_GIT="git://git.openslx.org/dnbd3.git" +REQUIRED_COMMIT="6d6455b271ac99c5862691620e1217ed7b3b78b4" +REQUIRED_BINARIES=" + dnbd3-client + dnbd3-fuse +" +REQUIRED_DIRECTORIES=" + /lib/modules +" diff --git a/core/modules/dnbd3/module.conf.debian b/core/modules/dnbd3/module.conf.debian new file mode 100644 index 00000000..d303245c --- /dev/null +++ b/core/modules/dnbd3/module.conf.debian @@ -0,0 +1,8 @@ +REQUIRED_CONTENT_PACKAGES=" + cmake +" + +REQUIRED_INSTALLED_PACKAGES=" + cmake + zlib1g-dev +" diff --git a/core/modules/dnbd3/module.conf.opensuse b/core/modules/dnbd3/module.conf.opensuse new file mode 100644 index 00000000..713ad2b1 --- /dev/null +++ b/core/modules/dnbd3/module.conf.opensuse @@ -0,0 +1,8 @@ +REQUIRED_CONTENT_PACKAGES=" + cmake +" + +REQUIRED_INSTALLED_PACKAGES=" + cmake + zlib-devel +" diff --git a/core/modules/dnbd3/module.conf.ubuntu b/core/modules/dnbd3/module.conf.ubuntu new file mode 100644 index 00000000..8033437b --- /dev/null +++ b/core/modules/dnbd3/module.conf.ubuntu @@ -0,0 +1,9 @@ +REQUIRED_CONTENT_PACKAGES=" + cmake +" + +REQUIRED_INSTALLED_PACKAGES=" + cmake + zlib1g-dev + libfuse-dev +" |