[Debian-ha-maintainers] Bug#633547: drbd8-utils: Drbd init script did not start stacked resources.

root spirit.nn at gmail.com
Mon Jul 11 13:29:53 UTC 2011


Package: drbd8-utils
Version: 2:8.3.7-2.1
Severity: important



-- System Information:
Debian Release: 6.0.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages drbd8-utils depends on:
ii  debconf [debconf-2.0]         1.5.36.1   Debian configuration management sy
ii  libc6                         2.11.2-10  Embedded GNU C Library: Shared lib

drbd8-utils recommends no packages.

Versions of packages drbd8-utils suggests:
ii  heartbeat                     1:3.0.3-2  Subsystem for High-Availability Li

-- Configuration Files:
/etc/drbd.d/global_common.conf changed:
global {
	usage-count no;
	# minor-count dialog-refresh disable-ip-verification
}
common {
	protocol C;
	handlers {
		pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
		pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
		local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f";
		# fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
		# split-brain "/usr/lib/drbd/notify-split-brain.sh root";
		# out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
		# before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh -p 15 -- -c 16k";
		# after-resync-target /usr/lib/drbd/unsnapshot-resync-target-lvm.sh;
	}
	startup {
		# wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb;
		wfc-timeout 30;
		degr-wfc-timeout 30;
		outdated-wfc-timeout 30;
		#wait-after-sb 30;
	}
	disk {
		# on-io-error fencing use-bmbv no-disk-barrier no-disk-flushes
		# no-disk-drain no-md-flushes max-bio-bvecs   
	}
	net {
		# snd‐buf-size rcvbuf-size timeout connect-int ping-int ping-timeout max-buffers
		# max-epoch-size ko-count allow-two-primaries cram-hmac-alg shared-secret
		# after-sb-0pri after-sb-1pri after-sb-2pri data-integrity-alg no-tcp-cork
	}
	syncer {
		# rate after al-extents use-rle cpu-mask verify-alg csums-alg
	}
}

/etc/init.d/drbd changed:
DEFAULTFILE="/etc/default/drbd"
DRBDADM="/sbin/drbdadm"
DRBDSETUP="/sbin/drbdsetup"
PROC_DRBD="/proc/drbd"
MODPROBE="/sbin/modprobe"
RMMOD="/sbin/rmmod"
UDEV_TIMEOUT=10
ADD_MOD_PARAM=""
if [ -f $DEFAULTFILE ]; then
  . $DEFAULTFILE
fi
test -f $DRBDADM || exit 5
log_daemon_msg() { echo -n "${1:-}: ${2:-}"; }
log_end_msg() { echo "."; }
if [ -f /lib/lsb/init-functions ]; then
    . /lib/lsb/init-functions
fi
function assure_module_is_loaded
{
    [ -e "$PROC_DRBD" ] && return
    $MODPROBE -s drbd `$DRBDADM sh-mod-parms` $ADD_MOD_PARAM || {
	echo "Can not load the drbd module."$'\n'; exit 20
    }
    # tell klogd to reload module symbol information ...
    [ -e /var/run/klogd.pid ] && [ -x /sbin/klogd ] && /sbin/klogd -i
}
function adjust_with_progress
{
    IFS_O=$IFS
    NEWLINE='
'
    IFS=$NEWLINE
    local res
    COMMANDS=`$DRBDADM -d -n res adjust all` || exit 20
    echo -n "[ "
    for CMD in $COMMANDS; do
	case "$CMD" in
		res=*)		eval "$CMD";;
		*\ disk\ *)	echo -n "d($res) " ;;
		*\ syncer\ *)	echo -n "s($res) " ;;
		*\ net\ *)	echo -n "n($res) " ;;
		*)		echo ".. " ;;
	esac
	if ! eval "$CMD"; then
	    echo -e "\n[$res] cmd $CMD failed - continuing!\n "
	fi
    done
    echo -n "]"
    IFS=$IFS_O
}
drbd_pretty_status()
{
	local proc_drbd=$1
	# add resource names
	if ! type column &> /dev/null ||
	   ! type paste &> /dev/null ||
	   ! type join &> /dev/null ||
	   ! type sed &> /dev/null ||
	   ! type tr &> /dev/null
	then
		cat "$proc_drbd"
		return
	fi
	sed -e '2q' < "$proc_drbd"
	sed_script=$(
		i=0;
		_sh_status_process() {
			let i++ ;
			stacked=${_stacked_on:+"^^${_stacked_on_minor:-${_stacked_on//[!a-zA-Z0-9_ -]/_}}"}
			printf "s|^ *%u:|%6u\t&%s%s|\n" \
				$_minor $i \
				"${_res_name//[!a-zA-Z0-9_ -]/_}" "$stacked"
		};
		eval "$(drbdadm sh-status)" )
	p() {
		sed -e "1,2d" \
		      -e "$sed_script" \
		      -e '/^ *[0-9]\+: cs:Unconfigured/d;' \
		      -e 's/^\(.* cs:.*[^ ]\)   \([rs]...\)$/\1 - \2/g' \
		      -e 's/^\(.* \)cs:\([^ ]* \)st:\([^ ]* \)ds:\([^ ]*\)/\1\2\3\4/' \
		      -e 's/^\(.* \)cs:\([^ ]* \)ro:\([^ ]* \)ds:\([^ ]*\)/\1\2\3\4/' \
		      -e 's/^\(.* \)cs:\([^ ]*\)$/\1\2/' \
		      -e 's/^ *[0-9]\+:/ x &??not-found??/;' \
		      -e '/^$/d;/ns:.*nr:.*dw:/d;/resync:/d;/act_log:/d;' \
		      -e 's/^\(.\[.*\)\(sync.ed:\)/... ... \2/;/^.finish:/d;' \
		      -e 's/^\(.[0-9 %]*oos:\)/... ... \1/' \
		      < "$proc_drbd" | tr -s '\t ' '  ' 
	}
	m() {
		join -1 2 -2 1 -o 1.1,2.2,2.3 \
			<( ( drbdadm sh-dev all ; drbdadm -S sh-dev all ) | cat -n | sort -k2,2) \
			<(sort < /proc/mounts ) |
			sort -n | tr -s '\t ' '  ' | sed -e 's/^ *//'
	}
	# echo "=== p ==="
	# p
	# echo "=== m ==="
	# m
	# echo "========="
	# join -a1 <(p|sort) <(m|sort)
	# echo "========="
	(
	echo m:res cs ro ds p mounted fstype
	join -a1 <(p|sort) <(m|sort) | cut -d' ' -f2-6,8- | sort -k1,1n -k2,2
	) | column -t
}
case "$1" in
    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
	log_daemon_msg "Starting DRBD resources"
	assure_module_is_loaded
	adjust_with_progress
	# make sure udev has time to create the device files
	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
	[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd	# for RedHat
	$DRBDADM wait-con-int # User interruptible version of wait-connect all
	$DRBDADM sh-b-pri all # Become primary if configured
	log_end_msg 0
	;;
    stop)
	$DRBDADM sh-nop
	log_daemon_msg "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
	[ -f /var/lock/subsys/drbd ] && rm /var/lock/subsys/drbd
	log_end_msg 0
	;;
    status)
	# NEEDS to be heartbeat friendly...
	# so: put some "OK" in the output.
	if [ -e $PROC_DRBD ]; then
	    echo "drbd driver loaded OK; device status:"
	    drbd_pretty_status $PROC_DRBD 2>/dev/null
	    exit 0
	else
	    echo >&2 "drbd not loaded"
	    exit 3
	fi
	;;
    reload)
	$DRBDADM sh-nop
	log_daemon_msg  "Reloading DRBD configuration"
	$DRBDADM adjust all
	log_end_msg 0
	;;
    restart|force-reload)
	$DRBDADM sh-nop
	log_daemon_msg "Restarting all DRBD resources"
	$DRBDADM down all
	$RMMOD drbd
	assure_module_is_loaded
	$DRBDADM up all
	log_end_msg 0
	;;
    *)
	echo "Usage: /etc/init.d/drbd {start|stop|status|reload|restart|force-reload}"
	exit 1
	;;
esac
exit 0


-- no debconf information





More information about the Debian-ha-maintainers mailing list