summaryrefslogtreecommitdiffstats
path: root/cluster/drbd
diff options
context:
space:
mode:
authorVlad Glagolev2011-01-15 07:49:59 +0300
committerVlad Glagolev2011-01-15 07:49:59 +0300
commitf24ff38efcc96bd9e90277b82dd0b98174930699 (patch)
treecbdb1ca785272beea06b25c42512d032f0635685 /cluster/drbd
parentaee22c9695e07e8d19f3c0fb0f772a967ccbf238 (diff)
drbd: => 8.3.8.1
Diffstat (limited to 'cluster/drbd')
-rwxr-xr-xcluster/drbd/BUILD2
-rwxr-xr-xcluster/drbd/CONFIGURE6
-rwxr-xr-xcluster/drbd/DETAILS13
-rw-r--r--cluster/drbd/HISTORY16
-rwxr-xr-xcluster/drbd/PRE_BUILD4
-rwxr-xr-xcluster/drbd/init.d/drbd171
-rw-r--r--cluster/drbd/init.patch11
7 files changed, 212 insertions, 11 deletions
diff --git a/cluster/drbd/BUILD b/cluster/drbd/BUILD
index 2031ac593b..bbbdafdefc 100755
--- a/cluster/drbd/BUILD
+++ b/cluster/drbd/BUILD
@@ -1,3 +1,3 @@
-OPTS="$DRBD_OPTS $OPTS" &&
+OPTS="--with-distro=generic $DRBD_OPTS $OPTS" &&
default_build
diff --git a/cluster/drbd/CONFIGURE b/cluster/drbd/CONFIGURE
index 17f11f6370..88b4402ad3 100755
--- a/cluster/drbd/CONFIGURE
+++ b/cluster/drbd/CONFIGURE
@@ -4,4 +4,8 @@ config_query_option DRBD_OPTS "Enable kernel module?" y \
config_query_option DRBD_OPTS "Enable management utilities?" y \
"--with-utils" \
- "--without-utils"
+ "--without-utils" &&
+
+config_query_option DRBD_OPTS "Enable heartbeat integration?" n \
+ "--with-heartbeat" \
+ "--without-heartbeat"
diff --git a/cluster/drbd/DETAILS b/cluster/drbd/DETAILS
index fae73f9ecc..cec2ab02ee 100755
--- a/cluster/drbd/DETAILS
+++ b/cluster/drbd/DETAILS
@@ -1,12 +1,21 @@
SPELL=drbd
- VERSION=8.3.9
+
+KERNEL_BRANCH=`get_kernel_version|cut -d . -f -3`
+
+if [[ $KERNEL_BRANCH == 2.6.33 ]] || [[ $KERNEL_BRANCH == 2.6.34 ]]; then
+ VERSION=8.3.7
+ SOURCE_HASH=sha512:9ea576ed6a75d80009ade0f9540535b2a65ecee6d38b1a85fa3146a97aac8cb3add31154e2921630aa75121c7115d66bdcf45adb8e0fa481bdb27c011b1c9b15
+else
+ VERSION=8.3.8.1
+ SOURCE_HASH=sha512:c43c6d065328058db66f708d47ce082603b766deb1530c57aa736a42b4908f780ede41f76395ca45c2691ef1dfd142147a4c98a7bcdb26ba7de73b149d8f9f5f
+fi
BRANCH=`echo $VERSION|cut -d . -f 1,2`
SOURCE=${SPELL}-${VERSION}.tar.gz
SOURCE_URL[0]=http://oss.linbit.com/$SPELL/$BRANCH/$SOURCE
- SOURCE_HASH=sha512:7d6545b3298f2af7cc6ba91a501a15f3232cb914619deae4ff5b09b14d59375015878c8794464cedee298b1209cee60a6bd16cca436471b20c0641cc2a6f2745
SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}"
WEB_SITE=http://www.drbd.org/
ENTERED=20060630
+ DOCS="COPYING README"
LICENSE[0]=GPL
SHORT="block device which is designed to build high availability clusters"
cat << EOF
diff --git a/cluster/drbd/HISTORY b/cluster/drbd/HISTORY
index d6bd854222..9f6d27f3aa 100644
--- a/cluster/drbd/HISTORY
+++ b/cluster/drbd/HISTORY
@@ -1,11 +1,13 @@
-2010-12-08 Vlad Glagolev <stealth@sourcemage.org>
- * DETAILS: updated spell to 8.3.9; replaced gpg sig with sha512 hash;
- use BRANCH; corrected short desc; quoting paths
- * BUILD: use DRBD_OPTS and default_build
- * DEPENDS: added, for dependencies
- * CONFIGURE: added, for configure options
+2011-01-15 Vlad Glagolev <stealth@sourcemage.org>
+ * DETAILS: updated spell to 8.3.8.1/8.3.7 (use selection depending on
+ installed kernel branch)
+ * init.d/drbd: added init script, adopted for Source Mage
+ * BUILD: use generic distribution set
+ * CONFIGURE: added support for heartbeat integration
+ * PRE_BUILD: added, to apply the patch
+ * init.patch: added, to not install init script in a wrong place
-2010-06-17 Bor Kraljič <pyrobor@ver.si>
+2010-17-06 Bor Kraljič <pyrobor@ver.si>
* drbd-0.7.19.tar.gz.sig: resigned sources due to gpg error (bug #15746)
2006-10-03 Juuso Alasuutari <iuso@sourcemage.org>
diff --git a/cluster/drbd/PRE_BUILD b/cluster/drbd/PRE_BUILD
new file mode 100755
index 0000000000..aab5a7045b
--- /dev/null
+++ b/cluster/drbd/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+
+patch -p0 < "$SPELL_DIRECTORY/init.patch"
diff --git a/cluster/drbd/init.d/drbd b/cluster/drbd/init.d/drbd
new file mode 100755
index 0000000000..f8395c795c
--- /dev/null
+++ b/cluster/drbd/init.d/drbd
@@ -0,0 +1,171 @@
+#!/bin/bash
+
+# Distributed under the terms of the GNU General Public License v2
+#
+# Copyright 2001-2010 LINBIT Information Technologies
+# Philipp Reisner, Lars Ellenberg
+#
+# Copyright 2010-2011 Source Mage Team
+# Vlad Glagolev
+
+PROGRAM=/bin/false
+RUNLEVEL=3
+NEEDS="+local_fs +network"
+
+. /etc/init.d/smgl_init
+
+DRBDADM="/sbin/drbdadm"
+DRBDSETUP="/sbin/drbdsetup"
+PROC_DRBD="/proc/drbd"
+MODPROBE="/sbin/modprobe"
+RMMOD="/sbin/rmmod"
+UDEV_TIMEOUT=10
+ADD_MOD_PARAM=""
+
+function assure_module_is_loaded {
+ [ -e "$PROC_DRBD" ] && return
+ echo "Loading drbd module..."
+
+ $MODPROBE -s drbd `$DRBDADM sh-mod-parms` $ADD_MOD_PARAM || return 1
+
+ return 0
+}
+
+function adjust_with_progress {
+ local IFS_O=$IFS
+ local IFS=$'\n'
+ local res out
+
+ COMMANDS=`$DRBDADM -d -n res adjust all` || return 1
+
+ echo -n "[ "
+
+ for CMD in $COMMANDS; do
+ IFS=$IFS_O
+
+ case "$CMD" in
+ res=*)
+ eval "$CMD"
+ ;;
+ *\ disk\ *)
+ # Check for offline resize. If using internal meta data,
+ # we may need to move it first to its expected location.
+ out=$($DRBDADM check-resize "$res" 2>&1)
+ [[ -z $out ]] ||
+ printf "\n%s\n%s\n" "$res" "$out"
+ echo -n "d($res) "
+ ;;
+ *\ syncer\ *)
+ echo -n "s($res) "
+ ;;
+ *\ net\ *)
+ echo -n "n($res) "
+ ;;
+ *)
+ echo ".. "
+ ;;
+ esac
+
+ if ! eval "$CMD"; then
+ printf "[%s] cmd %s failed - continuing!\n" "$res" "$CMD"
+ fi
+ done
+
+ echo -n "]"
+
+ return 0
+}
+
+start() {
+ # 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
+ evaluate_retval
+
+ echo "Starting DRBD resources:"
+
+ adjust_with_progress
+ evaluate_retval
+
+ # make sure udev has time to create the device files
+ echo "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
+
+ echo "Waiting for connection "
+ $DRBDADM wait-con-int # User interruptible version of wait-connect all
+ $DRBDADM sh-b-pri all # Become primary if configured
+
+ evaluate_retval
+}
+
+stop() {
+ $DRBDADM sh-nop
+ echo "Stopping all DRBD resources..."
+
+ if [ -e $PROC_DRBD ]; then
+ # bypass drbdadm and drbd config file and everything,
+ # to avoid leaving devices around that are not referenced by
+ # the current config file, or in case the current config file
+ # does not parse for some reason.
+ for d in /dev/drbd* ; do
+ [ -L "$d" ] && continue
+ [ -b "$d" ] || continue
+
+ M=$(umount "$d" 2>&1)
+
+ case $M in
+ *" not mounted")
+ :
+ ;;
+ *)
+ echo "$M" >&2
+ ;;
+ esac
+
+ $DRBDSETUP "$d" down
+ done
+
+ $RMMOD drbd
+ fi
+
+ evaluate_retval
+}
+
+status() {
+ if [ -e $PROC_DRBD ]; then
+ echo "device status:"
+ cat $PROC_DRBD
+ else
+ echo "drbd module not loaded"
+ return 1
+ fi
+}
+
+restart() {
+ echo "Restarting all DRBD resources..."
+
+ stop
+ sleep 1
+ start
+}
+
+reload() {
+ $DRBDADM sh-nop
+ echo "Reloading DRBD configuration..."
+ $DRBDADM adjust all
+
+ evaluate_retval
+}
diff --git a/cluster/drbd/init.patch b/cluster/drbd/init.patch
new file mode 100644
index 0000000000..003fc01717
--- /dev/null
+++ b/cluster/drbd/init.patch
@@ -0,0 +1,11 @@
+--- scripts/Makefile.in.orig 2010-02-26 15:39:16.000000000 +0300
++++ scripts/Makefile.in 2011-01-15 01:59:40.080000128 +0300
+@@ -57,8 +57,6 @@
+
+ install-utils:
+ ifeq ($(WITH_UTILS),yes)
+- install -d $(DESTDIR)$(INITDIR)
+- install -m 755 drbd $(DESTDIR)$(INITDIR)/
+ @ if [ ! -e $(DESTDIR)$(sysconfdir)/drbd.conf ]; then \
+ install -d $(DESTDIR)$(sysconfdir)/; \
+ install -m 644 drbd.conf $(DESTDIR)$(sysconfdir)/; \