summaryrefslogtreecommitdiff
path: root/sys-cluster/drbd/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-cluster/drbd/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-cluster/drbd/files')
-rw-r--r--sys-cluster/drbd/files/drbd-8.0.rc157
-rw-r--r--sys-cluster/drbd/files/drbd-8.3.11-kernel3.patch17
-rw-r--r--sys-cluster/drbd/files/drbd-8.3.8.1-implicits.patch12
-rw-r--r--sys-cluster/drbd/files/drbd-8.4.3-block-drbd.patch20
4 files changed, 206 insertions, 0 deletions
diff --git a/sys-cluster/drbd/files/drbd-8.0.rc b/sys-cluster/drbd/files/drbd-8.0.rc
new file mode 100644
index 000000000000..57f583bf94bf
--- /dev/null
+++ b/sys-cluster/drbd/files/drbd-8.0.rc
@@ -0,0 +1,157 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+extra_started_commands="reload"
+
+depend() {
+ use logger
+ need net
+ before heartbeat
+ after sshd
+}
+
+DEFAULTFILE="/etc/conf.d/drbd"
+DRBDADM="/sbin/drbdadm"
+PROC_DRBD="/proc/drbd"
+MODPROBE="/sbin/modprobe"
+RMMOD="/sbin/rmmod"
+UDEV_TIMEOUT=10
+ADD_MOD_PARAM=""
+
+if [ -f $DEFAULTFILE ]; then
+ . $DEFAULTFILE
+fi
+
+# Just in case drbdadm want to display any errors in the configuration
+# file, or we need to ask the user about registering this installation
+# at http://usage.drbd.org, we call drbdadm here without any IO
+# redirection.
+$DRBDADM sh-nop
+
+assure_module_is_loaded() {
+ [ -e "$PROC_DRBD" ] && return
+ ebegin "Loading drbd module"
+ ret=0
+
+ $MODPROBE -s drbd `$DRBDADM sh-mod-parms` $ADD_MOD_PARAM || ret=20
+ eend $ret
+ return $ret
+}
+
+adjust_with_progress() {
+ IFS_O=$IFS
+ NEWLINE='
+'
+ IFS=$NEWLINE
+ local D=0
+ local S=0
+ local N=0
+
+ einfon "Setting drbd parameters "
+ COMMANDS=`$DRBDADM -d adjust all` || {
+ eend 20 "Error executing drbdadm"
+ return 20
+ }
+ echo -n "[ "
+
+ for CMD in $COMMANDS; do
+ if echo $CMD | grep -q disk; then echo -n "d$D "; D=$(( D+1 ));
+ elif echo $CMD | grep -q syncer; then echo -n "s$S "; S=$(( S+1 ));
+ elif echo $CMD | grep -q net; then echo -n "n$N "; N=$(( N+1 ));
+ else echo echo -n ".. ";
+ fi
+ IFS=$IFS_O
+ eval $CMD || {
+ echo
+ eend 20 "cmd $CMD failed!"
+ return 20
+ }
+ IFS=$NEWLINE
+ done
+ echo "]"
+ eend 0
+
+ IFS=$IFS_O
+}
+
+start() {
+ einfo "Starting DRBD resources:"
+ eindent
+ assure_module_is_loaded || return $?
+ adjust_with_progress || return $?
+
+ # make sure udev has time to create the device files
+ ebegin "Waiting for udev device creation ..."
+ for RESOURCE in `$DRBDADM sh-resources`; do
+ for DEVICE in `$DRBDADM sh-dev $RESOURCE`; do
+ UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
+ while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
+ sleep 1
+ UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
+ done
+ done
+ done
+ eend 0
+
+ einfon "Waiting for connection "
+ $DRBDADM wait-con-int
+ ret=$?
+ echo
+
+ sleep 5
+
+ einfon "Become primary if configured "
+ $DRBDADM sh-b-pri all
+ echo
+
+ eend $ret
+ return $ret
+}
+
+stop() {
+ ebegin "Stopping all DRBD resources"
+
+ # Check for mounted drbd devices
+ if ! grep -q '^/dev/drbd' /proc/mounts &>/dev/null; then
+ if [ -e ${PROC_DRBD} ]; then
+ ${DRBDADM} down all
+ ret=$?
+ sleep 3
+ if [ -e /proc/modules ] && grep -q '^drbd' /proc/modules ; then
+ ${RMMOD} drbd
+ fi
+ fi
+ eend $ret
+ return $ret
+ else
+ einfo "drbd devices mounted, please umount them before trying to stop drbd!"
+ eend 1
+ return 1
+ fi
+}
+
+status() {
+ # NEEDS to be heartbeat friendly...
+ # so: put some "OK" in the output.
+
+ if [ -e $PROC_DRBD ]; then
+ ret=0
+ ebegin "drbd driver loaded OK; device status:"
+ eend $ret
+ cat $PROC_DRBD
+ else
+ ebegin "drbd not loaded"
+ ret=3
+ eend $ret
+ fi
+ return $ret
+}
+
+reload() {
+ ebegin "Reloading DRBD"
+ ${DRBDADM} adjust all
+ ret=$?
+ eend $ret
+ return $ret
+}
diff --git a/sys-cluster/drbd/files/drbd-8.3.11-kernel3.patch b/sys-cluster/drbd/files/drbd-8.3.11-kernel3.patch
new file mode 100644
index 000000000000..1eeca1b1b0ff
--- /dev/null
+++ b/sys-cluster/drbd/files/drbd-8.3.11-kernel3.patch
@@ -0,0 +1,17 @@
+--- a/drbd/Makefile 2011-07-07 12:55:39.000000000 +0200
++++ b/drbd/Makefile 2011-11-03 12:56:42.280603057 +0100
+@@ -77,9 +77,12 @@
+ endif
+ endif
+
++ KDIR_Makefile_VERSION = $(shell test -e $(KDIR)/Makefile && grep "^VERSION = " $(KDIR)/Makefile | cut -d " " -f 3)
+ KDIR_Makefile_PATCHLEVEL = $(shell test -e $(KDIR)/Makefile && grep "^PATCHLEVEL = " $(KDIR)/Makefile | cut -d " " -f 3)
+- ifneq ($(findstring $(KDIR_Makefile_PATCHLEVEL),12345),)
+- $(error "won't compile with this kernel version")
++ ifneq ($(KDIR_Makefile_VERSION),3)
++ ifneq ($(findstring $(KDIR_Makefile_PATCHLEVEL),12345),)
++ $(error "ici won't compile with this kernel version")
++ endif
+ endif
+
+ .PHONY: drbd.o default all greeting clean kbuild install dep tags
diff --git a/sys-cluster/drbd/files/drbd-8.3.8.1-implicits.patch b/sys-cluster/drbd/files/drbd-8.3.8.1-implicits.patch
new file mode 100644
index 000000000000..0fbbb92a2c3f
--- /dev/null
+++ b/sys-cluster/drbd/files/drbd-8.3.8.1-implicits.patch
@@ -0,0 +1,12 @@
+drbdadm_main.c:2525:2: warning: implicit declaration of function ‘stat’
+
+--- a/user/drbdadm_main.c
++++ b/user/drbdadm_main.c
+@@ -33,6 +33,7 @@
+ #include <search.h>
+
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <sys/wait.h>
+ #include <sys/poll.h>
+ #include <sys/socket.h>
diff --git a/sys-cluster/drbd/files/drbd-8.4.3-block-drbd.patch b/sys-cluster/drbd/files/drbd-8.4.3-block-drbd.patch
new file mode 100644
index 000000000000..408b81362967
--- /dev/null
+++ b/sys-cluster/drbd/files/drbd-8.4.3-block-drbd.patch
@@ -0,0 +1,20 @@
+--- a/scripts/block-drbd 2014-07-30 17:19:59.000000000 -0700
++++ b/scripts/block-drbd 2014-07-31 09:54:56.000000000 -0700
+@@ -248,7 +248,7 @@
+ fi
+
+ case $t in
+- drbd)
++ drbd|phy)
+ drbd_resource=$p
+ drbd_role="$(/sbin/drbdadm role $drbd_resource)"
+ drbd_lrole="${drbd_role%%/*}"
+@@ -276,7 +276,7 @@
+
+ remove)
+ case $t in
+- drbd)
++ drbd|phy)
+ p=$(xenstore_read "$XENBUS_PATH/params")
+ drbd_resource=$p
+ drbd_role="$(/sbin/drbdadm role $drbd_resource)"