--- heartbeat-2.99.2+sles11r9.orig/heartbeat.spec +++ heartbeat-2.99.2+sles11r9/heartbeat.spec @@ -421,6 +421,7 @@ --localstatedir=%{_var} --infodir=%{_infodir} \ --mandir=%{_mandir} --libdir=%{_libdir} \ --libexecdir=%{_libdir} \ + --docdir=%{_datadir}/doc/packages/heartbeat/stonith \ --with-group-name=%{gname} --with-ccmuser-name=%{uname} \ --with-group-id=%{uid} --with-ccmuser-id=%{uid} \ --with-hapkgversion=%{version} \ --- heartbeat-2.99.2+sles11r9.orig/configure.in +++ heartbeat-2.99.2+sles11r9/configure.in @@ -224,8 +224,8 @@ oldincludedir=`var "$oldincludedir" "$exec_prefix/include"` infodir=`var "$infodir" "$prefix/info"` mandir=`var "$mandir" "$exec_prefix/man"` -docdir=${datadir}/doc/${HB_PKG}-${VERSION} -stdocdir=${datadir}/doc/${HB_PKG}-${VERSION}/stonith +docdir=`var "$docdir" "${datadir}/doc/${HB_PKG}-${VERSION}"` +stdocdir="${docdir}/stonith" libdir=`var "$libdir" "$exec_prefix/lib"` libexecdir=`var "$libexecdir" "$exec_prefix/libexec"` noarchlibdir=`var "$noarchlibdir" "$prefix/lib"` @@ -2810,6 +2810,7 @@ eval my_localstatedir="`eval echo ${localstatedir}`" eval my_mandir="`eval echo ${mandir}`" eval my_sbindir="`eval echo ${sbindir}`" +eval my_docdir="`eval echo ${docdir}`" eval my_sysconfdir="`eval echo ${sysconfdir}`" eval my_initdefdir="`eval echo ${INITDEFDIR}`" @@ -2822,6 +2823,7 @@ AC_MSG_RESULT([ Libraries = "$my_libdir"]) AC_MSG_RESULT([ Header files = "$my_includedir"]) AC_MSG_RESULT([ Arch-independent files = "$my_datadir"]) +AC_MSG_RESULT([ Documentation files = "$my_docdir"]) AC_MSG_RESULT([ State information = "$my_localstatedir"]) AC_MSG_RESULT([ System configuration = "$my_sysconfdir"]) AC_MSG_RESULT([ Init (rc) scripts = "$my_initdir"]) --- heartbeat-2.99.2+sles11r9.orig/.hg_archival.txt +++ heartbeat-2.99.2+sles11r9/.hg_archival.txt @@ -1,2 +1,2 @@ repo: 8448b17e67437947c48c639c6faa4371c4a14b3b -node: a8aff3dff21bfd17b9dd177f6a5091af759e551f +node: cf020d609b5757feb98dbdd1eb332ff98915a89c --- heartbeat-2.99.2+sles11r9.orig/contrib/drbd-outdate-peer/drbd-peer-outdater.c +++ heartbeat-2.99.2+sles11r9/contrib/drbd-outdate-peer/drbd-peer-outdater.c @@ -48,7 +48,7 @@ int rc; } dop_client_t; -const char *crm_system_name = "drbd-peer-outdater"; +static const char *crm_system_name = "drbd-peer-outdater"; static void usage(const char* cmd, int exit_status); --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat.init +++ heartbeat-2.99.2+sles11r9/debian/heartbeat.init @@ -0,0 +1,440 @@ +#!/bin/sh +# +# +# heartbeat Start high-availability services +# +# Author: Alan Robertson +# License: GNU General Public License (GPL) +# +# This script works correctly under SuSE, Debian, +# Conectiva, Red Hat and a few others. Please let me know if it +# doesn't work under your distribution, and we'll fix it. +# We don't hate anyone, and like for everyone to use +# our software, no matter what OS or distribution you're using. +# +# chkconfig: 2345 75 05 +# description: Startup script high-availability services. +# processname: heartbeat +# pidfile: /var/run/heartbeat.pid +# config: /etc/ha.d/ha.cf +# +### BEGIN INIT INFO +# Description: heartbeat is a basic high-availability subsystem. +# It will start services at initialization, and when machines go up +# or down. This version will also perform IP address takeover using +# gratuitous ARPs. It works correctly for a 2-node configuration, +# and is extensible to larger configurations. +# +# It implements the following kinds of heartbeats: +# - Bidirectional Serial Rings ("raw" serial ports) +# - UDP/IP broadcast (ethernet, etc) +# - UDP/IP multicast (ethernet, etc) +# - Unicast heartbeats +# - "ping" heartbeats (for routers, switches, etc.) +# (to be used for breaking ties in 2-node systems +# and monitoring networking availability) +# Short-Description: High-availability services. +# Provides: heartbeat HA +# Required-Start: $remote_fs $network $time $syslog +# Should-Start: openhpid +# Required-Stop: $remote_fs $network $time $syslog +# Should-stop: openhpid +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +[ -f /etc/default/heartbeat ] && . /etc/default/heartbeat + +HA_DIR=/etc/ha.d; export HA_DIR +CONFIG=$HA_DIR/ha.cf +. $HA_DIR/shellfuncs + +LOCKDIR=/var/lock/subsys +RUNDIR=/var/run + + +# Echo without putting a newline on the end +EchoNoNl() { + Echo "$@" +} + +# Echo with escapes enabled... +EchoEsc() { + Echo "$@" +} + +echo_failure() { + EchoEsc " Heartbeat failure [rc=$1]. $rc_failed" + return $1 +} + +echo_success() { + : Cool! It started! + EchoEsc "$rc_done" +} + +if + [ -r /etc/SuSE-release ] +then + # rc.status is new since SuSE 7.0 + [ -r /etc/rc.status ] && . /etc/rc.status + [ -r /etc/rc.config ] && . /etc/rc.config + + # Determine the base and follow a runlevel link name. + base=${0##*/} + link=${base#*[SK][0-9][0-9]} + +fi +if + [ -z "$rc_done" ] +then + rc_done="Done." + rc_failed="Failed." + rc_skipped="Skipped." +fi + + +# exec 2>>/var/log/ha-debug + +# This should probably be it's own autoconf parameter +# because RH has moved it from time to time... +# and I suspect Conectiva and Mandrake also supply it. + +DISTFUNCS=/etc/rc.d/init.d/functions +SUBSYS=heartbeat +MODPROBE=/sbin/modprobe +US=`uname -n` + +# Set this to a 1 if you want to automatically load kernel modules +USE_MODULES=1 + +[ -x $HA_BIN/heartbeat ] || exit 0 + +# +# Some environments like it if we use their functions... +# +if + [ ! -x $DISTFUNCS ] +then + # Provide our own versions of these functions + status() { + $HA_BIN/heartbeat -s + } + echo_failure() { + EchoEsc " Heartbeat failure [rc=$1]. $rc_failed" + return $1 + } + echo_success() { + : Cool! It started! + EchoEsc "$rc_done" + } +else + . $DISTFUNCS +fi + +# +# See if they've configured things yet... +# +if + [ ! -f $CONFIG ] +then + EchoNoNl "Heartbeat not configured: $CONFIG not found." + echo_failure 1 + exit 0 +fi + +CrmEnabled() { + case `ha_parameter crm | tr '[A-Z]' '[a-z]'` in + y|yes|enable|on|true|1|manual) true;; + *) false;; + esac +} + +init_watchdog() { + if + [ -f /proc/devices -a -x $MODPROBE ] + then + init_watchdog_linux + fi +} + +# +# Install the softdog module if we need to +# +init_watchdog_linux() { +# +# We need to install it if watchdog is specified in $CONFIG, and +# /dev/watchdog refers to a softdog device, or it /dev/watchdog +# doesn't exist at all. +# +# If we need /dev/watchdog, then we'll make it if necessary. +# +# Whatever the user says we should use for watchdog device, that's +# what we'll check for, use and create if necessary. If they misspell +# it, or don't put it under /dev, so will we. +# Hope they do it right :-) +# +# + insmod=no + # What do they think /dev/watchdog is named? + MISCDEV=`grep ' misc$' /proc/devices | cut -c1-4` + MISCDEV=`Echo $MISCDEV` + WATCHDEV=`ha_parameter watchdog` + WATCHDEV=`Echo $WATCHDEV` + if + [ "X$WATCHDEV" != X ] + then + : Watchdog requested by $CONFIG file + # + # We try and modprobe the module if there's no dev or the dev exists + # and points to the softdog major device. + # + if + [ ! -c "$WATCHDEV" ] + then + insmod=yes + else + case `ls -l "$WATCHDEV" 2>/dev/null` in + *$MISCDEV,*) + insmod=yes;; + *) : "$WATCHDEV isn't a softdog device (wrong major)" ;; + esac + fi + else + : No watchdog device specified in $CONFIG file. + fi + case $insmod in + yes) + if + grep softdog /proc/modules >/dev/null 2>&1 + then + : softdog already loaded + else + $MODPROBE softdog nowayout=0 >/dev/null 2>&1 + fi;; + esac + if + [ "X$WATCHDEV" != X -a ! -c "$WATCHDEV" -a $insmod = yes ] + then + minor=`cat /proc/misc | grep watchdog | cut -c1-4` + mknod -m 600 $WATCHDEV c $MISCDEV $minor + fi +} # init_watchdog_linux() + + +# +# Start the heartbeat daemon... +# + +start_heartbeat() { + if + ERROR=`$HA_BIN/heartbeat 2>&1` + then + : OK + else + return $? + fi +} + + +# +# Start Linux-HA +# + +StartHA() { + EchoNoNl "Starting High-Availability services: " + + if + CrmEnabled + then + : OK + else + $HA_NOARCHBIN/ResourceManager verifyallidle + fi + if + [ $USE_MODULES = 1 ] + then + # Create /dev/watchdog and load module if we should + init_watchdog + fi + rm -f $RUNDIR/ppp.d/* + if + [ ! -d $RUNDIR/heartbeat ] + then + mkdir -p $RUNDIR/heartbeat/ccm + mkdir -p $RUNDIR/crm + chown -R hacluster:haclient $RUNDIR/heartbeat $RUNDIR/crm + chmod -R 750 $RUNDIR/heartbeat $RUNDIR/crm + fi + if + [ -f $HA_DIR/ipresources -a ! -f $HA_DIR/haresources ] + then + mv $HA_DIR/ipresources $HA_DIR/haresources + fi + # Start heartbeat daemon + if + start_heartbeat + then + echo_success + return 0 + else + RC=$? + echo_failure $RC + if [ ! -z "$ERROR" ]; then + Echo + Echo "$ERROR" + fi + return $RC + fi +} + +# +# Ask heartbeat to stop. It will give up its resources... +# +StopHA() { + EchoNoNl "Stopping High-Availability services: " + + if + $HA_BIN/heartbeat -k >/dev/null 2>&1 # Kill it + then + echo_success + return 0 + else + RC=$? + echo_failure $RC + return $RC + fi +} + +StatusHA() { + $HA_BIN/heartbeat -s +} + +StandbyHA() { + auto_failback=`ha_parameter auto_failback | tr '[A-Z]' '[a-z]'` + nice_failback=`ha_parameter nice_failback | tr '[A-Z]' '[a-z]'` + + case "$auto_failback" in + *legacy*) echo "auto_failback is set to legacy. Cannot enter standby." + exit 1;; + esac + case "$nice_failback" in + *off*) echo "nice_failback is disabled. Cannot enter standby." + exit 1;; + esac + case "${auto_failback}${nice_failback}" in + "") echo "auto_failback defaulted to legacy. Cannot enter standby." + exit 1;; + esac + + echo "auto_failback: $auto_failback" + if + StatusHA >/dev/null 2>&1 + then + EchoNoNl "Attempting to enter standby mode" + if + $HA_NOARCHBIN/hb_standby + then + # It's impossible to tell how long this will take. + echo_success + else + echo_failure $? + fi + else + Echo "Heartbeat is not currently running." + exit 1 + fi +} + +# +# Ask heartbeat to restart. It will *keep* its resources +# +ReloadHA() { + EchoNoNl "Reloading High-Availability services: " + + if + $HA_BIN/heartbeat -r # Restart, and keep your resources + then + echo_success + return 0 + else + RC=$? + echo_failure $RC + return $RC + fi +} + +RunStartStop() { + # Run pre-startup script if it exists + if + [ -f $HA_DIR/resource.d/startstop ] + then + $HA_DIR/resource.d/startstop "$@" + fi +} + +RC=0 +# See how we were called. + +case "$1" in + start) + RunStartStop pre-start + StartHA + RC=$? + Echo + if + [ $RC -eq 0 ] + then + [ ! -d $LOCKDIR ] && mkdir -p $LOCKDIR + touch $LOCKDIR/$SUBSYS + fi + RunStartStop post-start $RC + ;; + + standby) + StandbyHA + RC=$?;; + + status) + StatusHA + RC=$?;; + + stop) + RunStartStop "pre-stop" + StopHA + RC=$? + Echo + if + [ $RC -eq 0 ] + then + rm -f $LOCKDIR/$SUBSYS + fi + RunStartStop post-stop $RC + ;; + + restart) + sleeptime=`ha_parameter deadtime` + StopHA + Echo + EchoNoNl Waiting to allow resource takeover to complete: + sleep $sleeptime + sleep 10 # allow resource takeover to complete (hopefully). + echo_success + Echo + StartHA + Echo + ;; + + force-reload|reload) + ReloadHA + Echo + RC=$? + ;; + + *) + Echo "Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $RC + --- heartbeat-2.99.2+sles11r9.orig/debian/Makefile.am +++ heartbeat-2.99.2+sles11r9/debian/Makefile.am @@ -21,17 +21,15 @@ MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = changelog compat control copyright \ - dpkg-checkbuild check-uninstalled rules \ - heartbeat-2.prerm \ - heartbeat-dev.dirs \ - heartbeat-dev.install \ - heartbeat.dirs \ - heartbeat.install \ - heartbeat.postinst \ - heartbeat.postrm \ + dpkg-checkbuild rules \ + heartbeat.dirs heartbeat.files \ + heartbeat.postinst heartbeat.postrm \ heartbeat.preinst \ - ldirectord.dirs \ - ldirectord.install + heartbeat-dev.dirs heartbeat-dev.files \ + heartbeat-gui.dirs heartbeat-gui.files \ + heartbeat-2.prerm \ + ldirectord.files ldirectord.postinst \ + ldirectord.postrm clean-local: rm -f *.substvars *.debhelper files --- heartbeat-2.99.2+sles11r9.orig/debian/ldirectord.postrm +++ heartbeat-2.99.2+sles11r9/debian/ldirectord.postrm @@ -0,0 +1,38 @@ +#! /bin/sh +# +# License: GNU General Public License (GPL) +# +# postrm script for ldirectord +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see /usr/doc/packaging-manual/ + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + update-rc.d -f ldirectord remove >/dev/null + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 0 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + + --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-dev.install +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-dev.install @@ -1,3 +1,38 @@ -usr/include -usr/lib/*.a -usr/lib/*.so +usr/lib/heartbeat/plugins/HBauth/crc.a +usr/lib/heartbeat/plugins/HBauth/crc.la +usr/lib/heartbeat/plugins/HBauth/md5.a +usr/lib/heartbeat/plugins/HBauth/md5.la +usr/lib/heartbeat/plugins/HBauth/sha1.a +usr/lib/heartbeat/plugins/HBauth/sha1.la +usr/lib/heartbeat/plugins/HBcomm/bcast.a +usr/lib/heartbeat/plugins/HBcomm/bcast.la +usr/lib/heartbeat/plugins/HBcomm/mcast.a +usr/lib/heartbeat/plugins/HBcomm/mcast.la +usr/lib/heartbeat/plugins/HBcomm/ping.a +usr/lib/heartbeat/plugins/HBcomm/ping.la +usr/lib/heartbeat/plugins/HBcomm/ping6.a +usr/lib/heartbeat/plugins/HBcomm/ping6.la +usr/lib/heartbeat/plugins/HBcomm/ping_group.a +usr/lib/heartbeat/plugins/HBcomm/ping_group.la +usr/lib/heartbeat/plugins/HBcomm/serial.a +usr/lib/heartbeat/plugins/HBcomm/serial.la +usr/lib/heartbeat/plugins/HBcomm/ucast.a +usr/lib/heartbeat/plugins/HBcomm/ucast.la +usr/lib/heartbeat/plugins/HBcompress/bz2.a +usr/lib/heartbeat/plugins/HBcompress/bz2.la +usr/lib/heartbeat/plugins/HBcompress/zlib.a +usr/lib/heartbeat/plugins/HBcompress/zlib.la +usr/lib/heartbeat/plugins/quorum/majority.a +usr/lib/heartbeat/plugins/quorum/majority.la +usr/lib/heartbeat/plugins/quorum/quorumd.a +usr/lib/heartbeat/plugins/quorum/quorumd.la +usr/lib/heartbeat/plugins/quorum/twonodes.a +usr/lib/heartbeat/plugins/quorum/twonodes.la +usr/lib/heartbeat/plugins/quorum/weight.a +usr/lib/heartbeat/plugins/quorum/weight.la +usr/lib/heartbeat/plugins/quorumd/2_0_8.a +usr/lib/heartbeat/plugins/quorumd/2_0_8.la +usr/lib/heartbeat/plugins/test/test.a +usr/lib/heartbeat/plugins/test/test.la +usr/lib/heartbeat/plugins/tiebreaker/twonodes.a +usr/lib/heartbeat/plugins/tiebreaker/twonodes.la --- heartbeat-2.99.2+sles11r9.orig/debian/ldirectord.init +++ heartbeat-2.99.2+sles11r9/debian/ldirectord.init @@ -0,0 +1,35 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: ldirectord +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO +# +# Author: Horms +# +# Debian init script for ldirectord +# + +NAME=ldirectord +DAEMON="/usr/sbin/$NAME" +CONFIG="/etc/default/$NAME" + +test -x $DAEMON || exit 0 + +CONFIG_FILE="" +[ -f "$CONFIG" ] && . "$CONFIG" +CONFIG_FILE="${CONFIG_FILE:=ldirectord.cf}" + +case "$1" in + start|stop|restart|try-restart|status|reload|force-reload) + exec "$DAEMON" $1 + ;; + *) + echo "Usage: /etc/init.d/$NAME" \ + "{start|stop|restart|try-restart|status|reload|force-reload}" >&2 + exit 1 + ;; +esac --- heartbeat-2.99.2+sles11r9.orig/debian/libheartbeat2-dev.install +++ heartbeat-2.99.2+sles11r9/debian/libheartbeat2-dev.install @@ -0,0 +1,92 @@ +usr/include/clplumbing +usr/include/clplumbing/GSource.h +usr/include/clplumbing/GSource_internal.h +usr/include/clplumbing/Gmain_timeout.h +usr/include/clplumbing/apphb_cs.h +usr/include/clplumbing/base64.h +usr/include/clplumbing/cl_log.h +usr/include/clplumbing/cl_misc.h +usr/include/clplumbing/cl_pidfile.h +usr/include/clplumbing/cl_plugin.h +usr/include/clplumbing/cl_poll.h +usr/include/clplumbing/cl_quorum.h +usr/include/clplumbing/cl_quorumd.h +usr/include/clplumbing/cl_random.h +usr/include/clplumbing/cl_reboot.h +usr/include/clplumbing/cl_signal.h +usr/include/clplumbing/cl_syslog.h +usr/include/clplumbing/cl_tiebreaker.h +usr/include/clplumbing/cl_uuid.h +usr/include/clplumbing/coredumps.h +usr/include/clplumbing/cpulimits.h +usr/include/clplumbing/ipc.h +usr/include/clplumbing/loggingdaemon.h +usr/include/clplumbing/longclock.h +usr/include/clplumbing/lsb_exitcodes.h +usr/include/clplumbing/md5.h +usr/include/clplumbing/mkstemp_mode.h +usr/include/clplumbing/netstring.h +usr/include/clplumbing/proctrack.h +usr/include/clplumbing/realtime.h +usr/include/clplumbing/replytrack.h +usr/include/clplumbing/setproctitle.h +usr/include/clplumbing/timers.h +usr/include/clplumbing/uids.h +usr/include/heartbeat/HBauth.h +usr/include/heartbeat/HBcomm.h +usr/include/heartbeat/apphb.h +usr/include/heartbeat/apphb_notify.h +usr/include/heartbeat/compress.h +usr/include/heartbeat/ha_msg.h +usr/include/heartbeat/hb_api.h +usr/include/heartbeat/hb_config.h +usr/include/heartbeat/heartbeat.h +usr/include/heartbeat/lrm/lrm_api.h +usr/include/heartbeat/lrm/lrm_msg.h +usr/include/heartbeat/lrm/racommon.h +usr/include/heartbeat/lrm/raexec.h +usr/include/heartbeat/replace_uuid.h +usr/include/ocf/oc_event.h +usr/include/ocf/oc_membership.h +usr/include/pils/generic.h +usr/include/pils/interface.h +usr/include/pils/plugin.h +usr/include/saf/ais.h +usr/include/saf/ais_amf.h +usr/include/saf/ais_base.h +usr/include/saf/ais_checkpoint.h +usr/include/saf/ais_event.h +usr/include/saf/ais_lock.h +usr/include/saf/ais_membership.h +usr/include/saf/ais_message.h +usr/include/stonith/expect.h +usr/include/stonith/st_ttylock.h +usr/include/stonith/stonith.h +usr/include/stonith/stonith_plugin.h +usr/lib/libapphb.a +usr/lib/libapphb.la +usr/lib/libapphb.so +usr/lib/libccmclient.a +usr/lib/libccmclient.la +usr/lib/libccmclient.so +usr/lib/libclm.a +usr/lib/libclm.la +usr/lib/libclm.so +usr/lib/libhbclient.a +usr/lib/libhbclient.la +usr/lib/libhbclient.so +usr/lib/liblrm.a +usr/lib/liblrm.la +usr/lib/liblrm.so +usr/lib/libpils.a +usr/lib/libpils.la +usr/lib/libpils.so +usr/lib/libplumb.a +usr/lib/libplumb.la +usr/lib/libplumb.so +usr/lib/libplumbgpl.a +usr/lib/libplumbgpl.la +usr/lib/libplumbgpl.so +usr/lib/libstonith.a +usr/lib/libstonith.la +usr/lib/libstonith.so --- heartbeat-2.99.2+sles11r9.orig/debian/libheartbeat2.install +++ heartbeat-2.99.2+sles11r9/debian/libheartbeat2.install @@ -0,0 +1,18 @@ +usr/lib/libapphb.so.2 +usr/lib/libapphb.so.2.0.0 +usr/lib/libccmclient.so.1 +usr/lib/libccmclient.so.1.0.0 +usr/lib/libclm.so.1 +usr/lib/libclm.so.1.0.0 +usr/lib/libhbclient.so.1 +usr/lib/libhbclient.so.1.0.0 +usr/lib/liblrm.so.2 +usr/lib/liblrm.so.2.0.0 +usr/lib/libpils.so.2 +usr/lib/libpils.so.2.0.0 +usr/lib/libplumb.so.2 +usr/lib/libplumb.so.2.0.0 +usr/lib/libplumbgpl.so.2 +usr/lib/libplumbgpl.so.2.0.0 +usr/lib/libstonith.so.1 +usr/lib/libstonith.so.1.0.0 --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat.install +++ heartbeat-2.99.2+sles11r9/debian/heartbeat.install @@ -1,79 +1,151 @@ -/etc/ha.d/* -/etc/heartbeat -/etc/logrotate.d/heartbeat -usr/bin/* -usr/lib/heartbeat/* -usr/lib/*.so.* -usr/lib/ocf/resource.d/heartbeat/.ocf-binaries -usr/lib/ocf/resource.d/heartbeat/.ocf-directories -usr/lib/ocf/resource.d/heartbeat/.ocf-returncodes -usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs -usr/lib/ocf/resource.d/heartbeat/AoEtarget -usr/lib/ocf/resource.d/heartbeat/AudibleAlarm -usr/lib/ocf/resource.d/heartbeat/ClusterMon -usr/lib/ocf/resource.d/heartbeat/Delay -usr/lib/ocf/resource.d/heartbeat/Dummy -usr/lib/ocf/resource.d/heartbeat/EvmsSCC -usr/lib/ocf/resource.d/heartbeat/Evmsd -usr/lib/ocf/resource.d/heartbeat/Filesystem -usr/lib/ocf/resource.d/heartbeat/ICP -usr/lib/ocf/resource.d/heartbeat/IP* -usr/lib/ocf/resource.d/heartbeat/LVM -usr/lib/ocf/resource.d/heartbeat/LinuxSCSI -usr/lib/ocf/resource.d/heartbeat/MailTo -usr/lib/ocf/resource.d/heartbeat/ManageRAID -usr/lib/ocf/resource.d/heartbeat/ManageVE -usr/lib/ocf/resource.d/heartbeat/Pure-FTPd -usr/lib/ocf/resource.d/heartbeat/Raid1 -usr/lib/ocf/resource.d/heartbeat/Route -usr/lib/ocf/resource.d/heartbeat/SAPDatabase -usr/lib/ocf/resource.d/heartbeat/SAPInstance -usr/lib/ocf/resource.d/heartbeat/SendArp -usr/lib/ocf/resource.d/heartbeat/ServeRAID -usr/lib/ocf/resource.d/heartbeat/SphinxSearchDaemon -usr/lib/ocf/resource.d/heartbeat/Squid -usr/lib/ocf/resource.d/heartbeat/Stateful -usr/lib/ocf/resource.d/heartbeat/SysInfo -usr/lib/ocf/resource.d/heartbeat/VIPArip -usr/lib/ocf/resource.d/heartbeat/VirtualDomain -usr/lib/ocf/resource.d/heartbeat/WAS -usr/lib/ocf/resource.d/heartbeat/WAS6 -usr/lib/ocf/resource.d/heartbeat/WinPopup -usr/lib/ocf/resource.d/heartbeat/Xen -usr/lib/ocf/resource.d/heartbeat/Xinetd -usr/lib/ocf/resource.d/heartbeat/apache -usr/lib/ocf/resource.d/heartbeat/db2 -usr/lib/ocf/resource.d/heartbeat/drbd -usr/lib/ocf/resource.d/heartbeat/eDir88 -usr/lib/ocf/resource.d/heartbeat/ids -usr/lib/ocf/resource.d/heartbeat/iscsi -usr/lib/ocf/resource.d/heartbeat/mysql -usr/lib/ocf/resource.d/heartbeat/nfsserver -usr/lib/ocf/resource.d/heartbeat/oracle -usr/lib/ocf/resource.d/heartbeat/oralsnr -usr/lib/ocf/resource.d/heartbeat/pgsql -usr/lib/ocf/resource.d/heartbeat/pingd -usr/lib/ocf/resource.d/heartbeat/portblock -usr/lib/ocf/resource.d/heartbeat/rsyncd -usr/lib/ocf/resource.d/heartbeat/scsi2reservation -usr/lib/ocf/resource.d/heartbeat/sfex -usr/lib/ocf/resource.d/heartbeat/tomcat -usr/lib/ocf/resource.d/heartbeat/vmware -usr/lib/pils/* -usr/lib/stonith/* -usr/sbin/ha_logger -usr/sbin/hb_report -usr/sbin/lrmadmin +etc/heartbeat +etc/ha.d/README.config +etc/ha.d/harc +etc/ha.d/rc.d/ask_resources +etc/ha.d/rc.d/hb_takeover +etc/ha.d/rc.d/ip-request +etc/ha.d/rc.d/ip-request-resp +etc/ha.d/rc.d/status +etc/logrotate.d/heartbeat +etc/init.d/heartbeat +usr/bin/cl_respawn +usr/bin/cl_status +usr/lib/heartbeat/BasicSanityCheck +usr/lib/heartbeat/ResourceManager +usr/lib/heartbeat/TestHeartbeatComm +usr/lib/heartbeat/api_test +usr/lib/heartbeat/apphbd +usr/lib/heartbeat/apphbtest +usr/lib/heartbeat/base64_md5_test +usr/lib/heartbeat/ccm +usr/lib/heartbeat/ccm_testclient +usr/lib/heartbeat/clmtest +usr/lib/heartbeat/cts +usr/lib/heartbeat/dopd +usr/lib/heartbeat/drbd-peer-outdater +usr/lib/heartbeat/ha_cf_support.sh +usr/lib/heartbeat/ha_config +usr/lib/heartbeat/ha_propagate +usr/lib/heartbeat/hb_addnode +usr/lib/heartbeat/hb_delnode +usr/lib/heartbeat/hb_setsite +usr/lib/heartbeat/hb_setweight +usr/lib/heartbeat/hb_standby +usr/lib/heartbeat/hb_takeover +usr/lib/heartbeat/heartbeat +usr/lib/heartbeat/ipctest +usr/lib/heartbeat/ipctransientclient +usr/lib/heartbeat/ipctransientserver +usr/lib/heartbeat/ipfail +usr/lib/heartbeat/logtest +usr/lib/heartbeat/mach_down +usr/lib/heartbeat/mlock +usr/lib/heartbeat/ocf-returncodes +usr/lib/heartbeat/ocf-shellfuncs +usr/lib/heartbeat/plugins/HBauth/crc.so +usr/lib/heartbeat/plugins/HBauth/md5.so +usr/lib/heartbeat/plugins/HBauth/sha1.so +usr/lib/heartbeat/plugins/HBcomm/bcast.so +usr/lib/heartbeat/plugins/HBcomm/mcast.so +usr/lib/heartbeat/plugins/HBcomm/ping.so +usr/lib/heartbeat/plugins/HBcomm/ping6.so +usr/lib/heartbeat/plugins/HBcomm/ping_group.so +usr/lib/heartbeat/plugins/HBcomm/serial.so +usr/lib/heartbeat/plugins/HBcomm/ucast.so +usr/lib/heartbeat/plugins/HBcompress/bz2.so +usr/lib/heartbeat/plugins/HBcompress/zlib.so +usr/lib/heartbeat/plugins/quorum/majority.so +usr/lib/heartbeat/plugins/quorum/quorumd.so +usr/lib/heartbeat/plugins/quorum/twonodes.so +usr/lib/heartbeat/plugins/quorum/weight.so +usr/lib/heartbeat/plugins/quorumd/2_0_8.so +usr/lib/heartbeat/plugins/test/test.so +usr/lib/heartbeat/plugins/tiebreaker/twonodes.so +usr/lib/heartbeat/quorumd +usr/lib/heartbeat/quorumdtest +usr/lib/heartbeat/sfex_daemon +usr/lib/heartbeat/transient-test.sh usr/sbin/meatclient -usr/sbin/ocf-tester -usr/sbin/stonith usr/sbin/sbd usr/sbin/sfex_init +usr/share/doc/heartbeat/AUTHORS +usr/share/doc/heartbeat/ChangeLog +usr/share/doc/heartbeat/DirectoryMap.txt +usr/share/doc/heartbeat/GettingStarted.html +usr/share/doc/heartbeat/GettingStarted.txt +usr/share/doc/heartbeat/HardwareGuide.html +usr/share/doc/heartbeat/HardwareGuide.txt +usr/share/doc/heartbeat/README* +usr/share/doc/heartbeat/Requirements.html +usr/share/doc/heartbeat/Requirements.txt +usr/share/doc/heartbeat/apphbd.cf +usr/share/doc/heartbeat/authkeys +usr/share/doc/heartbeat/faqntips.html +usr/share/doc/heartbeat/faqntips.txt +usr/share/doc/heartbeat/ha.cf +usr/share/doc/heartbeat/haresources +usr/share/doc/heartbeat/hb_report.html +usr/share/doc/heartbeat/hb_report.txt +usr/share/doc/heartbeat/heartbeat_api.html +usr/share/doc/heartbeat/heartbeat_api.txt +usr/share/doc/heartbeat/logd.cf +usr/share/doc/heartbeat/rsync.html +usr/share/doc/heartbeat/rsync.txt +usr/share/doc/heartbeat/startstop +usr/share/heartbeat/BasicSanityCheck +usr/share/heartbeat/ResourceManager +usr/share/heartbeat/TestHeartbeatComm +usr/share/heartbeat/cts/CIB.py +usr/share/heartbeat/cts/CIB.pyc +usr/share/heartbeat/cts/CIB.pyo +usr/share/heartbeat/cts/CM_LinuxHAv2.py +usr/share/heartbeat/cts/CM_LinuxHAv2.pyc +usr/share/heartbeat/cts/CM_LinuxHAv2.pyo +usr/share/heartbeat/cts/CM_fs.py +usr/share/heartbeat/cts/CM_fs.pyc +usr/share/heartbeat/cts/CM_fs.pyo +usr/share/heartbeat/cts/CM_hb.py +usr/share/heartbeat/cts/CM_hb.pyc +usr/share/heartbeat/cts/CM_hb.pyo +usr/share/heartbeat/cts/CTS.py +usr/share/heartbeat/cts/CTS.pyc +usr/share/heartbeat/cts/CTS.pyo +usr/share/heartbeat/cts/CTSaudits.py +usr/share/heartbeat/cts/CTSaudits.pyc +usr/share/heartbeat/cts/CTSaudits.pyo +usr/share/heartbeat/cts/CTSlab.py +usr/share/heartbeat/cts/CTSlab.pyc +usr/share/heartbeat/cts/CTSlab.pyo +usr/share/heartbeat/cts/CTSproxy.py +usr/share/heartbeat/cts/CTStests.py +usr/share/heartbeat/cts/CTStests.pyc +usr/share/heartbeat/cts/CTStests.pyo +usr/share/heartbeat/cts/LSBDummy +usr/share/heartbeat/cts/OCFIPraTest.py +usr/share/heartbeat/cts/OCFIPraTest.pyc +usr/share/heartbeat/cts/OCFIPraTest.pyo +usr/share/doc/heartbeat/README.cts +usr/share/heartbeat/cts/extracttests.py +usr/share/heartbeat/cts/extracttests.pyc +usr/share/heartbeat/cts/extracttests.pyo +usr/share/heartbeat/cts/getpeinputs.sh +usr/share/heartbeat/ha_config +usr/share/heartbeat/ha_propagate +usr/share/heartbeat/hb_addnode +usr/share/heartbeat/hb_delnode +usr/share/heartbeat/hb_setsite +usr/share/heartbeat/hb_setweight +usr/share/heartbeat/hb_standby +usr/share/heartbeat/hb_takeover +usr/share/heartbeat/mach_down +usr/share/heartbeat/req_resource +usr/share/man/man1/cl_status.1.gz +usr/share/man/man1/hb_addnode.1.gz +usr/share/man/man1/hb_delnode.1.gz +usr/share/man/man1/hb_standby.1.gz +usr/share/man/man1/hb_takeover.1.gz +usr/share/man/man8/apphbd.8.gz +usr/share/man/man8/heartbeat.8.gz +usr/share/man/man8/meatclient.8.gz +var/lib/heartbeat/cores usr/share/doc/heartbeat/* -usr/share/heartbeat/* -usr/share/man/man1/* -usr/share/man/man8/apphbd.8 -usr/share/man/man8/ha_logd.8 -usr/share/man/man8/heartbeat.8 -usr/share/man/man8/meatclient.8 -usr/share/man/man8/stonith.8 --- heartbeat-2.99.2+sles11r9.orig/debian/ldirectord.install +++ heartbeat-2.99.2+sles11r9/debian/ldirectord.install @@ -1,6 +1,8 @@ +/etc/default/ldirectord /etc/ha.d/resource.d/ldirectord +/etc/init.d/ldirectord /etc/logrotate.d/ldirectord usr/lib/ocf/resource.d/heartbeat/ldirectord usr/sbin/ldirectord usr/share/doc/ldirectord/ldirectord.cf -usr/share/man/man8/ldirectord.8 +usr/share/man/man8/ldirectord.8.gz --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-dev.dirs +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-dev.dirs @@ -1 +1,7 @@ -usr/include +usr/include/clplumbing +usr/include/heartbeat +usr/include/linux-ha +usr/include/ocf +usr/include/pils +usr/include/saf +usr/include/stonith --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-common-dev.install +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-common-dev.install @@ -0,0 +1,45 @@ +usr/lib/heartbeat/plugins/RAExec/heartbeat.a +usr/lib/heartbeat/plugins/RAExec/heartbeat.la +usr/lib/heartbeat/plugins/RAExec/lsb.a +usr/lib/heartbeat/plugins/RAExec/lsb.la +usr/lib/heartbeat/plugins/RAExec/ocf.a +usr/lib/heartbeat/plugins/RAExec/ocf.la +usr/lib/pils/plugins/InterfaceMgr/generic.a +usr/lib/pils/plugins/InterfaceMgr/generic.la +usr/lib/stonith/plugins/stonith2/apcmaster.a +usr/lib/stonith/plugins/stonith2/apcmaster.la +usr/lib/stonith/plugins/stonith2/apcmastersnmp.a +usr/lib/stonith/plugins/stonith2/apcmastersnmp.la +usr/lib/stonith/plugins/stonith2/apcsmart.a +usr/lib/stonith/plugins/stonith2/apcsmart.la +usr/lib/stonith/plugins/stonith2/baytech.a +usr/lib/stonith/plugins/stonith2/baytech.la +usr/lib/stonith/plugins/stonith2/bladehpi.a +usr/lib/stonith/plugins/stonith2/bladehpi.la +usr/lib/stonith/plugins/stonith2/cyclades.a +usr/lib/stonith/plugins/stonith2/cyclades.la +usr/lib/stonith/plugins/stonith2/drac3.a +usr/lib/stonith/plugins/stonith2/drac3.la +usr/lib/stonith/plugins/stonith2/external.a +usr/lib/stonith/plugins/stonith2/external.la +usr/lib/stonith/plugins/stonith2/ibmhmc.a +usr/lib/stonith/plugins/stonith2/ibmhmc.la +usr/lib/stonith/plugins/stonith2/ipmilan.a +usr/lib/stonith/plugins/stonith2/ipmilan.la +usr/lib/stonith/plugins/stonith2/meatware.a +usr/lib/stonith/plugins/stonith2/meatware.la +usr/lib/stonith/plugins/stonith2/null.a +usr/lib/stonith/plugins/stonith2/null.la +usr/lib/stonith/plugins/stonith2/nw_rpc100s.a +usr/lib/stonith/plugins/stonith2/nw_rpc100s.la +usr/lib/stonith/plugins/stonith2/rcd_serial.a +usr/lib/stonith/plugins/stonith2/rcd_serial.la +usr/lib/stonith/plugins/stonith2/ribcl.py +usr/lib/stonith/plugins/stonith2/rps10.a +usr/lib/stonith/plugins/stonith2/rps10.la +usr/lib/stonith/plugins/stonith2/ssh.a +usr/lib/stonith/plugins/stonith2/ssh.la +usr/lib/stonith/plugins/stonith2/suicide.a +usr/lib/stonith/plugins/stonith2/suicide.la +usr/lib/stonith/plugins/stonith2/wti_nps.a +usr/lib/stonith/plugins/stonith2/wti_nps.la --- heartbeat-2.99.2+sles11r9.orig/debian/Makefile.in +++ heartbeat-2.99.2+sles11r9/debian/Makefile.in @@ -0,0 +1,511 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = debian +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h \ + $(top_builddir)/include/hb_config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALIGN = @ALIGN@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRM_DIR = @CRM_DIR@ +CRM_ENABLED = @CRM_ENABLED@ +CRYPTOLIB = @CRYPTOLIB@ +CURSESLIBS = @CURSESLIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISABLE_TIMES_KLUDGE = @DISABLE_TIMES_KLUDGE@ +DISTDIR = @DISTDIR@ +DISTRO_STYLE_RPMS = @DISTRO_STYLE_RPMS@ +DLOPEN_FORCE_FLAGS = @DLOPEN_FORCE_FLAGS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_CMD = @ECHO_CMD@ +ECHO_E = @ECHO_E@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETENT = @GETENT@ +GLIBHEAD = @GLIBHEAD@ +GLIBLIB = @GLIBLIB@ +GNUTLSHEAD = @GNUTLSHEAD@ +GNUTLSLIBS = @GNUTLSLIBS@ +GREP = @GREP@ +GZIP_PROG = @GZIP_PROG@ +HA_APIGID = @HA_APIGID@ +HA_APIGROUP = @HA_APIGROUP@ +HA_CCMUID = @HA_CCMUID@ +HA_CCMUSER = @HA_CCMUSER@ +HA_COREDIR = @HA_COREDIR@ +HA_DATADIR = @HA_DATADIR@ +HA_HBCONF_DIR = @HA_HBCONF_DIR@ +HA_LIBDIR = @HA_LIBDIR@ +HA_LIBHBDIR = @HA_LIBHBDIR@ +HA_LOGDAEMON_IPC = @HA_LOGDAEMON_IPC@ +HA_NOARCHDATAHBDIR = @HA_NOARCHDATAHBDIR@ +HA_PLUGIN_DIR = @HA_PLUGIN_DIR@ +HA_RC_DIR = @HA_RC_DIR@ +HA_URLBASE = @HA_URLBASE@ +HA_VARLIBDIR = @HA_VARLIBDIR@ +HA_VARLIBHBDIR = @HA_VARLIBHBDIR@ +HA_VARLOCKDIR = @HA_VARLOCKDIR@ +HA_VARLOGDIR = @HA_VARLOGDIR@ +HA_VARRUNDIR = @HA_VARRUNDIR@ +HA_VARRUNHBDIR = @HA_VARRUNHBDIR@ +HA_VARRUNHBRSCDIR = @HA_VARRUNHBRSCDIR@ +HB_INITSTARTPRI = @HB_INITSTARTPRI@ +HB_INITSTOPPRI = @HB_INITSTOPPRI@ +HB_PKG = @HB_PKG@ +HB_RA_DIR = @HB_RA_DIR@ +HG = @HG@ +HTML2TXT = @HTML2TXT@ +IFCONFIG = @IFCONFIG@ +IFCONFIG_A_OPT = @IFCONFIG_A_OPT@ +INCLTDL = @INCLTDL@ +INITDEFDIR = @INITDEFDIR@ +INITDIR = @INITDIR@ +INIT_EXT = @INIT_EXT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IP2UTIL = @IP2UTIL@ +IPCSOCKET_C = @IPCSOCKET_C@ +IPCSOCKET_LO = @IPCSOCKET_LO@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBADD_DL = @LIBADD_DL@ +LIBADD_INTL = @LIBADD_INTL@ +LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@ +LIBLTDL = @LIBLTDL@ +LIBLTDL_DIR = @LIBLTDL_DIR@ +LIBNETCONFIG = @LIBNETCONFIG@ +LIBNETDEFINES = @LIBNETDEFINES@ +LIBNETLIBS = @LIBNETLIBS@ +LIBOBJS = @LIBOBJS@ +LIBRT = @LIBRT@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE = @LOCALE@ +LOGD_INITSTARTPRI = @LOGD_INITSTARTPRI@ +LOGD_INITSTOPPRI = @LOGD_INITSTOPPRI@ +LRM_ENABLED = @LRM_ENABLED@ +LRM_PLUGIN_DIR = @LRM_PLUGIN_DIR@ +LSB_RA_DIR = @LSB_RA_DIR@ +LTDLDEPS = @LTDLDEPS@ +LTDLINCL = @LTDLINCL@ +LTLIBOBJS = @LTLIBOBJS@ +MAILCMD = @MAILCMD@ +MAKE = @MAKE@ +MAKEINFO = @MAKEINFO@ +MD5 = @MD5@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGHDR_TYPE = @MSGHDR_TYPE@ +NETSTAT = @NETSTAT@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NON_FATAL_CFLAGS = @NON_FATAL_CFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCF_RA_DIR = @OCF_RA_DIR@ +OCF_ROOT_DIR = @OCF_ROOT_DIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PILSPKG = @PILSPKG@ +PING = @PING@ +PING_TIMEOUT_OPT = @PING_TIMEOUT_OPT@ +PKGCONFIG = @PKGCONFIG@ +PKGNAME = @PKGNAME@ +POD2MAN = @POD2MAN@ +POWEROFF_CMD = @POWEROFF_CMD@ +POWEROFF_OPTIONS = @POWEROFF_OPTIONS@ +PRETTY_CC = @PRETTY_CC@ +PROCROUTE = @PROCROUTE@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +QUIET_LIBTOOL_OPTS = @QUIET_LIBTOOL_OPTS@ +QUIET_MAKE_OPTS = @QUIET_MAKE_OPTS@ +QUORUMD_ENABLED = @QUORUMD_ENABLED@ +RANLIB = @RANLIB@ +REAL_CC = @REAL_CC@ +REBOOT = @REBOOT@ +REBOOT_OPTIONS = @REBOOT_OPTIONS@ +ROUTE = @ROUTE@ +ROUTEPARM = @ROUTEPARM@ +RPM = @RPM@ +RPMREL = @RPMREL@ +RPMTARGET = @RPMTARGET@ +RPM_ENABLE_OPENHPI = @RPM_ENABLE_OPENHPI@ +SCP = @SCP@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SNMPCONFIG = @SNMPCONFIG@ +SNMPLIB = @SNMPLIB@ +SSH = @SSH@ +STONITHPKG = @STONITHPKG@ +STONITH_RA_DIR = @STONITH_RA_DIR@ +STRIP = @STRIP@ +SWIG = @SWIG@ +TAR = @TAR@ +TARFILE = @TARFILE@ +TEST = @TEST@ +TIPC_INCLUDE = @TIPC_INCLUDE@ +UCDSNMPDEVEL = @UCDSNMPDEVEL@ +USE_MODULES = @USE_MODULES@ +VALGRIND_BIN = @VALGRIND_BIN@ +VERSION = @VERSION@ +WHOAMI = @WHOAMI@ +XML2CONFIG = @XML2CONFIG@ +XPERIMENTALDIRS = @XPERIMENTALDIRS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +base_includedir = @base_includedir@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cleaned_configure_args = @cleaned_configure_args@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +hb_libdir = @hb_libdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pils_includedir = @pils_includedir@ +pils_plugindir = @pils_plugindir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +saf_includedir = @saf_includedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +stdocdir = @stdocdir@ +stonith_ext_plugindir = @stonith_ext_plugindir@ +stonith_includedir = @stonith_includedir@ +stonith_plugindir = @stonith_plugindir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# +# linux-ha: Linux-HA heartbeat code +# +# Copyright (C) 2001 Michael Moerz +# This instance created by Horms +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = changelog compat control copyright \ + dpkg-checkbuild rules \ + heartbeat.dirs heartbeat.files \ + heartbeat.postinst heartbeat.postrm \ + heartbeat.preinst \ + heartbeat-dev.dirs heartbeat-dev.files \ + heartbeat-gui.dirs heartbeat-gui.files \ + heartbeat-2.prerm \ + ldirectord.files ldirectord.postinst \ + ldirectord.postrm + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu debian/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu debian/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + + +clean-local: + rm -f *.substvars *.debhelper files + rm -r -f heartbeat heartbeat-dev ldirectord \ + libpils0 libpils-dev libstonith0 libstonith-dev stonith tmp +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat.postinst +++ heartbeat-2.99.2+sles11r9/debian/heartbeat.postinst @@ -32,15 +32,10 @@ --disabled-password hacluster > /dev/null fi - # - #fifo (0600, root, root) - # - rm -f /var/lib/heartbeat/fifo - mknod -m 0600 /var/lib/heartbeat/fifo p - for i in /var/lib/heartbeat/ccm /var/lib/heartbeat/crm \ /var/run/heartbeat/ccm /var/run/heartbeat/crm \ /var/lib/heartbeat/pengine; do + mkdir -p $i chmod 750 $i chown hacluster $i chgrp haclient $i @@ -63,22 +58,18 @@ . /usr/share/debconf/confmodule db_get heartbeat/change_init || RET="false" if [ "$RET" = "true" ]; then - /usr/sbin/update-rc.d -f heartbeat remove > /dev/null - /usr/sbin/update-rc.d -f logd remove > /dev/null + update-rc.d -f heartbeat remove > /dev/null fi db_stop fi fi update-rc.d heartbeat start 75 2 3 4 5 . stop 05 0 1 6 . >/dev/null || true - update-rc.d logd start 11 2 3 4 5 . stop 89 0 1 6 . >/dev/null || true ldconfig if which invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d logd start || true invoke-rc.d heartbeat start || true else - /etc/init.d/logd start || true /etc/init.d/heartbeat start || true fi ;; @@ -86,10 +77,8 @@ abort-upgrade|abort-remove|abort-deconfigure) # restart heartbeat if which invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d logd start || true invoke-rc.d heartbeat start || true else - /etc/init.d/logd start || true /etc/init.d/heartbeat start || true fi ;; --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-common.logd.init +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-common.logd.init @@ -0,0 +1,234 @@ +#!/bin/sh +# +# +# logd Start logd (non-blocking log service) +# +# Author: Dejan Muhamedagic +# (After the heartbeat init script) +# License: GNU General Public License (GPL) +# +# This script works correctly under SuSE, Debian, +# Conectiva, Red Hat and a few others. Please let me know if it +# doesn't work under your distribution, and we'll fix it. +# We don't hate anyone, and like for everyone to use +# our software, no matter what OS or distribution you're using. +# +# chkconfig: 2345 10 75 +# description: Startup script logd service. +# processname: ha_logd +# pidfile: /var/run/logd.pid +# config: /etc/logd.cf +# +### BEGIN INIT INFO +# Description: ha_logd is a non-blocking logging daemon. +# It can log messages either to a file or through syslog +# daemon. +# Short-Description: ha_logd logging daemon +# Provides: ha_logd +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# X-Start-Before: heartbeat openais +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +[ -f /etc/default/heartbeat ] && . /etc/default/heartbeat + +: ${USE_LOGD=yes} +LOGD_OPT="" +[ -n "$LOGD_CFG" ] && LOGD_OPT="$LOGD_OPT -c $LOGD_CFG" + +HA_DIR=/etc/ha.d; export HA_DIR +. $HA_DIR/shellfuncs + +LOCKDIR=/var/lock/subsys +RUNDIR=/var/run + + +# Echo without putting a newline on the end +EchoNoNl() { + Echo "$@" +} + +# Echo with escapes enabled... +EchoEsc() { + Echo "$@" +} + +echo_failure() { + EchoEsc " ha_logd failure [rc=$1]. $rc_failed" + return $1 +} + +echo_success() { + : Cool! It started! + EchoEsc "$rc_done" +} + +if + [ -r /etc/SuSE-release ] +then + # rc.status is new since SuSE 7.0 + [ -r /etc/rc.status ] && . /etc/rc.status + [ -r /etc/rc.config ] && . /etc/rc.config + + # Determine the base and follow a runlevel link name. + base=${0##*/} + link=${base#*[SK][0-9][0-9]} + +fi +if + [ -z "$rc_done" ] +then + rc_done="Done." + rc_failed="Failed." + rc_skipped="Skipped." +fi + + +# exec 2>>/var/log/ha-debug + +# This should probably be it's own autoconf parameter +# because RH has moved it from time to time... +# and I suspect Conectiva and Mandrake also supply it. + +DISTFUNCS=/etc/rc.d/init.d/functions +SUBSYS=ha_logd + +[ -x $HA_BIN/ha_logd ] || exit 0 + +# +# Some environments like it if we use their functions... +# +if + [ ! -x $DISTFUNCS ] +then + # Provide our own versions of these functions + status() { + $HA_BIN/ha_logd -s + } + echo_failure() { + EchoEsc " ha_logd failure [rc=$1]. $rc_failed" + return $1 + } + echo_success() { + : Cool! It started! + EchoEsc "$rc_done" + } +else + . $DISTFUNCS +fi + +# +# See if they've configured things yet... +# +if + [ ! -f $LOGD_CFG ] +then + EchoNoNl "ha_logd not configured: $LOGD_CFG not found." + echo_failure 1 + exit 0 +fi + +StartLogd() { + if [ "$USE_LOGD" != "yes" ]; then + return 0 + fi + + EchoNoNl "Starting ha_logd: " + + $HA_BIN/ha_logd -s >/dev/null 2>&1 + + if + [ $? -eq 0 ] + then + Echo "logd is already running" + return 0 + fi + + + $HA_BIN/ha_logd -d $LOGD_OPT >/dev/null 2>&1 + if + [ $? -ne 0 ] + then + Echo "starting logd failed" + fi + +} + +StopLogd() { + if [ "$USE_LOGD" != "yes" ]; then + return 0 + fi + + EchoNoNl "Stopping ha_logd: " + + $HA_BIN/ha_logd -s >/dev/null 2>&1 + + if + [ $? -ne 0 ] + then + Echo "logd is already stopped" + return 0 + fi + + $HA_BIN/ha_logd -k >/dev/null 2>&1 + if + [ $? -ne 0 ] + then + Echo "stopping logd failed" + fi +} + +StatusLogd() { + $HA_BIN/ha_logd -s +} + +RC=0 +# See how we were called. + +case "$1" in + start) + StartLogd + RC=$? + Echo + if + [ $RC -eq 0 ] + then + [ ! -d $LOCKDIR ] && mkdir -p $LOCKDIR + touch $LOCKDIR/$SUBSYS + fi + ;; + + status) + StatusLogd + RC=$?;; + + stop) + StopLogd + RC=$? + Echo + if + [ $RC -eq 0 ] + then + rm -f $LOCKDIR/$SUBSYS + fi + ;; + + restart|reload|force-reload) + sleeptime=1 + StopLogd + sleep $sleeptime + echo_success + Echo + StartLogd + Echo + ;; + + *) + Echo "Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit $RC + --- heartbeat-2.99.2+sles11r9.orig/debian/copyright +++ heartbeat-2.99.2+sles11r9/debian/copyright @@ -23,13 +23,13 @@ Andrew Beekhof Cluster Resource Manager Darwin Cleanups - Stéphane Billiart - unicast support + Stéphane Billiart - unicast support Gregor Binder - "meatware" STONITH support Juan Pedro Paredes Caballero - Debian support Dusan Djordjevic - documentation Kevin Dwyer - ipfail, bug fixes. Joachim Gleissner ssh STONITH support - Luis Claudio R. Gonçalves + Luis Claudio R. Gonçalves nice_failback code, hb_standby code, fixes Thomas Hepper solaris and Debian support @@ -46,7 +46,7 @@ Xiaoxiang Liu interprocess communication library Friedrich Lobenstock - SuSE compatibility fixes - Lars Marowsky-Brée + Lars Marowsky-Brée LVM, ICP and ssh STONITH support, many fixes SuSE package maintainer STABLE_1_0 / 1.0.x release maintenance @@ -69,7 +69,7 @@ Mike Tilstra - VACM support Marcelo Tosatti API support, initial plugin support - Iñaki Fernández Villanueva - debian support + Iñaki Fernández Villanueva - debian support Todd Wheeling APC master switch and WTI [WT]PS-xxx support Volker Wiegand --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-gui.install +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-gui.install @@ -0,0 +1,26 @@ +usr/bin/hb_gui +usr/lib/heartbeat-gui/_pymgmt.so +usr/lib/heartbeat-gui/_pymgmt.so.0 +usr/lib/heartbeat-gui/_pymgmt.so.0.0.0 +usr/lib/heartbeat-gui/haclient.py +usr/lib/heartbeat-gui/pymgmt.py +usr/share/heartbeat-gui/active-node.png +usr/share/heartbeat-gui/add-resource.png +usr/share/heartbeat-gui/cleanup-resource.png +usr/share/heartbeat-gui/default-resource.png +usr/share/heartbeat-gui/down-resource.png +usr/share/heartbeat-gui/exit.png +usr/share/heartbeat-gui/ha.png +usr/share/heartbeat-gui/haclient.glade +usr/share/heartbeat-gui/haclient.py +usr/share/heartbeat-gui/login.png +usr/share/heartbeat-gui/logout.png +usr/share/heartbeat-gui/master-resource.png +usr/share/heartbeat-gui/mgmtcmd.py +usr/share/heartbeat-gui/remove-resource.png +usr/share/heartbeat-gui/slave-resource.png +usr/share/heartbeat-gui/standby-node.png +usr/share/heartbeat-gui/start-resource.png +usr/share/heartbeat-gui/stop-resource.png +usr/share/heartbeat-gui/up-resource.png +usr/share/locale/zh_CN/LC_MESSAGES/haclient.mo --- heartbeat-2.99.2+sles11r9.orig/debian/rules +++ heartbeat-2.99.2+sles11r9/debian/rules @@ -9,9 +9,11 @@ #export DH_VERBOSE=1 cfg:=--prefix=/usr --sysconfdir=/etc --localstatedir=/var \ - --mandir=/usr/share/man \ + --mandir=/usr/share/man --disable-crm \ --with-group-name=haclient --with-ccmuser-name=hacluster \ - --disable-fatal-warnings + --enable-snmp-subagent --with-mibsdir=/usr/share/snmp/mibs \ + --disable-fatal-warnings --enable-mgmt --enable-libc-malloc \ + --enable-quorumd # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) @@ -36,26 +38,33 @@ build: checkbuild build-stamp build-stamp: dh_testdir - # Allow debian packages to also be built directly from Hg archives - # Official debian packages are built from dist tarballs - test ! -e ./configure || ./configure $(cfg) - test -e ./configure || ./bootstrap $(cfg) + # Only boostrap as neccessary + if test -e ./configure -a ! -x ./configure; then \ + chmod u+x ./configure; \ + fi + if test -e ./py-compile -a ! -x ./py-compile; then \ + chmod u+x ./py-compile; \ + fi + test ! -x ./configure || ./configure $(cfg); + test -x ./configure || ./bootstrap $(cfg) $(MAKE) touch build-stamp clean: dh_testdir dh_testroot - dh_clean - rm -f build-stamp install-stamp - rm -f debian/heartbeat.init debian/heartbeat.logd.init debian/ldirectord.init \ - debian/ldirectord.default - # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) clean [ ! -f Makefile ] || $(MAKE) distclean rm -f tools/ccdv - find . -name '*.py[co]' | xargs rm -f + -find . -name '*.py[co]' | xargs rm -f + dh_clean build-stamp install-stamp + rm -f libltdl.tar autoconf automake autoheader + rm -f debian/init debian/*.debhelper debian/*.substvars config.log + rm -r -f debian/heartbeat debian/heartbeat-dev debian/ldirectord \ + debian/libpils0 debian/libpils-dev \ + debian/libstonith0 debian/libstonith-dev debian/stonith \ + debian/tmp # Zero autoconf foo rm -f config.status libltdl/config.log libltdl/config.status @@ -66,56 +75,73 @@ dh_testdir dh_testroot dh_clean -k - + dh_installdirs $(MAKE) install DESTDIR=$(DTMP) \ + MAKE=make \ docdir=/usr/share/doc/heartbeat - # rename files mv $(DTMP)/usr/share/heartbeat/cts/README \ $(DTMP)/usr/share/doc/heartbeat/README.cts mv $(DTMP)/usr/share/heartbeat/lrmtest/README.regression \ $(DTMP)/usr/share/doc/heartbeat/README.lrm_regression_tests - - # install debian inits & defaults + find $(DTMP)/usr/share/man -type f | xargs gzip -v --best install -c -m 755 heartbeat/init.d/heartbeat \ - debian/heartbeat.init - install -c -m 755 heartbeat/init.d/logd \ - debian/heartbeat.logd.init - install -c -m 755 ldirectord/init.d/ldirectord.debian \ - debian/ldirectord.init - install -c -m 755 ldirectord/init.d/ldirectord.debian.default \ - debian/ldirectord.default - - # cleanup unpackaged stuff - rm -rf $(DTMP)/etc/init.d - find $(DTMP)/usr/lib/heartbeat/ -name *.a -exec rm {} \; - find $(DTMP)/usr/lib/pils/ -name *.a -exec rm {} \; - find $(DTMP)/usr/lib/stonith/ -name *.a -exec rm {} \; - find $(DTMP)/usr/lib -name *.la -exec rm {} \; - find $(DTMP)/usr/share/heartbeat/cts -name *.py[co] -exec rm {} \; - - # missing file... + $(DTMP)/etc/init.d/heartbeat -mkdir -p $(DTMP)/usr/share/doc/ldirectord/ install -c -m 644 ldirectord/ldirectord.cf \ $(DTMP)/usr/share/doc/ldirectord/ - + -mkdir -p $(DTMP)/etc/init.d + install -c -m 755 ldirectord/init.d/ldirectord.debian \ + $(DTMP)/etc/init.d/ldirectord + -mkdir -p $(DTMP)/etc/default/ + install -c -m 755 ldirectord/init.d/ldirectord.debian.default \ + $(DTMP)/etc/default/ldirectord cd $(DTMP)/etc/ && ln -s ha.d heartbeat - dh_installdirs - dh_install --source=$(DTMP) --list-missing + # remove more useless COPYING files + rm -rf `pwd`/debian/tmp/usr/share/doc/heartbeat/COPYING* - # cleanup to keep install files simple - rm debian/heartbeat/etc/ha.d/resource.d/ldirectord + dh_install --source=debian/tmp --fail-missing + + # move documentation stuff to the right directory + #mkdir -p `pwd`/debian/heartbeat/usr/share/doc/heartbeat/ + #mv `pwd`/debian/heartbeat/usr/share/doc/packages/heartbeat/* `pwd`/debian/heartbeat/usr/share/doc/heartbeat/ + #rm -rf `pwd`/debian/heartbeat/usr/share/doc/packages/heartbeat/ + + # remove unnecessary directories + rm -rf `pwd`/debian/heartbeat-dev/usr/include/ + rm -rf `pwd`/debian/heartbeat-common-dev/usr/lib/stonith/plugins/stonith2/ribcl.py + + rm -rf `pwd`/debian/heartbeat/etc/ha.d/conf + rm -rf `pwd`/debian/heartbeat/etc/ha.d/cts + rm -rf `pwd`/debian/heartbeat/usr/lib/stonith + rm -rf `pwd`/debian/heartbeat/usr/lib/pils + rm -rf `pwd`/debian/heartbeat/usr/include/ + rm -rf `pwd`/debian/heartbeat/usr/lib/heartbeat/plugins/AppHBNotification/ + + rm -rf `pwd`/debian/heartbeat-common/usr/lib/ocf/resource.d/heartbeat/ldirectord binary-indep: build install + dh_testdir -i dh_testroot -i - dh_installinit --name logd -i -u"start 11 2 3 4 5 ." - dh_installinit -i -u 'defaults 20 32' + dh_installdebconf -i + dh_installdocs -i + dh_installexamples -i +# dh_installmenu -i +# dh_installemacsen -i +# dh_installpam -i + dh_installinit -i -n -u 'defaults 20 32' +# dh_installcron -i + dh_installman -i +# dh_installinfo -i +# dh_undocumented -i dh_installchangelogs -i + dh_link -i dh_strip -i dh_compress -i dh_fixperms -i +# dh_suidregister -i dh_makeshlibs -i -V dh_installdeb -i dh_perl -i @@ -127,27 +153,58 @@ dh_builddeb -i binary-arch: build install + + # remove duplicate doc file + rm -rf `pwd`/debian/heartbeat/usr/share/doc/heartbeat/README.lrm_regression_tests + dh_testdir -a dh_testroot -a - dh_installinit --name logd -a -u"start 11 2 3 4 5 ." - dh_installinit -a -u 'defaults 20 32' + dh_installdebconf -a + dh_installdocs -a + dh_installexamples -a +# dh_installmenu -a +# dh_installemacsen -a +# dh_installpam -a + dh_installinit -a -n -u 'defaults 20 32' + dh_installinit --name=logd -pheartbeat-common -u 'defaults 20 32' +# dh_installcron -a + dh_installman -a +# dh_installinfo -a +# dh_undocumented -a dh_installchangelogs -a `pwd`/doc/ChangeLog + dh_link -a dh_strip -a dh_compress -a - dh_fixperms -a --exclude usr/bin/cl_status + dh_fixperms -a + + # remove redundant license files + rm -rf `pwd`/debian/heartbeat/usr/share/doc/heartbeat/COPYING.* + rm -rf `pwd`/debian/heartbeat-common/usr/share/doc/heartbeat/COPYING.gz + + # remove executable bits + chmod -x `pwd`/debian/heartbeat/usr/lib/heartbeat/ocf-returncodes \ + `pwd`/debian/heartbeat-common/usr/share/heartbeat/ra-api-1.dtd \ + `pwd`/debian/heartbeat/usr/lib/heartbeat/ocf-shellfuncs \ + `pwd`/debian/heartbeat-common/usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs \ + `pwd`/debian/heartbeat-common/usr/lib/ocf/resource.d/heartbeat/.ocf-returncodes \ + `pwd`/debian/heartbeat-common/usr/lib/ocf/resource.d/heartbeat/.ocf-binaries \ + `pwd`/debian/heartbeat-common/usr/lib/ocf/resource.d/heartbeat/.ocf-directories + + chmod -x `pwd`/debian/ldirectord/etc/default/ldirectord + dh_makeshlibs -a -V dh_installdeb -a dh_perl -a dh_pycentral -a dh_python -a `pwd`/usr/lib/heartbeat/cts `pwd`/usr/lib/heartbeat - dh_shlibdeps -a + dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch - -chmod u+x ./debian/check-uninstalled - -./debian/check-uninstalled +# @echo "Any unpackaged files follow (.a and .la files omitted):" +# @cd $(DTMP) && find ./ \! -type d | egrep -v \\\.l?a || true checkbuild: chmod u+x ./debian/dpkg-checkbuild --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat.dirs +++ heartbeat-2.99.2+sles11r9/debian/heartbeat.dirs @@ -1,25 +1,29 @@ +etc/ha.d etc/ha.d/conf etc/ha.d/cts etc/ha.d/rc.d etc/ha.d/resource.d etc/init.d -etc/logrotate.d +etc/logrotate.d/ +usr/include/pils +usr/lib/heartbeat usr/lib/heartbeat/plugins usr/lib/heartbeat/plugins/AppHBNotification usr/lib/heartbeat/plugins/HBauth usr/lib/heartbeat/plugins/HBcomm usr/lib/heartbeat/plugins/test +usr/lib/pils/plugins usr/lib/pils/plugins/InterfaceMgr +usr/lib/stonith/ usr/lib/stonith/plugins/ +var/lib/heartbeat var/lib/heartbeat/api var/lib/heartbeat/casual var/lib/heartbeat/ccm +var/lib/heartbeat/cores var/lib/heartbeat/cores/root var/lib/heartbeat/cores/nobody var/lib/heartbeat/cores/hacluster var/lib/heartbeat/crm var/lib/heartbeat/ckpt var/lib/heartbeat/pengine -var/lock/subsys -var/run/heartbeat/ccm -var/run/heartbeat/crm --- heartbeat-2.99.2+sles11r9.orig/debian/ldirectord.postinst +++ heartbeat-2.99.2+sles11r9/debian/ldirectord.postinst @@ -0,0 +1,47 @@ +#! /bin/sh +# +# License: GNU General Public License (GPL) +# +# postinst script for ldirectord +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see /usr/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + update-rc.d ldirectord defaults >/dev/null + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- heartbeat-2.99.2+sles11r9.orig/debian/Makefile +++ heartbeat-2.99.2+sles11r9/debian/Makefile @@ -0,0 +1,511 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# debian/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +pkgdatadir = $(datadir)/heartbeat +pkglibdir = $(libdir)/heartbeat +pkgincludedir = $(includedir)/heartbeat +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +subdir = debian +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h \ + $(top_builddir)/include/hb_config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run aclocal-1.10 +ALIGN = +AMTAR = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run autoconf +AUTOHEADER = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run autoheader +AUTOMAKE = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run automake-1.10 +AWK = /usr/bin/gawk +CC = gcc -std=gnu99 +CCDEPMODE = depmode=gcc3 +CFLAGS = -Wall -g -O2 -DNETSNMP_BROKEN_INLINE -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -ggdb3 -funsigned-char +CPP = gcc -std=gnu99 -E +CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 +CRM_DIR = +CRM_ENABLED = 0 +CRYPTOLIB = -lcrypto +CURSESLIBS = -lncurses +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DISABLE_TIMES_KLUDGE = +DISTDIR = heartbeat-2.99.3 +DISTRO_STYLE_RPMS = 0 +DLOPEN_FORCE_FLAGS = +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_CMD = echo +ECHO_E = +ECHO_N = +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +FGREP = /bin/grep -F +GETENT = /usr/bin/getent +GLIBHEAD = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include +GLIBLIB = -lglib-2.0 +GNUTLSHEAD = -I/usr/include +GNUTLSLIBS = -lgnutls +GREP = /bin/grep +GZIP_PROG = /bin/gzip +HA_APIGID = 112 +HA_APIGROUP = haclient +HA_CCMUID = 106 +HA_CCMUSER = hacluster +HA_COREDIR = /var/lib/heartbeat/cores +HA_DATADIR = /usr/share +HA_HBCONF_DIR = /etc/ha.d +HA_LIBDIR = /usr/lib +HA_LIBHBDIR = /usr/lib/heartbeat +HA_LOGDAEMON_IPC = /var/lib/log_daemon +HA_NOARCHDATAHBDIR = /usr/share/heartbeat +HA_PLUGIN_DIR = /usr/lib/heartbeat/plugins +HA_RC_DIR = /etc/ha.d/rc.d +HA_URLBASE = http://linux-ha.org/ +HA_VARLIBDIR = /var/lib +HA_VARLIBHBDIR = /var/lib/heartbeat +HA_VARLOCKDIR = /var/lock +HA_VARLOGDIR = /var/log +HA_VARRUNDIR = /var/run +HA_VARRUNHBDIR = /var/run/heartbeat +HA_VARRUNHBRSCDIR = /var/run/heartbeat/rsctmp +HB_INITSTARTPRI = 75 +HB_INITSTOPPRI = 05 +HB_PKG = heartbeat +HB_RA_DIR = /etc/ha.d/resource.d/ +HG = /usr/bin/hg +HTML2TXT = /usr/bin/lynx +IFCONFIG = /sbin/ifconfig +IFCONFIG_A_OPT = -a +INCLTDL = +INITDEFDIR = /etc/default +INITDIR = /etc/init.d +INIT_EXT = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +IP2UTIL = /sbin/ip +IPCSOCKET_C = ipcsocket.c +IPCSOCKET_LO = ipcsocket.lo +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = -Wl,-Bsymbolic-functions +LEX = flex +LEXLIB = -lfl +LEX_OUTPUT_ROOT = lex.yy +LIBADD_DL = -ldl +LIBADD_INTL = +LIBGNUTLS_CONFIG = /usr/bin/libgnutls-config +LIBLTDL = +LIBLTDL_DIR = +LIBNETCONFIG = /usr/bin/libnet-config +LIBNETDEFINES = +LIBNETLIBS = -lnet +LIBOBJS = ${LIBOBJDIR}NoSuchFunctionName$U.o ${LIBOBJDIR}strlcpy$U.o ${LIBOBJDIR}strlcat$U.o +LIBRT = +LIBS = -levs -lbz2 -lz -lxml2 -lc -luuid -lpam -lrt -ldl -lltdl +LIBTOOL = $(SHELL) $(top_builddir)/libtool --tag=CC $(QUIET_LIBTOOL_OPTS) +LIPO = +LN_S = ln -s +LOCALE = /usr/share/locale +LOGD_INITSTARTPRI = 10 +LOGD_INITSTOPPRI = 75 +LRM_ENABLED = 1 +LRM_PLUGIN_DIR = /usr/lib/heartbeat/plugins/RAExec +LSB_RA_DIR = /etc/init.d +LTDLDEPS = ${top_build_prefix}libltdl/libltdlc.la +LTDLINCL = -I${top_srcdir}/libltdl +LTLIBOBJS = ${LIBOBJDIR}NoSuchFunctionName$U.lo ${LIBOBJDIR}strlcpy$U.lo ${LIBOBJDIR}strlcat$U.lo +MAILCMD = /usr/bin/mailx +MAKE = make $(QUIET_MAKE_OPTS) +MAKEINFO = ${SHELL} /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/missing --run makeinfo +MD5 = +MKDIR_P = /bin/mkdir -p +MSGFMT = /usr/bin/msgfmt +MSGHDR_TYPE = msghdr +NETSTAT = /bin/netstat +NM = /usr/bin/nm -B +NMEDIT = +NON_FATAL_CFLAGS = -Wall -g -O2 -DNETSNMP_BROKEN_INLINE -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing +OBJDUMP = objdump +OBJEXT = o +OCF_RA_DIR = /usr/lib/ocf/resource.d/ +OCF_ROOT_DIR = /usr/lib/ocf +OTOOL = +OTOOL64 = +PACKAGE = heartbeat +PACKAGE_BUGREPORT = +PACKAGE_NAME = +PACKAGE_STRING = +PACKAGE_TARNAME = +PACKAGE_URL = +PACKAGE_VERSION = +PATH_SEPARATOR = : +PILSPKG = pils +PING = /bin/ping +PING_TIMEOUT_OPT = -w1 +PKGCONFIG = /usr/bin/pkg-config +PKGNAME = LXHAhb +POD2MAN = /usr/bin/pod2man +POWEROFF_CMD = /sbin/poweroff +POWEROFF_OPTIONS = -nf +PRETTY_CC = +PROCROUTE = +PYTHON = /usr/bin/python +PYTHON_EXEC_PREFIX = ${exec_prefix} +PYTHON_PLATFORM = linux2 +PYTHON_PREFIX = ${prefix} +PYTHON_VERSION = 2.6 +QUIET_LIBTOOL_OPTS = +QUIET_MAKE_OPTS = +QUORUMD_ENABLED = 1 +RANLIB = ranlib +REAL_CC = gcc -std=gnu99 +REBOOT = /sbin/reboot +REBOOT_OPTIONS = -nf +ROUTE = /sbin/route +ROUTEPARM = +RPM = +RPMREL = 1 +RPMTARGET = +RPM_ENABLE_OPENHPI = 1 +SCP = /usr/bin/scp +SED = /bin/sed +SET_MAKE = +SHELL = /bin/bash +SNMPCONFIG = /usr/bin/net-snmp-config +SNMPLIB = -Wl,-Bsymbolic-functions -L/usr/lib -lnetsnmp +SSH = /usr/bin/ssh +STONITHPKG = stonith +STONITH_RA_DIR = /usr/lib/heartbeat/stonith.d/ +STRIP = strip +SWIG = /usr/bin/swig +TAR = /bin/tar +TARFILE = heartbeat-2.99.3.tar.gz +TEST = /usr/bin/test +TIPC_INCLUDE = +UCDSNMPDEVEL = +USE_MODULES = 1 +VALGRIND_BIN = +VERSION = 2.99.3 +WHOAMI = /usr/bin/whoami +XML2CONFIG = /usr/bin/xml2-config +XPERIMENTALDIRS = +YACC = bison -y +YFLAGS = +abs_builddir = /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/debian +abs_srcdir = /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/debian +abs_top_builddir = /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG +abs_top_srcdir = /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG +ac_configure_args = '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--mandir=/usr/share/man' '--disable-crm' '--with-group-name=haclient' '--with-ccmuser-name=hacluster' '--enable-snmp-subagent' '--with-mibsdir=/usr/share/snmp/mibs' '--disable-fatal-warnings' '--enable-mgmt' '--enable-libc-malloc' '--enable-quorumd' 'CFLAGS=-Wall -g -O2' 'LDFLAGS=-Wl,-Bsymbolic-functions' 'CPPFLAGS=' --enable-ltdl-convenience +ac_ct_CC = gcc +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +base_includedir = /usr/include +bindir = /usr/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +cleaned_configure_args = '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--mandir=/usr/share/man' '--disable-crm' '--with-group-name=haclient' '--with-ccmuser-name=hacluster' '--enable-snmp-subagent' '--with-mibsdir=/usr/share/snmp/mibs' '--disable-fatal-warnings' '--enable-mgmt' '--enable-libc-malloc' '--enable-quorumd' 'CFLAGS=-Wall -g -O2' 'LDFLAGS=-Wl,-Bsymbolic-functions' 'CPPFLAGS=' +datadir = /usr/share +datarootdir = /usr/share +docdir = /usr/share/doc/heartbeat +dvidir = ${docdir} +exec_prefix = /usr +hb_libdir = /usr/lib/heartbeat +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = /usr/include +infodir = /usr/share/info +install_sh = $(SHELL) /home/ivoks/ClusterStack/heartbeat/heartbeat-2.99.2+sles11r9.ORIG/install-sh +libdir = /usr/lib +libexecdir = /usr/lib +localedir = ${datarootdir}/locale +localstatedir = /var +lt_ECHO = echo +mandir = /usr/share/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +pils_includedir = /usr/include/pils +pils_plugindir = /usr/lib/pils/plugins +pkgpyexecdir = ${pyexecdir}/heartbeat +pkgpythondir = ${pythondir}/heartbeat +prefix = /usr +program_transform_name = s,x,x, +psdir = ${docdir} +pyexecdir = ${exec_prefix}/lib/python2.6/dist-packages +pythondir = ${prefix}/lib/python2.6/dist-packages +saf_includedir = /usr/include/saf +sbindir = /usr/sbin +sharedstatedir = /usr/com +srcdir = . +stdocdir = /usr/share/doc/heartbeat/stonith +stonith_ext_plugindir = /usr/lib/stonith/plugins/external +stonith_includedir = /usr/include/stonith +stonith_plugindir = /usr/lib/stonith/plugins +subdirs = +sysconfdir = /etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. + +# +# linux-ha: Linux-HA heartbeat code +# +# Copyright (C) 2001 Michael Moerz +# This instance created by Horms +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = changelog compat control copyright \ + dpkg-checkbuild rules \ + heartbeat.dirs heartbeat.files \ + heartbeat.postinst heartbeat.postrm \ + heartbeat.preinst \ + heartbeat-dev.dirs heartbeat-dev.files \ + heartbeat-gui.dirs heartbeat-gui.files \ + heartbeat-2.prerm \ + ldirectord.files ldirectord.postinst \ + ldirectord.postrm + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu debian/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu debian/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + + +clean-local: + rm -f *.substvars *.debhelper files + rm -r -f heartbeat heartbeat-dev ldirectord \ + libpils0 libpils-dev libstonith0 libstonith-dev stonith tmp +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-common.install +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-common.install @@ -0,0 +1,117 @@ +etc/ha.d/shellfuncs +etc/init.d/logd +usr/lib/heartbeat/ha_logd +usr/lib/heartbeat/ha_logger +usr/lib/heartbeat/lrmd +usr/lib/heartbeat/openais_conf_support.sh +usr/lib/heartbeat/plugins/RAExec/heartbeat.so +usr/lib/heartbeat/plugins/RAExec/lsb.so +usr/lib/heartbeat/plugins/RAExec/ocf.so +usr/lib/heartbeat/utillib.sh +usr/lib/pils/plugins/InterfaceMgr/generic.so +usr/lib/stonith/plugins/external/drac5 +usr/lib/stonith/plugins/external/hmchttp +usr/lib/stonith/plugins/external/ibmrsa +usr/lib/stonith/plugins/external/ibmrsa-telnet +usr/lib/stonith/plugins/external/ipmi +usr/lib/stonith/plugins/external/kdumpcheck +usr/lib/stonith/plugins/external/rackpdu +usr/lib/stonith/plugins/external/riloe +usr/lib/stonith/plugins/external/sbd +usr/lib/stonith/plugins/external/ssh +usr/lib/stonith/plugins/external/vmware +usr/lib/stonith/plugins/external/xen0 +usr/lib/stonith/plugins/external/xen0-ha +usr/lib/stonith/plugins/stonith2/apcmaster.so +usr/lib/stonith/plugins/stonith2/apcmastersnmp.so +usr/lib/stonith/plugins/stonith2/apcsmart.so +usr/lib/stonith/plugins/stonith2/baytech.so +usr/lib/stonith/plugins/stonith2/bladehpi.so +usr/lib/stonith/plugins/stonith2/cyclades.so +usr/lib/stonith/plugins/stonith2/drac3.so +usr/lib/stonith/plugins/stonith2/external.so +usr/lib/stonith/plugins/stonith2/ibmhmc.so +usr/lib/stonith/plugins/stonith2/ipmilan.so +usr/lib/stonith/plugins/stonith2/meatware.so +usr/lib/stonith/plugins/stonith2/null.so +usr/lib/stonith/plugins/stonith2/nw_rpc100s.so +usr/lib/stonith/plugins/stonith2/rcd_serial.so +usr/lib/stonith/plugins/stonith2/ribcl.py +usr/lib/stonith/plugins/stonith2/rps10.so +usr/lib/stonith/plugins/stonith2/ssh.so +usr/lib/stonith/plugins/stonith2/suicide.so +usr/lib/stonith/plugins/stonith2/wti_nps.so +usr/lib/stonith/plugins/xen0-ha-dom0-stonith-helper +usr/sbin/ha_logger +usr/sbin/hb_report +usr/sbin/stonith +usr/sbin/lrmadmin +usr/share/heartbeat/ha_cf_support.sh +usr/share/heartbeat/openais_conf_support.sh +usr/share/heartbeat/utillib.sh +usr/share/man/man1/ha_logger.1.gz +usr/share/man/man8/ha_logd.8.gz +usr/share/man/man8/stonith.8.gz +var/lib/heartbeat/cores/hacluster +var/lib/heartbeat/cores/nobody +var/lib/heartbeat/cores/root +var/lib/heartbeat/lrm +usr/lib/ocf/resource.d/heartbeat/* +usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs +usr/lib/ocf/resource.d/heartbeat/.ocf-binaries +usr/lib/ocf/resource.d/heartbeat/.ocf-directories +usr/lib/ocf/resource.d/heartbeat/.ocf-returncodes +etc/ha.d/resource.d/AudibleAlarm +etc/ha.d/resource.d/Delay +etc/ha.d/resource.d/Filesystem +etc/ha.d/resource.d/ICP +etc/ha.d/resource.d/IPaddr +etc/ha.d/resource.d/IPaddr2 +etc/ha.d/resource.d/IPsrcaddr +etc/ha.d/resource.d/IPv6addr +etc/ha.d/resource.d/LVM +etc/ha.d/resource.d/LVSSyncDaemonSwap +etc/ha.d/resource.d/LinuxSCSI +etc/ha.d/resource.d/MailTo +etc/ha.d/resource.d/OCF +etc/ha.d/resource.d/Raid1 +etc/ha.d/resource.d/SendArp +etc/ha.d/resource.d/ServeRAID +etc/ha.d/resource.d/WAS +etc/ha.d/resource.d/WinPopup +etc/ha.d/resource.d/Xinetd +etc/ha.d/resource.d/apache +etc/ha.d/resource.d/db2 +etc/ha.d/resource.d/hto-mapfuncs +etc/ha.d/resource.d/ids +etc/ha.d/resource.d/portblock +usr/lib/heartbeat/findif +usr/lib/heartbeat/send_arp +usr/lib/heartbeat/req_resource +usr/lib/heartbeat/ra-api-1.dtd +usr/share/heartbeat/ra-api-1.dtd +usr/share/heartbeat/lrmtest/LRMBasicSanityCheck +usr/share/doc/heartbeat/README.lrm_regression_tests +usr/share/heartbeat/lrmtest/defaults +usr/share/heartbeat/lrmtest/descriptions +usr/share/heartbeat/lrmtest/evaltest.sh +usr/share/heartbeat/lrmtest/language +usr/share/heartbeat/lrmtest/lrmadmin-interface +usr/share/heartbeat/lrmtest/lrmregtest +usr/share/heartbeat/lrmtest/lrmregtest-heartbeat +usr/share/heartbeat/lrmtest/lrmregtest-lsb +usr/share/heartbeat/lrmtest/regression.sh +usr/share/heartbeat/lrmtest/testcases +usr/share/heartbeat/lrmtest/testcases/BSC +usr/share/heartbeat/lrmtest/testcases/common.filter +usr/share/heartbeat/lrmtest/testcases/metadata +usr/share/heartbeat/lrmtest/testcases/metadata.exp +usr/share/heartbeat/lrmtest/testcases/ra-list.sh +usr/share/heartbeat/lrmtest/testcases/rscexec +usr/share/heartbeat/lrmtest/testcases/rscexec.exp +usr/share/heartbeat/lrmtest/testcases/rscmgmt +usr/share/heartbeat/lrmtest/testcases/rscmgmt.exp +usr/share/heartbeat/lrmtest/testcases/rscmgmt.log_filter +usr/share/heartbeat/lrmtest/testcases/xmllint.sh +usr/sbin/ocf-tester +usr/lib/heartbeat/lrmtest --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat-2.prerm +++ heartbeat-2.99.2+sles11r9/debian/heartbeat-2.prerm @@ -23,6 +23,7 @@ rm -f /usr/lib/heartbeat/cts/OCFIPraTest.pyc rm -f /usr/lib/heartbeat/cts/extracttests.pyc rm -f /usr/lib/heartbeat/haclient.pyc +rm -f /usr/lib/heartbeat/haresources2cib.pyc rm -f /usr/lib/heartbeat/mgmtcmd.pyc rm -f /usr/lib/heartbeat/pymgmt.pyc rm -f /usr/lib/stonith/plugins/stonith2/ribcl.pyc --- heartbeat-2.99.2+sles11r9.orig/debian/heartbeat.preinst +++ heartbeat-2.99.2+sles11r9/debian/heartbeat.preinst @@ -6,15 +6,15 @@ # # see: dh_installdeb(1) -for f in heartbeat logd; do -if [ -x /etc/init.d/$f ]; then +set -e + +if [ -x /etc/init.d/heartbeat ]; then if which invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d $f stop + invoke-rc.d heartbeat stop else - /etc/init.d/$f stop + /etc/init.d/heartbeat stop fi fi -done # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. --- heartbeat-2.99.2+sles11r9.orig/debian/changelog +++ heartbeat-2.99.2+sles11r9/debian/changelog @@ -1,12 +1,156 @@ -heartbeat (2.99.2-1) unstable; urgency=low +heartbeat (2.99.2+sles11r9-5ubuntu3) lucid; urgency=low + * debian/control: + + move libdbd-mysql-perl to Recommends (thx ivoks) + + -- Stephan Hermann Tue, 19 Jan 2010 12:51:21 +0000 + +heartbeat (2.99.2+sles11r9-5ubuntu2) lucid; urgency=low + + * debian/control: + + added libdbd-mysql-perl to ldirectord package Depends (LP: #509567) + + added libsocket6-perl to ldirectord package Depends (LP: #487508) + * resources/OCF/Makefile.am: + + removed duplicate drbd resource script (LP: #509588) + + + -- Stephan Hermann Tue, 19 Jan 2010 11:32:17 +0000 + +heartbeat (2.99.2+sles11r9-5ubuntu1) karmic; urgency=low + + * New upstream snapshot + * Adjusted heartbeat.install and rules for documentation path + + -- Ante Karamatic Mon, 10 Aug 2009 19:29:25 +0200 + +heartbeat (2.99.2+sles11r9-5ubuntu1~ppa2) karmic; urgency=low + + * debian/heartbeat.init: Changed '$RUNDIR/heartbeat/crm' to '$RUNDIR/crm', + and its ownership and permissions on the 'StartHA' function. This caused + pacemaker-heartbeat to fail upon restarting after installation. + + -- Andres Rodriguez Tue, 14 Jul 2009 00:04:27 -0500 + +heartbeat (2.99.2+sles11r9-5ubuntu1~ppa1) karmic; urgency=low + + * Synced with debian experimental. + * debian/rules: Fixed Bashisms. + * debian/control: Updated Maintainer field to match Ubuntu MOTU Developers. + + -- Andres Rodriguez Fri, 19 Jun 2009 16:58:55 -0500 + +heartbeat (2.99.2+sles11r9-5) unstable; urgency=low + + [ Martin Loschwitz ] + * fix binary-arch/binary-indep handling in debian/rules, REALLY fixing the + duplicate file problem this time. + + -- Martin Loschwitz Tue, 02 Jun 2009 11:45:00 +0200 + +heartbeat (2.99.2+sles11r9-4) unstable; urgency=low + + [ Martin Loschwitz ] + * Fix bug introduced in -3 where some LRM regression documentation would + be both in heartbeat and in heartbeat-common + + -- Martin Loschwitz Mon, 01 Jun 2009 18:42:00 +0200 + +heartbeat (2.99.2+sles11r9-3) experimental; urgency=low + + [ Martin Loschwitz ] + * More tweaking for the heartbeat/heartbeat-common split, based + on the advise by Andrew Beekhof (Thank you very much!) + + -- Martin Loschwitz Wed, 27 May 2009 13:16:00 +0200 + +heartbeat (2.99.2+sles11r9-2) experimental; urgency=low + + [ Martin Loschwitz ] + * include send_arp as things might get troublesome otherwise + + -- Martin Loschwitz Wed, 27 May 2009 00:00:00 +0200 + +heartbeat (2.99.2+sles11r9-1) experimental; urgency=low + + [ Martin Loschwitz ] + * Updated to latest upstream version + + -- Martin Loschwitz Fri, 22 May 2009 08:51:00 +0200 + +heartbeat (2.99.2+sles11r7-1) experimental; urgency=low + + [ Martin Loschwitz ] + * Redid package structure, adding the following new packages: + libheartbeat2 + libheartbeat2-dev + heartbeat-common + heartbeat-common-dev + This makes the packages as compatible as possible with the according + SLES packages; additionally, it allows to have a nearly openais-only + pacemaker. + * Changed Maintainer to the Debian HA-Maintainers + * New Upstream version + + -- Martin Loschwitz Sat, 21 Mar 2009 00:04:00 +0100 + +heartbeat (2.99.2-1) experimental; urgency=low + + [ Anibal Monsalve Salazar ] * New Upstream - * Add dependancy on libsocket6-perl to ldirectord, - which is needed for IPv6 support which was recently added - * Fixed "can is" typo in heartbeat.8. Thanks to Niko Tyni. - (closes: #512632) - -- Simon Horman Fri, 23 Jan 2009 10:09:44 +1100 + * Add myself to uploaders + + [ Simon Horman ] + * Change distribution from sid to experimental + + * Add conflicts with pacemaker-dev (<< 1.0.1-1) to heartbeat-dev + as older versions of pacemaker-dev need cl_malloc.h to be present + in heartbeat-dev + + * Make sure configure and py-compile are executable if present + + * Don't run configure for clean targets. + This causes multiple builds of the tree which takes a long time. + Upstream commit: + "Medium (LF 2018): Debian: build: revert changeset ddfb560ba135" + + * The correct include path for termio.h on Debian is + not - This needs to be fixed more cleanly upstream. + + * heartbeat dependancy on mawk + + With this change heartbeat now depends on both gawk and mawk. + Clearly there is roome for improvment here. I will try and + get things cleaned-up in upstream and unstable. + + (See: #512403) + + -- Simon Horman Fri, 30 Jan 2009 16:16:45 +0900 + +heartbeat (2.1.4-3) unstable; urgency=high + + * heartbeat-gui: depend on uuid-runtime rather than + uuid-runtime | e2fsprogs as uuidgen, which is needed by hb_gui, is + included in uuid-runtime but not e2fsprogs on Lenny. That is, a system + (default install I think) that has e2fsprogs installed but not + uuid-runtime would satisfy the old dependancy, but hb_gui would not + work correctly. + + I beleive that the reason for the alternate dependancy was to allow the + package to be built for both sarge and newer systems. Sarge being the + stable release. But when Lenny becomes the stable release most of the + motivation for this will be removed. + + If this becomes a problem then a versioned dependancy could be + intorduced. Based on the e2fsprogs ChangeLog I believe that should be + as follows. Howerver, I have decided to take the simpler single + dependancy option for now. + + uuid-runtime | e2fsprogs (< 1.40.4-1) + + (closes: #503177) + + -- Simon Horman Fri, 16 Jan 2009 13:03:55 +1100 heartbeat (2.1.4-2) unstable; urgency=low @@ -23,14 +167,14 @@ * Dependancy on ${shlibs:Depends} for heartbeat-gui As per lintian error "missing-dependency-on-libc" - * Dependancy on python-xml for heartbeat-gui - (closes: #496951) - * Pass --enable-libc-malloc to configure. --enable-glib-malloc was a typo. Upstream-satatus: Pending + * Don't ignore errors in clean target of debian/rules + As per lintian warning "debian-rules-ignores-make-clean-error" + -- Simon Horman Fri, 29 Aug 2008 04:34:10 +0000 heartbeat (2.1.4-1) unstable; urgency=low --- heartbeat-2.99.2+sles11r9.orig/debian/control +++ heartbeat-2.99.2+sles11r9/debian/control @@ -1,17 +1,19 @@ Source: heartbeat Section: admin Priority: optional -Maintainer: Simon Horman -Build-Depends: debhelper (>= 5.0.37.2), libglib2.0-dev, perl, net-tools, iputils-ping, python, psmisc, libnet1-dev | build-essential, iproute, libtool, libcurl4-openssl-dev | libcurl3-openssl-dev, libxml2-dev, bison, flex, uuid-dev, lynx, libbz2-dev, zlib1g-dev, libltdl3-dev, openssh-client, python-central (>= 0.5), python-dev, libpam0g-dev, psmisc, libopenhpi-dev | build-essential, libopenipmi-dev | build-essential -Standards-Version: 3.8.0 +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Debian HA Maintainers +Uploaders: Martin Loschwitz , Anibal Monsalve Salazar , Simon Horman +Build-Depends: debhelper (>= 5.0.37.2), libsnmp-dev, libglib2.0-dev, perl, net-tools, iputils-ping, python, psmisc, libnet1-dev, iproute, libtool, libcurl4-openssl-dev | libcurl3-openssl-dev, libxml2-dev, bison, flex, uuid-dev, lynx, libbz2-dev, zlib1g-dev, uuid-dev, libsensors-dev, libltdl3-dev, swig, openssh-client, libgnutls-dev, python-central (>= 0.5), python-dev, libpam0g-dev, libncurses5-dev, psmisc, libopenhpi-dev, libopenipmi-dev, autoconf, automake, libtool +Standards-Version: 3.8.1 XS-Python-Version: current Package: ldirectord Section: admin Priority: extra Architecture: all -Depends: ${perl:Depends}, ipvsadm, libauthen-radius-perl, libcrypt-ssleay-perl, libdbi-perl, libdigest-hmac-perl, libdigest-md5-perl, libmail-pop3client-perl, libmailtools-perl, libnet-dns-perl, libnet-imap-simple-perl, libnet-imap-simple-ssl-perl, libnet-ldap-perl, libnet-perl, libwww-perl, libsocket6-perl -Recommends: rsyslog | system-log-daemon, logrotate +Depends: ${perl:Depends}, ${misc:Depends}, ipvsadm, libauthen-radius-perl, libcrypt-ssleay-perl, libdbi-perl, libdigest-hmac-perl, libdigest-md5-perl, libmail-pop3client-perl, libmailtools-perl, libnet-dns-perl, libnet-imap-simple-perl, libnet-imap-simple-ssl-perl, libnet-ldap-perl, libnet-perl, libwww-perl, libsocket6-perl +Recommends: rsyslog | system-log-daemon, logrotate, libdbd-mysql-perl Conflicts: libpils0 (<< 2.0.8-3), libstonith0 (<< 2.0.8-3), stonith (<< 2.0.8-3) XB-Python-Version: ${python:Versions} Description: Monitors virtual services provided by LVS @@ -19,14 +21,15 @@ for virtual services provided by The Linux Virtual Server (LVS). and works with Linux-HA's heartbeat package. -Package: heartbeat +Package: heartbeat-common Section: admin Priority: optional Architecture: any -Depends: ${shlibs:Depends}, ${python:Depends}, iproute, adduser, iputils-ping, psmisc, gawk, libxml2-utils, libpam-runtime (>= 0.76-14) -Recommends: rsyslog | system-log-daemon, logrotate, iptables +Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}, gawk, mawk, libxml2-utils, libheartbeat2 (= ${binary:Version}) +Replaces: heartbeat (<= 2.99.2+sles11r9-2) +Conflicts: heartbeat (<= 2.99.2+sles11r9-2) XB-Python-Version: ${python:Versions} -Description: Subsystem for High-Availability Linux +Description: Subsystem for High-Availability Linux (common files) heartbeat is a basic heartbeat subsystem for Linux-HA which implements serial, UDP, and PPP/UDP heartbeats together with IP address takeover including a nice resource model including resource groups. @@ -34,15 +37,19 @@ It currently supports a very sophisticated dependency model for n-node clusters. It is both extremely useful and quite stable at this point in time. + . + This package contains those files of Heartbeat that are not only useful + for Heartbeat itself but also for other programs like Pacemaker. -Package: heartbeat-dev -Section: devel +Package: heartbeat-common-dev +Section: admin Priority: optional Architecture: any -Depends: heartbeat (= ${binary:Version}) -Conflicts: libstonith-dev (<< 2.0.8-3), libpils-dev (<< 2.0.8-3) +Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}, heartbeat-common (= ${binary:Version}) +Replaces: heartbeat (<= 2.99.2+sles11r9-2) +Conflicts: heartbeat (<= 2.99.2+sles11r9-2) XB-Python-Version: ${python:Versions} -Description: Subsystem for High-Availability Linux - development files +Description: Subsystem for High-Availability Linux (common dev files) heartbeat is a basic heartbeat subsystem for Linux-HA which implements serial, UDP, and PPP/UDP heartbeats together with IP address takeover including a nice resource model including resource groups. @@ -50,78 +57,79 @@ It currently supports a very sophisticated dependency model for n-node clusters. It is both extremely useful and quite stable at this point in time. - . - This package contains development files - -Package: ldirectord-2 -Section: admin -Priority: optional -Architecture: all -Depends: ldirectord (= ${source:Version}) -Description: Monitors virtual services provided by LVS - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. - -Package: heartbeat-2 -Section: admin -Priority: optional -Architecture: all -Depends: heartbeat (>= ${source:Version}) -Description: Subsystem for High-Availability Linux - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. + . + This package contains the static version of the Heartbeat plugins that + can be used by other programs like Pacemaker. -Package: heartbeat-2-dev -Section: admin -Priority: optional -Architecture: all -Depends: heartbeat-dev (>= ${source:Version}) -Description: Subsystem for High-Availability Linux - development files - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. - -Package: stonith +Package: libheartbeat2 Section: libs Priority: optional Architecture: any -Depends: heartbeat (= ${binary:Version}) -Description: Interface for remotely powering down a node in the cluster - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: heartbeat (<= 2.99.2+sles11r7-0+1~bpo50) +Conflicts: heartbeat (<= 2.99.2+sles11r7-0+1~bpo50) +Description: Subsystem for High-Availability Linux (libraries) + heartbeat is a basic heartbeat subsystem for Linux-HA which implements + serial, UDP, and PPP/UDP heartbeats together with IP address takeover + including a nice resource model including resource groups. + . + It currently supports a very sophisticated dependency model for n-node + clusters. It is both extremely useful and quite stable at this point in + time. + . + This package contains the Heartbeat libraries to make them available + to other programs like Pacemaker without having to install the whole + Heartbeat suite. -Package: libstonith0 -Section: libs +Package: libheartbeat2-dev +Section: libdevel Priority: optional Architecture: any -Depends: heartbeat (= ${binary:Version}) -Description: Interface for remotely powering down a node in the cluster - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. +Depends: ${shlibs:Depends}, ${misc:Depends}, libheartbeat2 (= ${binary:Version}) +Replaces: heartbeat (<= 2.99.2+sles11r7-0+1~bpo50) +Conflicts: heartbeat (<= 2.99.2+sles11r7-0+1~bpo50) +Description: Subsystem for High-Availability Linux (development files) + heartbeat is a basic heartbeat subsystem for Linux-HA which implements + serial, UDP, and PPP/UDP heartbeats together with IP address takeover + including a nice resource model including resource groups. + . + It currently supports a very sophisticated dependency model for n-node + clusters. It is both extremely useful and quite stable at this point in + time. + . + This package contains the Heartbeat library development files to make + them available to other programs like Pacemaker. -Package: libstonith-dev +Package: heartbeat Section: admin Priority: optional -Architecture: all -Depends: heartbeat-dev (>= ${source:Version}) -Description: Interface for remotely powering down a node in the cluster - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. - -Package: libpils0 -Section: libs -Priority: optional Architecture: any -Depends: heartbeat (= ${binary:Version}) -Description: Plugin and Interface Loading System - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. +Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}, heartbeat-common (= ${binary:Version}), iproute, adduser, iputils-ping, psmisc, gawk, mawk, libxml2-utils, libpam-runtime (>= 0.76-14) +Recommends: rsyslog | system-log-daemon, logrotate, iptables +XB-Python-Version: ${python:Versions} +Description: Subsystem for High-Availability Linux + heartbeat is a basic heartbeat subsystem for Linux-HA which implements + serial, UDP, and PPP/UDP heartbeats together with IP address takeover + including a nice resource model including resource groups. + . + It currently supports a very sophisticated dependency model for n-node + clusters. It is both extremely useful and quite stable at this point in + time. -Package: libpils-dev -Section: admin +Package: heartbeat-dev +Section: devel Priority: optional -Architecture: all -Depends: heartbeat-dev (>= ${source:Version}) -Description: Plugin and Interface Loading System - development files - This is a transitional dummy package. If nothing depends on it, this - package can be safely removed. - +Architecture: any +Depends: heartbeat (= ${binary:Version}), ${misc:Depends} +Conflicts: libstonith-dev (<< 2.0.8-3), libpils-dev (<< 2.0.8-3), pacemaker-dev (<< 1.0.1-1) +XB-Python-Version: ${python:Versions} +Description: Subsystem for High-Availability Linux - development files + heartbeat is a basic heartbeat subsystem for Linux-HA which implements + serial, UDP, and PPP/UDP heartbeats together with IP address takeover + including a nice resource model including resource groups. + . + It currently supports a very sophisticated dependency model for n-node + clusters. It is both extremely useful and quite stable at this point in + time. + . + This package contains Heartbeat-specific development files . --- heartbeat-2.99.2+sles11r9.orig/include/stonith/stonith.h +++ heartbeat-2.99.2+sles11r9/include/stonith/stonith.h @@ -88,6 +88,8 @@ #define ST_DEVICEDESCR 4 /* Device Description text */ #define ST_DEVICEURL 5 /* Manufacturer/Device URL */ +extern PILPluginUniv *StonithPIsys; + char ** stonith_types(void); /* NULL-terminated list */ /* valid until next call of stonith_types() */ Stonith*stonith_new(const char * type); --- heartbeat-2.99.2+sles11r9.orig/ldirectord/ldirectord.in +++ heartbeat-2.99.2+sles11r9/ldirectord/ldirectord.in @@ -9,7 +9,7 @@ # License: GNU General Public License (GPL) # # Note: * The original author of this software was Jacob Rief circa 1999 -# * It was maintained by Jacob Rief and Horms +# * It was maintained by Jacob Rief and Horms # from November 1999 to July 2003. # * From July 2003 Horms is the maintainer # @@ -17,12 +17,12 @@ # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA @@ -46,7 +46,7 @@ =head1 SYNOPSIS -B [B<-d|--debug>] [--] [I] +B [B<-d|--debug>] [--] [I] B|B|B|B|B|B|B B [B<-h|-?|--help|-v|--version>] @@ -77,7 +77,7 @@ This is the name for the configuration as specified in the file B<@sysconfdir@/ha.d/conf/>I -B<-d|--debug> Don't start as daemon and log verbosly. +B<-d|--debug> Don't start as daemon and log verbosely. B<-h|--help> Print user manual and exit. @@ -106,7 +106,7 @@ Defines a virtual service by IP-address (or hostname) and port (or servicename) or firewall-mark. A firewall-mark is an integer greater than -zero. The configuration of marking packets is controled using the C<-m> +zero. The configuration of marking packets is controlled using the C<-m> option to B(8). All real services and flags for a virtual service must follow this line immediately and be indented. @@ -118,7 +118,7 @@ If defined in a virtual server section then the global value is overridden. If undefined then the value of negotiatetimeout is used. negotiatetimeout -is also a global value that may be overriden by a per-virtual setting. +is also a global value that may be overridden by a per-virtual setting. If both checktimeout and negotiatetimeout are unset, the default is used. @@ -126,12 +126,12 @@ BI -Timeout in seconds for negotiate checks. +Timeout in seconds for negotiate checks. If defined in a virtual server section then the global value is overridden. If undefined then the value of connecttimeout is used. connecttimeout is -also a global value that may be overriden by a per-virtual setting. +also a global value that may be overridden by a per-virtual setting. If both negotiatetimeout and connecttimeout are unset, the default is used. @@ -158,11 +158,11 @@ This option is deprecated and slated for removal in a future version. Please see the 'failurecount' option. -The number of times a check will be attmpted before it is considered to +The number of times a check will be attempted before it is considered to have failed. Only works with ping checks. Note that the checktimeout/negotiatetimeout is additive, so if a connect check is used, checkcount is 3 and checktimeout is 2 seconds, then a total of 6 seconds -worth of timeout will occur becore the check fails. +worth of timeout will occur before the check fails. If defined in a virtual server section then the global value is overridden. @@ -175,7 +175,7 @@ value of 1 will have the realserver considered failed on the first failure. A successful check will reset the failure counter to 0. -If defined in a virtual server section then the global value is overriden. +If defined in a virtual server section then the global value is overridden. Default: 1 @@ -299,10 +299,10 @@ BB|B -If I, then ldirectord will spawn a child proccess for every virtual server, +If I, then ldirectord will spawn a child process for every virtual server, and run checks against the real servers from them. This will increase response times to changes in real server status in configurations with many virtual -servers. This may also use less memory then running many seperate instances of +servers. This may also use less memory then running many separate instances of ldirectord. Child processes will be automaticly restarted if they die. Default: I @@ -313,19 +313,19 @@ If I, then when real or failback servers are determined to be down, they are not actually removed from the kernel's LVS table. Rather, their weight is set to zero which means that no -new connections will be accepted. +new connections will be accepted. This has the side effect, that if the real server has persistent connections, new connections from any existing clients will continue to be -routed to the real server, until the persistant timeout can expire. See -L for more information on persistant connections. +routed to the real server, until the persistent timeout can expire. See +L for more information on persistent connections. This side-effect can be avoided by running the following: echo 1 > /proc/sys/net/ipv4/vs/expire_quiescent_template If the proc file isn't present this probably means that -the kernel doesn't have lvs support, LVS support isn't loaded, +the kernel doesn't have LVS support, LVS support isn't loaded, or the kernel is too old to have the proc file. Running ipvsadm as root should load LVS into the kernel if it is possible. @@ -362,7 +362,7 @@ For example, given a realserver with IP 172.16.1.2, service on port 4444, and a resolvable reverse DNS entry pointing to "realserver2.example.com" ldirectord -will check for the existance of the following files: +will check for the existence of the following files: =over @@ -407,7 +407,7 @@ ignored. Optionally a range of IPv4 addresses (or two hostnames) may be given, in which case each IPv4 address in the range will be treated as a real server using the given port. The second argument defines the forwarding -method, must be B, B or B. The thrid argument is +method, must be B, B or B. The third argument is optional and defines the weight for that real server. If omitted then a weight of 1 will be used. The last two arguments are also optional. They define a request-receive pair to be used to check if a server is alive. @@ -435,11 +435,11 @@ >B|B|B|B|B|B|B|BI Type of check to perform. Negotiate sends a request and matches a receive -string. Connect only attemts to make a TCP/IP connection, thus the +string. Connect only attempts to make a TCP/IP connection, thus the request and receive strings may be omitted. If checktype is a number then negotiate and connect is combined so that after each N connect attempts one negotiate attempt is performed. This is useful to check often if a service -answers and in much longer intervalls a negotiating check is done. Ping +answers and in much longer intervals a negotiating check is done. Ping means that ICMP ping will be used to test the availability of real servers. Ping is also used as the connect check for UDP services. Off means no checking will take place and no real or fallback servers will be activated. @@ -449,7 +449,7 @@ BB|B|B|B|B|B|B|B|B|B|B|B|B|B|B|B|B|B|B The type of service to monitor when using checktype=negotiate. None denotes -a service that will not be monitored. +a service that will not be monitored. simpletcp sends the B string to the server and tests it against the B regexp. The other types of checks connect to the server @@ -550,7 +550,7 @@ The data returned is not checked, only that the answer is one or more rows. This is a required setting. -For a simpletcp check, this string is sent verbatim except any occurances +For a simpletcp check, this string is sent verbatim except any occurrences of \n are replaced with a new line character. BIB<"> @@ -601,7 +601,7 @@ =item * MySQL Oracle, and PostgreSQL: Must be specified in the configuration =item * SIP: ldirectord\@, hostname is derived as per the passwd - option below. + option below. =item * Otherwise: empty string, which denotes that case authentication will not be attempted. @@ -785,7 +785,7 @@ $DAEMON_STATUS_RUNNING = 0x2; $DAEMON_STATUS_STOPPING = 0x4; $DAEMON_STATUS_RELOADING = 0x8; -$DAEMON_STATUS_ALL = $DAEMON_STATUS_STARTING | +$DAEMON_STATUS_ALL = $DAEMON_STATUS_STARTING | $DAEMON_STATUS_RUNNING | $DAEMON_STATUS_STOPPING | $DAEMON_STATUS_RELOADING; @@ -829,7 +829,7 @@ my $opt_h = ''; my $opt_v = ''; Getopt::Long::Configure ("bundling", "no_auto_abbrev", "require_order"); -GetOptions("debug|d" => \$opt_d, +GetOptions("debug|d" => \$opt_d, "help|h|?" => \$opt_h, "version|v" => \$opt_v) or usage(); @@ -884,31 +884,30 @@ &ld_rm_file("$RUNPID.$CFGNAME.pid"); &ld_exit(0, "Reached end of \"main\""); - # functions sub ld_init { # install signal handlers (this covers TERM) #require Net::LDAP; - $SIG{'INT'} = \&ld_handler_term; - $SIG{'QUIT'} = \&ld_handler_term; - $SIG{'ILL'} = \&ld_handler_term; - $SIG{'ABRT'} = \&ld_handler_term; - $SIG{'FPE'} = \&ld_handler_term; - $SIG{'SEGV'} = \&ld_handler_term; - $SIG{'TERM'} = \&ld_handler_term; - - $SIG{'BUS'} = \&ld_handler_term; - $SIG{'SYS'} = \&ld_handler_term; - $SIG{'XCPU'} = \&ld_handler_term; - $SIG{'XFSZ'} = \&ld_handler_term; + $SIG{'INT'} = \&ld_handler_term; + $SIG{'QUIT'} = \&ld_handler_term; + $SIG{'ILL'} = \&ld_handler_term; + $SIG{'ABRT'} = \&ld_handler_term; + $SIG{'FPE'} = \&ld_handler_term; + $SIG{'SEGV'} = \&ld_handler_term; + $SIG{'TERM'} = \&ld_handler_term; + + $SIG{'BUS'} = \&ld_handler_term; + $SIG{'SYS'} = \&ld_handler_term; + $SIG{'XCPU'} = \&ld_handler_term; + $SIG{'XFSZ'} = \&ld_handler_term; - $SIG{'IOT'} = \&ld_handler_term; + $SIG{'IOT'} = \&ld_handler_term; # This used to call a signal handler, that logged a message # However, this typically goes to syslog and if syslog - # is playing up a loop will occur. + # is playing up a loop will occur. $SIG{'PIPE'} = "IGNORE"; # HUP is actually used @@ -941,7 +940,7 @@ $CFGNAME = "ldirectord"; $CMD = $ARGV[0]; } - if ( $CMD ne "start" and $CMD ne "stop" and $CMD ne "status" + if ( $CMD ne "start" and $CMD ne "stop" and $CMD ne "status" and $CMD ne "restart" and $CMD ne "try-restart" and $CMD ne "reload" and $CMD ne "force-reload") { usage(); @@ -992,7 +991,7 @@ # wait until old pid file is removed sleep 1; } - # N.B Fall through + # N.B Fall through } elsif ($CMD eq "reload" or $CMD eq "force-reload") { kill 1, $oldpid; ld_exit(0, "Exiting from ldirectord $CMD"); @@ -1030,9 +1029,9 @@ # Run as daemon if ($SUPERVISED eq "yes" || $opt_d) { &ld_log("Starting $VERSION_STR with pid: $$"); - } else { + } else { &ld_log("Starting $VERSION_STR as daemon"); - open(FILE, ">$RUNPID.$CFGNAME.pid") || + open(FILE, ">$RUNPID.$CFGNAME.pid") || init_error("Can not open $RUNPID.$CFGNAME.pid"); &ld_daemon(); print FILE "$$\n"; @@ -1056,12 +1055,11 @@ ld_exit(1, "Initialisation Error"); } - # ld_handler_term -# If we get a sinal then log it and quit +# If we get a signal then log it and quit sub ld_handler_term { - my ($signal) = (@_); + my ($signal) = (@_); if (defined $DAEMON_TERM) { $SIG{'__DIE__'} = "IGNORE"; @@ -1216,7 +1214,8 @@ return $status; } -sub set_defaults { +sub set_defaults +{ $AUTOCHECK = "no"; $CALLBACK = undef; $CHECKCOUNT = 1; @@ -1282,21 +1281,21 @@ } $virtual_id = $ip_port = "[$v6addr]:$v6port"; } else { - &config_error($line, + &config_error($line, "invalid address for virtual server"); } my (%vsrv, @rsrv); if ($ip_port) { $vsrv{checktype} = "negotiate"; - $vsrv{protocol} = "tcp"; + $vsrv{protocol} = "tcp"; if ($ip_port =~ /:53$/) { $vsrv{protocol} = "udp"; } } else { - $vsrv{fwm} = $fwm; + $vsrv{fwm} = $fwm; $vsrv{checktype} = "negotiate"; - $vsrv{protocol} = "fwm"; + $vsrv{protocol} = "fwm"; $vsrv{service} = "none"; $vsrv{port} = "0"; } @@ -1350,29 +1349,29 @@ &config_error($line, "checktype must be \"connect\", \"negotiate\", \"on\", \"off\", \"ping\", \"external\", \"external-perl\" or a positive number"); } } elsif ($rcmd =~ /^checkcommand\s*=\s*\"(.*)\"/ or $rcmd =~ /^checkcommand\s*=\s*(.*)/){ - $1 =~ /(.+)/ or &config_error($line, "invalid check command"); - $vsrv{checkcommand} = $1; + $1 =~ /(.+)/ or &config_error($line, "invalid check command"); + $vsrv{checkcommand} = $1; } elsif ($rcmd =~ /^checktimeout\s*=\s*(.*)/){ - $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check timeout"); - $vsrv{checktimeout} = $1; + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check timeout"); + $vsrv{checktimeout} = $1; } elsif ($rcmd =~ /^connecttimeout\s*=\s*(.*)/){ &config_error($line, "connecttimeout directive " . "deprecated in favour of " . "negotiatetimeout"); } elsif ($rcmd =~ /^negotiatetimeout\s*=\s*(.*)/){ - $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid negotiate timeout"); - $vsrv{negotiatetimeout} = $1; + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid negotiate timeout"); + $vsrv{negotiatetimeout} = $1; } elsif ($rcmd =~ /^checkcount\s*=\s*(.*)/){ - $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check count"); - $vsrv{checkcount} = $1; - &config_warn($line, "checkcount option is deprecated and slated for removal. please see 'failurecount'"); + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check count"); + $vsrv{checkcount} = $1; + &config_warn($line, "checkcount option is deprecated and slated for removal. please see 'failurecount'"); } elsif ($rcmd =~ /^failurecount\s*=\s*(.*)/){ - $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid failure count"); - $vsrv{failurecount} = $1; + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid failure count"); + $vsrv{failurecount} = $1; } elsif ($rcmd =~ /^checkinterval\s*=\s*(.*)/){ - $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid checkinterval"); - $vsrv{checkinterval} = $1 + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid checkinterval"); + $vsrv{checkinterval} = $1 } elsif ($rcmd =~ /^checkport\s*=\s*(.*)/){ $1 =~ /(\d+)/ or &config_error($line, "invalid port"); ( $1 > 0 && $1 < 65536 ) or &config_error($line, "checkport must be in range 1..65536"); @@ -1393,22 +1392,22 @@ $1 =~ /(\w+)/ or &config_error($line, "invalid string for load testing"); $vsrv{load} = $1; } elsif ($rcmd =~ /^scheduler\s*=\s*(.*)/) { - # Intentonally ommit checking the + # Intentionally ommit checking the # scheduler against a list of know # schedulers. This is because from - # time to time new shedulers are + # time to time new schedulers are # added. But ldirectord is # maintained distributed - # independantly of this. Thus + # independently of this. Thus # ldirectord needs to be manually # updated/upgraded. So just accept - # any schedluer that matches + # any scheduler that matches # [a-z]+. I.e. is syntactically # correct (all schedulers so far # match that pattern). Ipvsadm will - # report an error is a sheduler + # report an error is a scheduler # isn't available / doesn't exist. - $1 =~ /([a-z]+)/ + $1 =~ /([a-z]+)/ or &config_error($line, "invalid scheduler, should be only lowercase letters (a-z)"); $vsrv{scheduler} = $1; } elsif ($rcmd =~ /^persistent\s*=\s*(.*)/) { @@ -1470,15 +1469,15 @@ "simpletcp, " . "sip or smtp"); $vsrv{service} = $1; - if($vsrv{service} eq "ftp" and + if($vsrv{service} eq "ftp" and $vsrv{login} eq "") { $vsrv{login} = "anonymous"; } - elsif($vsrv{service} eq "sip" and + elsif($vsrv{service} eq "sip" and $vsrv{login} eq "") { $vsrv{login} = "ldirectord\@$HOSTNAME"; } - if($vsrv{service} eq "ftp" and + if($vsrv{service} eq "ftp" and $vsrv{passwd} eq "") { $vsrv{passwd} = "ldirectord\@$HOSTNAME"; } @@ -1497,11 +1496,11 @@ \%vsrv); } elsif ($rcmd =~ /^fallbackcommand\s*=\s*\"(.*)\"/ or $rcmd =~ /^fallbackcommand\s*=\s*(.*)/) { - $1 =~ /(.+)/ or &config_error($line, "invalid fallback command"); - $vsrv{fallbackcommand} = $1; - } elsif ($rcmd =~ /^quiescent\s*=\s*(.*)/) { - ($1 eq "yes" || $1 eq "no") - or &config_error($line, "quiescent must be 'yes' or 'no'"); + $1 =~ /(.+)/ or &config_error($line, "invalid fallback command"); + $vsrv{fallbackcommand} = $1; + } elsif ($rcmd =~ /^quiescent\s*=\s*(.*)/) { + ($1 eq "yes" || $1 eq "no") + or &config_error($line, "quiescent must be 'yes' or 'no'"); $vsrv{quiescent} = $1; } elsif ($rcmd =~ /^emailalert\s*=\s*(.*)/) { $1 =~ /(.+)/ or &config_error($line, "no email address specified"); @@ -1511,13 +1510,14 @@ $vsrv{emailalertfreq} = $1; } elsif ($rcmd =~ /^emailalertstatus\s*=\s*(.*)/) { $vsrv{emailalertstatus} = &parse_emailalertstatus($line, $1); - } elsif ($rcmd =~ /^monitorfile\s*=\s*(.*)/) { + } elsif ($rcmd =~ /^monitorfile\s*=\s*\"(.*)\"/ or + $rcmd =~ /^monitorfile\s*=\s*(.*)/) { my $monitorfile = $1; unless (open(MONITORFILE, ">>$monitorfile") and close(MONITORFILE)) { &config_error($line, "unable to open monitorfile $monitorfile: $!"); } $vsrv{monitorfile} = $monitorfile; - } elsif ($rcmd =~ /^cleanstop\s*=\s*(.*)/) { + } elsif ($rcmd =~ /^cleanstop\s*=\s*(.*)/) { ($1 eq "yes" || $1 eq "no") or &config_error($line, "cleanstop must be 'yes' or 'no'"); $vsrv{cleanstop} = $1; @@ -1530,12 +1530,12 @@ undef $linedata; } # As the protocol needs to be known to call - # getservbyname() all resolution must be + # getservbyname() all resolution must be # delayed until the protocol is finalised. # That is after the entire configuration # for a virtual service has been parsed. - &_ld_read_config_fallback_resolve($fallback_line, + &_ld_read_config_fallback_resolve($fallback_line, $vsrv{protocol}, $vsrv{fallback}); &_ld_read_config_virtual_resolve($virtual_line, \%vsrv, $ip_port); @@ -1545,7 +1545,7 @@ # information to generate the id $virtual_id = get_virtual_id_str(\%vsrv); if (defined $virtual_seen{$virtual_id}) { - &config_error($line, + &config_error($line, "duplicate virtual server"); } $virtual_seen{$virtual_id} = 1; @@ -1558,7 +1558,7 @@ } next if ($linedata =~ /^\s*$/ || $linedata =~ /^\s*#/); if ($linedata =~ /^checktimeout\s*=\s*(.*)/) { - ($1 =~ /(\d+)/ && $1 && $1>0) or &config_error($line, + ($1 =~ /(\d+)/ && $1 && $1>0) or &config_error($line, "invalid check timeout value"); $CHECKTIMEOUT = $1; } elsif ($linedata =~ /^connecttimeout\s*=\s*(.*)/) { @@ -1567,15 +1567,15 @@ "deprecated in favour of " . "negotiatetimeout"); } elsif ($linedata =~ /^negotiatetimeout\s*=\s*(.*)/) { - ($1 =~ /(\d+)/ && $1 && $1>0) or &config_error($line, + ($1 =~ /(\d+)/ && $1 && $1>0) or &config_error($line, "invalid negotiate timeout value"); $NEGOTIATETIMEOUT = $1; } elsif ($linedata =~ /^checkinterval\s*=\s*(.*)/) { - $1 =~ /(\d+)/ && $1 or &config_error($line, + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check interval value"); $CHECKINTERVAL = $1; } elsif ($linedata =~ /^checkcount\s*=\s*(.*)/) { - $1 =~ /(\d+)/ && $1 or &config_error($line, + $1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check count value"); $CHECKCOUNT = $1; &config_warn($line, "checkcount option is deprecated and slated for removal. please see 'failurecount'"); @@ -1586,7 +1586,7 @@ } elsif ($linedata =~ /^fallback\s*=\s*(.*)/) { my $tcp = parse_fallback($line, $1, undef); my $udp = parse_fallback($line, $1, undef); - &_ld_read_config_fallback_resolve($line, "tcp", $tcp); + &_ld_read_config_fallback_resolve($line, "tcp", $tcp); &_ld_read_config_fallback_resolve($line, "udp", $udp); $FALLBACK = { "tcp" => $tcp, "udp" => $udp }; } elsif ($linedata =~ /^fallbackcommand\s*=\s*(.*)/) { @@ -1594,8 +1594,8 @@ $FALLBACKCOMMAND = $1; } elsif ($linedata =~ /^autoreload\s*=\s*(.*)/) { ($1 eq "yes" || $1 eq "no") - or &config_error($line, - "autoreload must be 'yes' or 'no'"); + or &config_error($line, + "autoreload must be 'yes' or 'no'"); $AUTOCHECK = $1; } elsif ($linedata =~ /^callback\s*=\s*\"(.*)\"/) { $CALLBACK = $1; @@ -1604,15 +1604,15 @@ $LDIRLOG = $1; if (&ld_openlog()) { $LDIRLOG = $tmpLDIRLOG; - &config_error($line, + &config_error($line, "unable to open logfile: $1"); } } elsif ($linedata =~ /^execute\s*=\s*(.*)/) { $LD_INSTANCE{$1} = 1; - } elsif ($linedata =~ /^fork\s*=\s*(.*)/) { - ($1 eq "yes" || $1 eq "no") - or &config_error($line, "fork must be 'yes' or 'no'"); - $FORKING = $1; + } elsif ($linedata =~ /^fork\s*=\s*(.*)/) { + ($1 eq "yes" || $1 eq "no") + or &config_error($line, "fork must be 'yes' or 'no'"); + $FORKING = $1; } elsif ($linedata =~ /^supervised/) { if (($linedata =~ /^supervised\s*=\s*(.*)/) and ($1 eq "yes" || $1 eq "no")) { @@ -1630,8 +1630,8 @@ } } elsif ($linedata =~ /^quiescent\s*=\s*(.*)/) { ($1 eq "yes" || $1 eq "no") - or &config_error($line, - "quiescent must be 'yes' or 'no'"); + or &config_error($line, + "quiescent must be 'yes' or 'no'"); $QUIESCENT = $1; } elsif ($linedata =~ /^emailalert\s*=\s*(.*)/) { $1 =~ /(.+)/ or &config_error($line, @@ -1663,7 +1663,7 @@ "maintenance directory does not exist"); } else { if ($linedata =~ /^timeout\s*=\s*(.*)/) { - &config_error($line, + &config_error($line, "timeout directive " . "deprecated in favour of " . "checktimeout and " . @@ -1688,9 +1688,8 @@ return(0); } - # _ld_read_config_virtual_resolve -# Note: Should not need to be called direclty, but won't do any damage if +# Note: Should not need to be called directly, but won't do any damage if # you do. # Resolve the server (ip address) and port for a virtual service # pre: line: Line of configuration file fallback server was read from @@ -1705,7 +1704,6 @@ # return: none # Debugging message will be reported and programme will exit # on error. - sub _ld_read_config_virtual_resolve { my($line, $vsrv, $ip_port)=(@_); @@ -1719,7 +1717,7 @@ ($vsrv->{server}, $vsrv->{port}) = split /:/, $ip_port; } else { - &config_error($line, + &config_error($line, "invalid address for virtual service"); } @@ -1729,13 +1727,11 @@ } } - # ld_service_to_port # Resolve an ldirectord service name from its port number # pre: port: port number of the service # return: port name # "none" if the service is unknown - sub ld_port_to_service { my ($port) = (@_); @@ -1761,13 +1757,11 @@ return "none"; } - # ld_service_to_port # Resolve the port number from an ldirectord service name # pre: service: name of the service # return: port number # undef if the service is unknown - sub ld_service_to_port { my ($service) = (@_); @@ -1793,16 +1787,14 @@ return undef; } - # ld_checkport # Resolve the port to connect to for service checks # Note: Should only be used inside service checks, # as its not the same as the port of the real server # pre: v: virtual service -# r: real servier +# r: real server # return: port number # undef if the service is unknown - sub ld_checkport { my ($v, $r) = (@_); @@ -1817,9 +1809,8 @@ return ld_service_to_port($v->{service}); } - # _ld_read_config_fallback_resolve -# Note: Should not need to be called direclty, but won't do any damage if +# Note: Should not need to be called directly, but won't do any damage if # you do. # Resolve the fallback server for a virtual service # pre: line: Line of configuration file fallback server was read from @@ -1827,47 +1818,44 @@ # vsrv: Virtual Service to resolve fallback server of # post: Take $vsrv->{fallback}, resolve it as per ld_gethostservbyname # and set $vsrv->{fallback} to the result -# reurn: none -# Debugging message will be reported and programme will exit -# on error. - +# return: none +# Debugging message will be reported and programme will exit +# on error. sub _ld_read_config_fallback_resolve { my($line, $protocol, $fallback)=(@_); - unless($fallback) { - return; - } + unless($fallback) { + return; + } $fallback->{server} = &ld_gethostbyname($fallback->{server}) or - &config_error($line, "invalid address for fallback server: " . + &config_error($line, "invalid address for fallback server: " . $fallback->{server}); - unless($fallback->{"port"}) { - return; - } + unless($fallback->{"port"}) { + return; + } $fallback->{port} = &ld_getservbyname($fallback->{port}, $protocol) or - &config_error($line, "invalid port for fallback server"); + &config_error($line, "invalid port for fallback server"); } - # _ld_read_config_real_resolve -# Note: Should not need to be called direclty, but won't do any damage if +# Note: Should not need to be called directly, but won't do any damage if # you do. -# Run thourgh the list of real servers read in the configuration file for a +# Run through the list of real servers read in the configuration file for a # virtual server and parse these entries # pre: vsrv: Virtual Service to parse real servers for # rsrv_todo: List of real servers read from config but not parsed. -# List is a list of list reference. The firest element in +# List is a list of list reference. The first element in # each list reference is the line read from the # configuration after "real=". The second element is the # line number, used for error reporting # post: Run through rsrv_todo and parse real servers -# reurn: none -# Debugging message will be reported and programme will exit -# on error. - +# return: none +# Debugging message will be reported and programme will exit +# on error. sub _ld_read_config_real_resolve { my ($vsrv, $rsrv_todo)=(@_); @@ -1886,50 +1874,49 @@ for $i (@$rsrv_todo) { ($str, $line)=@$i; $str =~ /(\d+\.\d+\.\d+\.\d+|[A-Za-z0-9.-]+|\[[0-9A-fa-f:]+\])(->(\d+\.\d+\.\d+\.\d+|[A-Za-z0-9.-]+|\[[0-9A-fa-f:]+\]))?(:(\d+|[A-Za-z0-9-]+))?\s+(.*)/ - or &config_error($line, + or &config_error($line, "invalid address for real server" . - " (wrong format)"); + " (wrong format)"); $ip1=$1; $ip2=$3; - if(defined($5)){ - $port=$5; - } - else { - $port="0"; - } + if(defined($5)){ + $port=$5; + } + else { + $port="0"; + } $flags=$6; $resolved_ip1=&ld_gethostbyname($ip1); - unless( defined($resolved_ip1) ) { - &config_error($line, - "invalid address ($ip1) for real server" . - " (could not resolve host)"); - } + unless( defined($resolved_ip1) ) { + &config_error($line, + "invalid address ($ip1) for real server" . + " (could not resolve host)"); + } if( defined($port) ){ $resolved_port=&ld_getservbyname($port); - unless( defined($resolved_port) ){ - &config_error($line, - "invalid port ($port) for real server" . - " (could not resolve port)"); - } + unless( defined($resolved_port) ){ + &config_error($line, + "invalid port ($port) for real server" . + " (could not resolve port)"); + } } if ( defined ($ip2) ) { $resolved_ip2=&ld_gethostbyname($ip2); - unless( defined ($resolved_ip2) ) { - &config_error($line, - "invalid address ($ip2) for " . + unless( defined ($resolved_ip2) ) { + &config_error($line, + "invalid address ($ip2) for " . "real server" . - " (could not resolve end host)"); - } - &add_real_server_range($line, $vsrv, $resolved_ip1, + " (could not resolve end host)"); + } + &add_real_server_range($line, $vsrv, $resolved_ip1, $resolved_ip2, $resolved_port, $flags); } else { - &add_real_server($line, $vsrv, $resolved_ip1, + &add_real_server($line, $vsrv, $resolved_ip1, $resolved_port, $flags); } } } - # add_real_server_range # Add a real server for each IP address in a range # pre: line: line number real server was read from @@ -1944,12 +1931,11 @@ # return: none # Debugging message will be reported and programme will exit # on error. - sub add_real_server_range { my ($line, $vsrv, $first, $last, $port, $flags) = (@_); - my (@tmp, $first_i, $last_i, $i, $rsrv); + my (@tmp, $first_i, $last_i, $i, $rsrv); if ( ($first_i=&ip_to_int($first)) <0 ) { &config_error($line, "Invalid IP address: $first"); @@ -1959,7 +1945,7 @@ } if ($first_i>$last_i) { - &config_error($line, + &config_error($line, "Invalid Range: $first-$last: First value must be " . "greater than or equal to the second value"); } @@ -1972,7 +1958,6 @@ } } - # add_real_server # Add a real server to a virtual # pre: line: line number real server was read from @@ -1986,7 +1971,6 @@ # return: none # Debugging message will be reported and programme will exit # on error. - sub add_real_server { my ($line, $vsrv, $ip, $port, $flags) = (@_); @@ -2000,8 +1984,7 @@ $new_rsrv = {"server"=>$ip, "port"=>$port}; $flags =~ /(\w+)(.*)/ && ($1 eq "gate" || $1 eq "masq" || $1 eq "ipip") - or &config_error($line, - "forward method must be gate, masq or ipip"); + or &config_error($line, "forward method must be gate, masq or ipip"); $new_rsrv->{"forward"} =$1; $flags = $2; @@ -2029,7 +2012,7 @@ push(@$rsrv, $new_rsrv); - my $real = get_real_id_str($new_rsrv, $vsrv); + my $real = get_real_id_str($new_rsrv, $vsrv); my $virtual = get_virtual_id_str($vsrv); for my $r (@REAL){ if($r->{"real"} eq $real){ @@ -2044,7 +2027,6 @@ } } - # parse_fallback # Parse a fallback server # pre: line: line number real server was read from @@ -2056,7 +2038,6 @@ # { server => blah, forward => blah } # Debugging message will be reported and programme will exit # on error. - sub parse_fallback { my ($line, $fallback, $vsrv) = (@_); @@ -2065,37 +2046,36 @@ my $port; my $fwd; - $fallback =~ /^\s*([^: ]+)(:(\S+))?(\s+(\S+))?\s*/ or - &config_error($line, "invalid fallback server: $fallback"); + $fallback =~ /^\s*([^: ]+)(:(\S+))?(\s+(\S+))?\s*/ or + &config_error($line, "invalid fallback server: $fallback"); - $server=$1; - $port=$3; - $fwd=$5; + $server=$1; + $port=$3; + $fwd=$5; if (not defined($port) and defined($vsrv)) { $port = $vsrv->{"port"}; } - if($fwd) { - ($fwd eq "gate" || $fwd eq "masq" || $fwd eq "ipip") - or &config_error($line, - "forward method must be gate, masq or ipip"); - } - else { - $fwd="gate" - } + if($fwd) { + ($fwd eq "gate" || $fwd eq "masq" || $fwd eq "ipip") + or &config_error($line, + "forward method must be gate, masq or ipip"); + } + else { + $fwd="gate" + } return({"server"=>$server, "port"=>$port, "forward"=>$fwd, "weight"=>1}); } - sub __config_log { my ($line, $prefix, $msg) = @_; - chomp($msg); - $msg .= "\n"; + chomp($msg); + $msg .= "\n"; my $msg_prefix = "$prefix [$$]"; if ($line > 0) { @@ -2105,13 +2085,12 @@ if ($opt_d or $DAEMON_STATUS == $DAEMON_STATUS_STARTING) { print STDERR $msg; - } + } else { &ld_log("$msg"); } } - sub config_warn { my ($line, $msg) = @_; @@ -2119,7 +2098,6 @@ __config_log($line, "Warning", $msg); } - sub config_error { my ($line, $msg) = @_; @@ -2133,7 +2111,6 @@ } } - sub ld_setup { for my $v (@VIRTUAL) { @@ -2152,7 +2129,7 @@ } my $real = $$v{real}; for my $r (@$real) { - $$r{forw} = get_forward_flag($$r{forward}); + $$r{forw} = get_forward_flag($$r{forward}); my $port=ld_checkport($v, $r); my $schema = $$v{service}; @@ -2160,7 +2137,7 @@ $schema = 'http'; } - if (defined $$r{request} && defined $$r{receive}) { + if (defined $$r{request} && defined $$r{receive}) { my $uri = $$r{request}; $uri =~ s/^\///g; if ($$r{request} =~ /$schema:\/\//) { @@ -2178,8 +2155,8 @@ $$r{url} = "$schema:\/\/$$r{server}:$port\/$uri"; } - $$r{request} = $$v{request} unless defined $$r{request}; - $$r{receive} = $$v{receive}; + $$r{request} = $$v{request} unless defined $$r{request}; + $$r{receive} = $$v{receive}; } if ($$v{checktype} eq "combined") { $$r{num_connects} = 999999; @@ -2188,9 +2165,9 @@ } } - # checktimeout and negotiate timeout are + # checktimeout and negotiate timeout are # mutual defaults for each other, so calculate - # checktimeout in a tempoary variable so as not + # checktimeout in a temporary variable so as not # to affect the calculation of negotiatetimeout. my $checktimeout = $$v{checktimeout}; @@ -2238,8 +2215,8 @@ # putting IO into slurp (whole file at a time, rather than line at a time) # mode. Net::FTP does this using local $\, which should mean # that the change doesn' effect code here, but it does. It also -# seems to be imposible to turn it off, by say setting $\ back to '\n' -# Perhaps there is more to this than meets the eye. Perhaps its a perl bug. +# seems to be impossible to turn it off, by say setting $\ back to '\n' +# Perhaps there is more to this than meets the eye. Perhaps it's a perl bug. # In any case, this should fix the problem. # # This should not affect pid or config file parsing as they are called @@ -2274,7 +2251,7 @@ # ld_read_ipvsadm # Parses the output of "ipvsadm -L -n" and puts into a structure of # the following from: -# +# # { # (vip_address:vport|fwmark) protocol => { # "scheduler" => scheduler, @@ -2290,25 +2267,24 @@ # }, # ... # } -# -# where: +# +# where: # vip_address: IP address of virtual service # vport: Port of virtual service # fwmark: Firewall Mark of virtual service # scheduler: Scheduler for virtual service -# timeout: Timeout for persistancy. Omitted if service is not persistant. -# nemask: Netmask for persistancy. Omitted if service is not persistant. +# timeout: Timeout for persistency. Omitted if service is not persistent. +# nemask: Netmask for persistency. Omitted if service is not persistent. # # rip_address: IP address of real server # rport: Port of real server -# forwarding_mechanism: Forwarding mechanism for real server. +# forwarding_mechanism: Forwarding mechanism for real server. # One of: gate, ipip, masq. # weight: Weight of real server # # pre: none # post: ipvsadm -L -n is parsed # result: reference to sructure detailed above. - sub ld_read_ipvsadm { my %oldsrv; @@ -2320,12 +2296,12 @@ # read status of current ipvsadm -L -n unless(open($fh, "$IPVSADM -L -n 2>&1|")){ - &ld_exit(1, "Could not run $IPVSADM -L -n: $!"); - } + &ld_exit(1, "Could not run $IPVSADM -L -n: $!"); + } # Skip the first three lines - $line = ld_readline($fh, $buf); - $line = ld_readline($fh, $buf); + $line = ld_readline($fh, $buf); + $line = ld_readline($fh, $buf); $line = ld_readline($fh, $buf); while (1) { @@ -2365,7 +2341,7 @@ } close($fh); - return(\%oldsrv); + return(\%oldsrv); } sub ld_start @@ -2377,7 +2353,7 @@ my $server_down = {}; # read status of current ipvsadm -L -n - $oldsrv=&ld_read_ipvsadm(); + $oldsrv=&ld_read_ipvsadm(); # make sure virtual servers are up to date foreach $nv (@VIRTUAL) { @@ -2433,7 +2409,7 @@ } for my $k (keys (%$server_down)) { - my $v = $server_down->{$k}; + my $v = $server_down->{$k}; service_set(@$v[0], @$v[1], "down", {force => 1}); delete($server_down->{$k}); #sleep 5; @@ -2441,7 +2417,7 @@ # remove remaining entries for virtual servers foreach $nv (@OLDVIRTUAL) { - if (! defined($oldsrv->{&get_virtual($nv) . " " . + if (! defined($oldsrv->{&get_virtual($nv) . " " . $nv->{protocol}})) { next; } @@ -2449,7 +2425,6 @@ } } - sub ld_cmd_children { my ($cmd, %children) = (@_); @@ -2467,7 +2442,6 @@ } } - sub ld_stop { # Kill children @@ -2491,185 +2465,184 @@ } } - sub ld_main { # Main failover checking code while (1) { - if ($FORKING eq 'yes') { - foreach my $v (@VIRTUAL) { - my $virtual_id = get_virtual_id_str($v); - if (!exists($FORK_CHILDREN{$virtual_id})) { - &ld_log("Child not running for $virtual_id, spawning"); - my $pid = fork; - if (!defined($pid)) { - &ld_log("fork failed"); - } elsif ($pid == 0) { - run_child($v); - } else { - $FORK_CHILDREN{get_virtual_id_str($v)} = $pid; - &ld_log("Spawned child $virtual_id PID=$pid"); - } - } elsif (waitpid($FORK_CHILDREN{get_virtual_id_str($v)}, WNOHANG)) { - delete $FORK_CHILDREN{get_virtual_id_str($v)}; - } - } - check_signal(); - if (!check_cfgfile()) { - sleep 1; - } - - check_signal(); - - } else { - my @real_checked; - foreach my $v (@VIRTUAL) { - my $real = $$v{real}; - my $virtual_id = get_virtual_id_str($v); - - REAL: foreach my $r (@$real) { - my $real_id = get_real_id_str($r, $v); - check_signal(); - foreach my $tmp_id (@real_checked) { - if($real_id eq $tmp_id) { - &ld_debug(3, "Already checked: real server=$real_id (virtual=$virtual_id)"); - next REAL; - } - } - _check_real($v, $r); - push(@real_checked, $real_id); - } - } - check_signal(); - if (!check_cfgfile()) { - sleep $CHECKINTERVAL; - } - - check_signal(); - ld_emailalert_resend(); - - check_signal(); - } + if ($FORKING eq 'yes') { + foreach my $v (@VIRTUAL) { + my $virtual_id = get_virtual_id_str($v); + if (!exists($FORK_CHILDREN{$virtual_id})) { + &ld_log("Child not running for $virtual_id, spawning"); + my $pid = fork; + if (!defined($pid)) { + &ld_log("fork failed"); + } elsif ($pid == 0) { + run_child($v); + } else { + $FORK_CHILDREN{get_virtual_id_str($v)} = $pid; + &ld_log("Spawned child $virtual_id PID=$pid"); + } + } elsif (waitpid($FORK_CHILDREN{get_virtual_id_str($v)}, WNOHANG)) { + delete $FORK_CHILDREN{get_virtual_id_str($v)}; + } + } + check_signal(); + if (!check_cfgfile()) { + sleep 1; + } + + check_signal(); + + } else { + my @real_checked; + foreach my $v (@VIRTUAL) { + my $real = $$v{real}; + my $virtual_id = get_virtual_id_str($v); + + REAL: foreach my $r (@$real) { + my $real_id = get_real_id_str($r, $v); + check_signal(); + foreach my $tmp_id (@real_checked) { + if($real_id eq $tmp_id) { + &ld_debug(3, "Already checked: real server=$real_id (virtual=$virtual_id)"); + next REAL; + } + } + _check_real($v, $r); + push(@real_checked, $real_id); + } + } + check_signal(); + if (!check_cfgfile()) { + sleep $CHECKINTERVAL; + } + + check_signal(); + ld_emailalert_resend(); + + check_signal(); + } } } sub run_child { - my $v = shift; - # Just exit on signals - $SIG{'INT'} = "DEFAULT"; - $SIG{'QUIT'} = "DEFAULT"; - $SIG{'ILL'} = "DEFAULT"; - $SIG{'ABRT'} = "DEFAULT"; - $SIG{'FPE'} = "DEFAULT"; - $SIG{'SEGV'} = "DEFAULT"; - $SIG{'TERM'} = "DEFAULT"; - - $SIG{'BUS'} = "DEFAULT"; - $SIG{'SYS'} = "DEFAULT"; - $SIG{'XCPU'} = "DEFAULT"; - $SIG{'XFSZ'} = "DEFAULT"; - - $SIG{'IOT'} = "DEFAULT"; - - $SIG{'PIPE'} = "IGNORE"; - $SIG{'HUP'} = sub { exit 1 }; - - my $real = $$v{real}; - my $virtual_id = get_virtual_id_str($v); - my $checkinterval = $$v{checkinterval} || $CHECKINTERVAL; - $0 = "ldirectord $virtual_id"; - while (1) { - foreach my $r (@$real) { - $0 = "ldirectord $virtual_id checking $$r{server}"; - _check_real($v, $r); - } - $0 = "ldirectord $virtual_id"; - sleep $checkinterval; - ld_emailalert_resend(); - } + my $v = shift; + # Just exit on signals + $SIG{'INT'} = "DEFAULT"; + $SIG{'QUIT'} = "DEFAULT"; + $SIG{'ILL'} = "DEFAULT"; + $SIG{'ABRT'} = "DEFAULT"; + $SIG{'FPE'} = "DEFAULT"; + $SIG{'SEGV'} = "DEFAULT"; + $SIG{'TERM'} = "DEFAULT"; + + $SIG{'BUS'} = "DEFAULT"; + $SIG{'SYS'} = "DEFAULT"; + $SIG{'XCPU'} = "DEFAULT"; + $SIG{'XFSZ'} = "DEFAULT"; + + $SIG{'IOT'} = "DEFAULT"; + + $SIG{'PIPE'} = "IGNORE"; + $SIG{'HUP'} = sub { exit 1 }; + + my $real = $$v{real}; + my $virtual_id = get_virtual_id_str($v); + my $checkinterval = $$v{checkinterval} || $CHECKINTERVAL; + $0 = "ldirectord $virtual_id"; + while (1) { + foreach my $r (@$real) { + $0 = "ldirectord $virtual_id checking $$r{server}"; + _check_real($v, $r); + } + $0 = "ldirectord $virtual_id"; + sleep $checkinterval; + ld_emailalert_resend(); + } } sub _check_real { - my $v = shift; - my $r = shift; + my $v = shift; + my $r = shift; - my $real_id = get_real_id_str($r, $v); - my $virtual_id = get_virtual_id_str($v); + my $real_id = get_real_id_str($r, $v); + my $virtual_id = get_virtual_id_str($v); if (_check_real_for_maintenance($r)) { service_set($v, $r, "down", {do_log => 1, force => 1}, "Server in maintenance"); return; } elsif ($$v{checktype} eq "negotiate" || $$r{num_connects}>=$$v{num_connects}) { - &ld_debug(2, "Checking negotiate: real server=$real_id (virtual=$virtual_id)"); - if (grep $$v{service} eq $_, ("http", "https", "http_proxy")) { - $$r{num_connects} = 0 if (check_http($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "pop") { - $$r{num_connects} = 0 if (check_pop($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "pops") { - $$r{num_connects} = 0 if (check_pops($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "imap") { - $$r{num_connects} = 0 if (check_imap($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "imaps") { - $$r{num_connects} = 0 if (check_imaps($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "smtp") { - $$r{num_connects} = 0 if (check_smtp($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "ftp") { - $$r{num_connects} = 0 if (check_ftp($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "ldap") { - $$r{num_connects} = 0 if (check_ldap($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "nntp") { - $$r{num_connects} = 0 if (check_nntp($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "dns") { - $$r{num_connects} = 0 if (check_dns($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "sip") { - $$r{num_connects} = 0 if (check_sip($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "radius") { - $$r{num_connects} = 0 if (check_radius($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "mysql") { - $$r{num_connects} = 0 if (check_mysql($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "pgsql") { - $$r{num_connects} = 0 if (check_pgsql($v, $r) == $SERVICE_UP); - } elsif ($$v{service} eq "oracle") { - $$r{num_connects} = 0 if (check_oracle($v, $r) == $SERVICE_UP); + &ld_debug(2, "Checking negotiate: real server=$real_id (virtual=$virtual_id)"); + if (grep $$v{service} eq $_, ("http", "https", "http_proxy")) { + $$r{num_connects} = 0 if (check_http($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "pop") { + $$r{num_connects} = 0 if (check_pop($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "pops") { + $$r{num_connects} = 0 if (check_pops($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "imap") { + $$r{num_connects} = 0 if (check_imap($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "imaps") { + $$r{num_connects} = 0 if (check_imaps($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "smtp") { + $$r{num_connects} = 0 if (check_smtp($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "ftp") { + $$r{num_connects} = 0 if (check_ftp($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "ldap") { + $$r{num_connects} = 0 if (check_ldap($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "nntp") { + $$r{num_connects} = 0 if (check_nntp($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "dns") { + $$r{num_connects} = 0 if (check_dns($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "sip") { + $$r{num_connects} = 0 if (check_sip($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "radius") { + $$r{num_connects} = 0 if (check_radius($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "mysql") { + $$r{num_connects} = 0 if (check_mysql($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "pgsql") { + $$r{num_connects} = 0 if (check_pgsql($v, $r) == $SERVICE_UP); + } elsif ($$v{service} eq "oracle") { + $$r{num_connects} = 0 if (check_oracle($v, $r) == $SERVICE_UP); } elsif ($$v{service} eq "simpletcp") { $$r{num_connects} = 0 if (check_simpletcp($v, $r) == $SERVICE_UP); - } else { - $$r{num_connects} = 0 if (check_none($v, $r) == $SERVICE_UP); - } - } elsif ($$v{checktype} eq "connect") { - if ($$v{protocol} ne "udp") { - &ld_debug(2, "Checking connect: real server=$real_id (virtual=$virtual_id)"); - check_connect($v, $r); - } - else { - &ld_debug(2, "Checking connect (ping): real server=$real_id (virtual=$virtual_id)"); - check_ping($v, $r); - } - } elsif ($$v{checktype} eq "ping") { - &ld_debug(2, "Checking ping: real server=$real_id (virtual=$virtual_id)"); - check_ping($v, $r); - } elsif ($$v{checktype} eq "external") { - &ld_debug(2, "Checking external: real server=$real_id (virtual=$virtual_id)"); - check_external($v, $r); - } elsif ($$v{checktype} eq "external-perl") { - &ld_debug(2, "Checking external-perl: real server=$real_id (virtual=$virtual_id)"); - check_external_perl($v, $r); - } elsif ($$v{checktype} eq "off") { - &ld_debug(2, "Checking off: No real or fallback servers to be added\n"); - } elsif ($$v{checktype} eq "on") { - &ld_debug(2, "Checking on: Real servers are added without any checks\n"); - &service_set($v, $r, "up"); - } elsif ($$v{checktype} eq "combined") { - &ld_debug(2, "Checking combined-connect: real server=$real_id (virtual=$virtual_id)"); - if (check_connect($v, $r) == $SERVICE_UP) { - $$r{num_connects}++; - } else { - $$r{num_connects} = 999999; - } - } + } else { + $$r{num_connects} = 0 if (check_none($v, $r) == $SERVICE_UP); + } + } elsif ($$v{checktype} eq "connect") { + if ($$v{protocol} ne "udp") { + &ld_debug(2, "Checking connect: real server=$real_id (virtual=$virtual_id)"); + check_connect($v, $r); + } + else { + &ld_debug(2, "Checking connect (ping): real server=$real_id (virtual=$virtual_id)"); + check_ping($v, $r); + } + } elsif ($$v{checktype} eq "ping") { + &ld_debug(2, "Checking ping: real server=$real_id (virtual=$virtual_id)"); + check_ping($v, $r); + } elsif ($$v{checktype} eq "external") { + &ld_debug(2, "Checking external: real server=$real_id (virtual=$virtual_id)"); + check_external($v, $r); + } elsif ($$v{checktype} eq "external-perl") { + &ld_debug(2, "Checking external-perl: real server=$real_id (virtual=$virtual_id)"); + check_external_perl($v, $r); + } elsif ($$v{checktype} eq "off") { + &ld_debug(2, "Checking off: No real or fallback servers to be added\n"); + } elsif ($$v{checktype} eq "on") { + &ld_debug(2, "Checking on: Real servers are added without any checks\n"); + &service_set($v, $r, "up"); + } elsif ($$v{checktype} eq "combined") { + &ld_debug(2, "Checking combined-connect: real server=$real_id (virtual=$virtual_id)"); + if (check_connect($v, $r) == $SERVICE_UP) { + $$r{num_connects}++; + } else { + $$r{num_connects} = 999999; + } + } } sub _check_real_for_maintenance @@ -2723,7 +2696,7 @@ &ld_debug(2, "check_http: url=\"$$r{url}\" " . "virtualhost=\"$virtualhost\""); - + my $ua = new LWP::UserAgent(); my $h = undef; @@ -2742,7 +2715,7 @@ # of being cumulative timeout, rather than a per send/receive # timeout. eval { - # LWP makes ungaurded calls to eval + # LWP makes unguarded calls to eval # which throw a fatal exception if they fail # Needless to say, this is completely stupid. # Resetting of $SIG{'__DIE__'} is also @@ -2760,16 +2733,16 @@ }; if ($$v{service} eq "https") { - &ld_debug(2, "SSL-Cipher: " . + &ld_debug(2, "SSL-Cipher: " . $res->header('Client-SSL-Cipher')); - &ld_debug(2, "SSL-Cert-Subject: " . + &ld_debug(2, "SSL-Cert-Subject: " . $res->header('Client-SSL-Cert-Subject')); - &ld_debug(2, "SSL-Cert-Issuer: " . + &ld_debug(2, "SSL-Cert-Issuer: " . $res->header('Client-SSL-Cert-Issuer')); } my $recstr = $$r{receive}; - if ($res->is_success && (!($recstr =~ /.+/) || + if ($res->is_success && (!($recstr =~ /.+/) || $res->content =~ /$recstr/)) { service_set($v, $r, "up", {do_log => 1}, $res->status_line); &ld_debug(2, "check_http: $$r{url} is up\n"); @@ -2784,7 +2757,6 @@ return $SERVICE_DOWN; } - sub check_smtp { require Net::SMTP; @@ -2807,133 +2779,133 @@ sub check_pop { - require Mail::POP3Client; - my ($v, $r) = @_; + require Mail::POP3Client; + my ($v, $r) = @_; my $port = ld_checkport($v, $r); - &ld_debug(2, "Checking pop server=$$r{server} port=$port"); + &ld_debug(2, "Checking pop server=$$r{server} port=$port"); + + my $pop = new Mail::POP3Client(USER => $$v{login}, + PASSWORD => $$v{passwd}, + HOST => $$r{server}, + USESSL => 0, + PORT => $port, + DEBUG => 0, + TIMEOUT => $$v{negotiatetimeout}); - my $pop = new Mail::POP3Client(USER => $$v{login}, - PASSWORD => $$v{passwd}, - HOST => $$r{server}, - USESSL => 0, - PORT => $port, - DEBUG => 0, - TIMEOUT => $$v{negotiatetimeout}); - - if (!$pop) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_UP; - } - - if($$v{login} ne "") { - my $authres = $pop->login(); - $pop->close(); - if (!$authres) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - } - - $pop->close(); - service_set($v, $r, "up", {do_log => 1}); - return $SERVICE_UP; + if (!$pop) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_UP; + } + + if($$v{login} ne "") { + my $authres = $pop->login(); + $pop->close(); + if (!$authres) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + } + + $pop->close(); + service_set($v, $r, "up", {do_log => 1}); + return $SERVICE_UP; } sub check_pops { - require Mail::POP3Client; - my ($v, $r) = @_; + require Mail::POP3Client; + my ($v, $r) = @_; my $port = ld_checkport($v, $r); - &ld_debug(2, "Checking pops server=$$r{server} port=$port"); + &ld_debug(2, "Checking pops server=$$r{server} port=$port"); + + my $pops = new Mail::POP3Client(USER => $$v{login}, + PASSWORD => $$v{passwd}, + HOST => $$r{server}, + USESSL => 1, + PORT => $port, + DEBUG => 0, + TIMEOUT => $$v{negotiatetimeout}); + if (!$pops) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + + if($$v{login} ne "") { + my $authres = $pops->login(); + $pops->close(); + if (!$authres) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + } - my $pops = new Mail::POP3Client(USER => $$v{login}, - PASSWORD => $$v{passwd}, - HOST => $$r{server}, - USESSL => 1, - PORT => $port, - DEBUG => 0, - TIMEOUT => $$v{negotiatetimeout}); - if (!$pops) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - - if($$v{login} ne "") { - my $authres = $pops->login(); - $pops->close(); - if (!$authres) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - } - - - $pops->close(); - service_set($v, $r, "up", {do_log => 1}); - return $SERVICE_UP; + + $pops->close(); + service_set($v, $r, "up", {do_log => 1}); + return $SERVICE_UP; } sub check_imap { - require Net::IMAP::Simple; - my ($v, $r) = @_; + require Net::IMAP::Simple; + my ($v, $r) = @_; my $port = ld_checkport($v, $r); - - &ld_debug(2, "Checking imap server=$$r{server} port=$port"); - - my $imap = Net::IMAP::Simple->new($$r{server}, - port => $port, - timeout => $$v{negotiatetimeout}); - - if (!$imap) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - - if($$v{login} ne "") { - my $authres = $imap->login($$v{login},$$v{passwd}); - $imap->quit; - if (!$authres) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - } - - $imap->quit(); - service_set($v, $r, "up", {do_log => 1}); - return $SERVICE_UP; + + &ld_debug(2, "Checking imap server=$$r{server} port=$port"); + + my $imap = Net::IMAP::Simple->new($$r{server}, + port => $port, + timeout => $$v{negotiatetimeout}); + + if (!$imap) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + + if($$v{login} ne "") { + my $authres = $imap->login($$v{login},$$v{passwd}); + $imap->quit; + if (!$authres) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + } + + $imap->quit(); + service_set($v, $r, "up", {do_log => 1}); + return $SERVICE_UP; } sub check_imaps { - require Net::IMAP::Simple::SSL; - my ($v, $r) = @_; + require Net::IMAP::Simple::SSL; + my ($v, $r) = @_; my $port = ld_checkport($v, $r); - &ld_debug(2, "Checking imaps server=$$r{server} port=$port"); + &ld_debug(2, "Checking imaps server=$$r{server} port=$port"); - my $imaps = Net::IMAP::Simple::SSL->new($$r{server}, - port => $port, - timeout => $$v{negotiatetimeout}); - if (!$imaps) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - - if($$v{login} ne "") { - my $authres = $imaps->login($$v{login},$$v{passwd}); - $imaps->quit; - if (!$authres) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - } - - $imaps->quit(); - service_set($v, $r, "up", {do_log => 1}); - return $SERVICE_UP; + my $imaps = Net::IMAP::Simple::SSL->new($$r{server}, + port => $port, + timeout => $$v{negotiatetimeout}); + if (!$imaps) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + + if($$v{login} ne "") { + my $authres = $imaps->login($$v{login},$$v{passwd}); + $imaps->quit; + if (!$authres) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + } + + $imaps->quit(); + service_set($v, $r, "up", {do_log => 1}); + return $SERVICE_UP; } sub check_ldap @@ -2943,7 +2915,7 @@ my $port = ld_checkport($v, $r); &ld_debug(2, "Checking ldap server=$$r{server} port=$port"); - + my $recstr = $$r{receive}; my $ldap = Net::LDAP->new("$$r{server}", port => $port, timeout => $$v{negotiatetimeout}); @@ -2952,7 +2924,7 @@ &ld_debug(4, "Connection failed"); return $SERVICE_DOWN; } - + my $mesg; if ($$v{login} && $$v{passwd}) { $mesg = $ldap->bind($$v{login}, password=>$$v{passwd}) ; @@ -2978,7 +2950,7 @@ &ld_debug(2, "Count failed : " . $result->count); return $SERVICE_DOWN; } - + my $href = $result->as_struct; my @arrayOfDNs = keys %$href ; if (!($recstr =~ /.+/) || $arrayOfDNs[0] =~ /$recstr/) { @@ -2986,93 +2958,90 @@ return $SERVICE_UP; } else { service_set($v, $r, "down", {do_log => 1}, "Response mismatch"); - &ld_debug(4,"Message differs : " . ", " . $$r{receive} + &ld_debug(4,"Message differs : " . ", " . $$r{receive} . ", " . $arrayOfDNs[0] . "."); return $SERVICE_DOWN; } } - sub check_nntp { - use IO::Socket; - use IO::Select; - my ($v, $r) = @_; - my $sock; - my $s; - my $buf; + use IO::Socket; + use IO::Select; + my ($v, $r) = @_; + my $sock; + my $s; + my $buf; my $port = ld_checkport($v, $r); my $status = 1; &ld_debug(2, "Checking nntp server=$$r{server} port=$port"); - - unless ($sock = IO::Socket::INET->new(PeerAddr => $$r{server}, - PeerPort => $port, Proto => 'tcp', - TimeOut => $$v{negotiatetimeout})) { - service_set($v, $r, "down", {do_log => 1}); - return $SERVICE_DOWN; - } - $s = IO::Select->new(); - $s->add($sock); - if (scalar($s->can_read($$v{negotiatetimeout})) == 0) { - service_set($v, $r, "down", {do_log => 1}); - } else { - sysread($sock, $buf, 64); - if ($buf =~ /^2/) { - service_set($v, $r, "up", {do_log => 1}); + + unless ($sock = IO::Socket::INET->new(PeerAddr => $$r{server}, + PeerPort => $port, Proto => 'tcp', + TimeOut => $$v{negotiatetimeout})) { + service_set($v, $r, "down", {do_log => 1}); + return $SERVICE_DOWN; + } + $s = IO::Select->new(); + $s->add($sock); + if (scalar($s->can_read($$v{negotiatetimeout})) == 0) { + service_set($v, $r, "down", {do_log => 1}); + } else { + sysread($sock, $buf, 64); + if ($buf =~ /^2/) { + service_set($v, $r, "up", {do_log => 1}); $status = 0; - } else { - service_set($v, $r, "down", {do_log => 1}); - } - } - $s->remove($sock); - $sock->close; + } else { + service_set($v, $r, "down", {do_log => 1}); + } + } + $s->remove($sock); + $sock->close; - return $status; + return $status; } - sub check_radius { - require Authen::Radius; + require Authen::Radius; - my ($v, $r) = @_; + my ($v, $r) = @_; - &ld_debug(2, "Checking radius"); + &ld_debug(2, "Checking radius"); my $port = ld_checkport($v, $r); - my $radius; - my $result = ""; + my $radius; + my $result = ""; - eval { - local $SIG{'__DIE__'} = "DEFAULT"; - local $SIG{'ALRM'} = sub { die "Timeout Alarm" }; - &ld_debug(4, "Timeout is $$v{checktimeout}"); - &ld_debug(2, "Starting Check"); - alarm $$v{checktimeout}; + eval { + local $SIG{'__DIE__'} = "DEFAULT"; + local $SIG{'ALRM'} = sub { die "Timeout Alarm" }; + &ld_debug(4, "Timeout is $$v{checktimeout}"); + &ld_debug(2, "Starting Check"); + alarm $$v{checktimeout}; - &ld_debug(2, "Starting Radius"); - $radius = new Authen::Radius(Host => "$$r{server}:$port", + &ld_debug(2, "Starting Radius"); + $radius = new Authen::Radius(Host => "$$r{server}:$port", Secret=>$$v{secret}, TimeOut=>$$v{negotiatetimeout}, Errmode=>'die'); - $result = $radius->check_pwd($$v{login}, $$v{passwd}); - &ld_debug(2, "Finished Radius"); - alarm 0; # Cancel the alarm - }; - if ($result eq "") { - &service_set($v, $r, "down", {do_log => 1}); - &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@"); - &ld_debug(3, "Radius Error: ".$radius->get_error); - return $SERVICE_DOWN; - } else { - &service_set($v, $r, "up", {do_log => 1}); - &ld_debug(3, "Activated service $$r{server}:$$r{port}"); - return $SERVICE_UP; - } + $result = $radius->check_pwd($$v{login}, $$v{passwd}); + &ld_debug(2, "Finished Radius"); + alarm 0; # Cancel the alarm + }; + if ($result eq "") { + &service_set($v, $r, "down", {do_log => 1}); + &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@"); + &ld_debug(3, "Radius Error: ".$radius->get_error); + return $SERVICE_DOWN; + } else { + &service_set($v, $r, "up", {do_log => 1}); + &ld_debug(3, "Activated service $$r{server}:$$r{port}"); + return $SERVICE_UP; + } } - sub check_mysql { return check_sql(@_, "mysql", "database"); @@ -3182,7 +3151,6 @@ return $result; } - sub check_connect { my ($v, $r) = @_; @@ -3227,9 +3195,9 @@ &ld_debug(4, "Timeout is $$v{checktimeout}"); alarm $$v{checktimeout}; if (defined $$v{server}) { - $v_server = $$v{server}; + $v_server = $$v{server}; } else { - $v_server = $$v{fwm}; + $v_server = $$v{fwm}; } $result = system_wrapper($$v{checkcommand}, $v_server, $$v{port}, $$r{server}, $$r{port}); @@ -3294,14 +3262,13 @@ } } - sub check_sip { my ($v, $r) = @_; my $sip_d_port = ld_checkport($v, $r); &ld_debug(2, "Checking sip server=$$r{server} port=$sip_d_port"); - + eval { use Socket; @@ -3311,7 +3278,7 @@ &ld_debug(4, "Timeout is $$v{checktimeout}"); alarm $$v{negotiatetimeout}; - my $sock = &ld_open_socket($$r{server}, $sip_d_port, + my $sock = &ld_open_socket($$r{server}, $sip_d_port, $$v{protocol}); unless ($sock) { alarm 0; @@ -3329,7 +3296,7 @@ $|=1; select STDOUT; - my $request = + my $request = "OPTIONS sip:" . $$v{login} . " SIP/2.0\r\n" . "Via: SIP/2.0/UDP $sip_s_addr_str:$sip_s_port;" . "branch=z9hG4bKhjhs8ass877\r\n" . @@ -3350,9 +3317,9 @@ while (<$sock>) { chomp; $/="\r"; - chomp; + chomp; $/="\n"; - + last if ($_ eq ""); if (!defined $ok) { @@ -3360,7 +3327,7 @@ $ok = $_; if ($ok !~ m/^SIP\/2.0 200 OK/) { alarm 0; # Cancel the alarm - close($sock); + close($sock); die "$ok\n"; } next; @@ -3390,72 +3357,71 @@ } } - sub check_simpletcp { - my ($v, $r) = @_; - my $d_port = ld_checkport($v, $r); + my ($v, $r) = @_; + my $d_port = ld_checkport($v, $r); + + &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port"); + + eval { + use Socket; + + local $SIG{'__DIE__'} = "DEFAULT"; + local $SIG{'ALRM'} = sub { die "Timeout Alarm" }; + &ld_debug(4, "Timeout is $$v{checktimeout}"); + alarm $$v{negotiatetimeout}; + + my $sock = &ld_open_socket($$r{server}, $d_port, + $$v{protocol}); + unless ($sock) { + alarm 0; + die("Socket Connect Failed"); + } + + my $s_sockaddr = getsockname($sock); + my ($s_port, $s_addr) = sockaddr_in($s_sockaddr); + my $s_addr_str = inet_ntoa($s_addr); + + &ld_debug(3, "Connected from $s_addr_str:$s_port to " . + $$r{server} . ":$d_port"); + + select $sock; + $|=1; + select STDOUT; - &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port"); + my $request = $$r{request}; + $request =~ s/\\n/\n/g ; - eval { - use Socket; + &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port request:\n$request"); + print $sock $request; + + my $ok; + my $reply; + while (<$sock>) { + &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port receive=" . $$r{receive} ." got: $_\n"); + if ( $_ =~ /$$r{receive}/ ) { + $ok = 1; + last; + } + } + alarm 0; # Cancel the alarm + close($sock); - local $SIG{'__DIE__'} = "DEFAULT"; - local $SIG{'ALRM'} = sub { die "Timeout Alarm" }; - &ld_debug(4, "Timeout is $$v{checktimeout}"); - alarm $$v{negotiatetimeout}; - - my $sock = &ld_open_socket($$r{server}, $d_port, - $$v{protocol}); - unless ($sock) { - alarm 0; - die("Socket Connect Failed"); - } - - my $s_sockaddr = getsockname($sock); - my ($s_port, $s_addr) = sockaddr_in($s_sockaddr); - my $s_addr_str = inet_ntoa($s_addr); - - &ld_debug(3, "Connected from $s_addr_str:$s_port to " . - $$r{server} . ":$d_port"); - - select $sock; - $|=1; - select STDOUT; - - my $request = $$r{request}; - $request =~ s/\\n/\n/g ; - - &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port request:\n$request"); - print $sock $request; - - my $ok; - my $reply; - while (<$sock>) { - &ld_debug(2, "Checking simpletcp server=$$r{server} port=$d_port receive=" . $$r{receive} ." got: $_\n"); - if ( $_ =~ /$$r{receive}/ ) { - $ok = 1; - last; - } - } - alarm 0; # Cancel the alarm - close($sock); - - if (!defined $ok) { - die "No OK\n"; - } - }; - - if ($@) { - &service_set($v, $r, "down", {do_log => 1}); - &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@"); - return $SERVICE_DOWN; - } else { - &service_set($v, $r, "up", {do_log => 1}); - &ld_debug(3, "Activated service $$r{server}:$$r{port}"); - return $SERVICE_UP; - } + if (!defined $ok) { + die "No OK\n"; + } + }; + + if ($@) { + &service_set($v, $r, "down", {do_log => 1}); + &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@"); + return $SERVICE_DOWN; + } else { + &service_set($v, $r, "up", {do_log => 1}); + &ld_debug(3, "Activated service $$r{server}:$$r{port}"); + return $SERVICE_UP; + } } sub check_ftp @@ -3469,7 +3435,7 @@ &ld_debug(2, "Checking ftp server=$$r{server} port=$port"); &ld_debug(4, "Timeout is $$v{negotiatetimeout}"); - + open(TMP,'+>', undef); # In some cases Net::FTP dies if there is a timeout @@ -3504,7 +3470,6 @@ return $SERVICE_DOWN; } - sub check_dns { my $res; @@ -3513,7 +3478,7 @@ my $request; my ($v,$r) = @_; { - # Net::DNS makes ungaurded calls to eval + # Net::DNS makes unguarded calls to eval # which throw a fatal exception if they fail # Needless to say, this is completely stupid. local $SIG{'__DIE__'} = "DEFAULT"; @@ -3531,54 +3496,53 @@ . $$r{"receive"} . "\"\n"); eval { - local $SIG{'__DIE__'} = "DEFAULT"; - local $SIG{'ALRM'} = sub { die "timeout\n"; }; - alarm($$v{negotiatetimeout}); - $res->nameservers($$r{server}); - if ($$v{"protocol"} eq "tcp") { - $res->usevc(1); - } - $query = $res->search($request); - alarm(0); + local $SIG{'__DIE__'} = "DEFAULT"; + local $SIG{'ALRM'} = sub { die "timeout\n"; }; + alarm($$v{negotiatetimeout}); + $res->nameservers($$r{server}); + if ($$v{"protocol"} eq "tcp") { + $res->usevc(1); + } + $query = $res->search($request); + alarm(0); }; - + if (@$ eq "timeout\n" or ! $query) { - service_set($v, $r, "down", {do_log => 1}, "Connection timed out"); - return $SERVICE_DOWN; + service_set($v, $r, "down", {do_log => 1}, "Connection timed out"); + return $SERVICE_DOWN; } - + foreach $rr ($query->answer) { - if (($rr->type eq "A" and $rr->address eq $$r{"receive"}) or - ($rr->type eq "PTR" and $rr->ptrdname eq $$r{"receive"})) { + if (($rr->type eq "A" and $rr->address eq $$r{"receive"}) or + ($rr->type eq "PTR" and $rr->ptrdname eq $$r{"receive"})) { service_set($v, $r, "up", {do_log => 1}, "Success"); return $SERVICE_UP; } } - + service_set($v, $r, "down", {do_log => 1}, "Response mismatch"); return $SERVICE_DOWN; } - -sub check_ping +sub check_ping { use Net::Ping; my ($v,$r) = (@_); - &ld_debug(2, "Checking ping: " . "host=\"" . $$r{server} . + &ld_debug(2, "Checking ping: " . "host=\"" . $$r{server} . "\" checktimeout=\"" . $$v{"checktimeout"} . "\" checkcount=\"" . $$v{"checkcount"} . "\"\n"); my $p = Net::Ping->new("icmp","1","64"); for (my $attempt = 0; $attempt < $$v{"checkcount"}; $attempt++) { if ($p->ping($$r{server}, $$v{"checktimeout"})) { - &ld_debug(2, "pong from $$r{server}\n"); + &ld_debug(2, "pong from $$r{server}\n"); service_set($v, $r, "up", {do_log => 1}); return $SERVICE_UP; } - &ld_debug(2, "ping to $$r{server} timed out " . - "(attempt " . ($attempt + 1) . "/" . + &ld_debug(2, "ping to $$r{server} timed out " . + "(attempt " . ($attempt + 1) . "/" . $$v{"checkcount"} . ")\n"); } @@ -3586,26 +3550,24 @@ return $SERVICE_DOWN; } - # check_none # Dummy function to check service if service type is none. # Just activates the real server - sub check_none { my ($v, $r) = @_; &ld_debug(2, "Checking none"); - + service_set($v, $r, "up", {do_log => 1}); return $SERVICE_UP; } # service_set # Used to bring up and down real servers. -# This is the function you should call if you want to bring a real +# This is the function you should call if you want to bring a real # server up or down. -# This function is safe to call regrdless of the current state of a +# This function is safe to call regardless of the current state of a # real server. # Do _not_ call _service_up or _service_down directly. # pre: v: virtual that the real service belongs to @@ -3618,19 +3580,18 @@ # force => 1 - force setting of the specified state # do_log => 1 - log the state to the monitorfile # (when called as the result of a check) -# post: The real server is brough up or down for each virtual service +# post: The real server is brought up or down for each virtual service # it belongs to. # return: none - -sub service_set() +sub service_set { my ($v, $r, $state, $flags, $log_msg) = @_; my ($real, $virtual, $virt, $now); - + if ($$flags{'do_log'}) { $now = localtime(); - + if (!defined($log_msg)) { $log_msg = "-"; } @@ -3639,7 +3600,7 @@ $log_msg =~ s/([%|\r\n])/sprintf("%%%.2x", ord($1))/eg; } - # Find the real server in @REAL + # Find the real server in @REAL foreach $real (@REAL) { if($real->{"real"} eq get_real_id_str($r, $v)) { $virtual = $real->{"virtual"}; @@ -3649,12 +3610,12 @@ return unless (defined($virtual)); # Check each virtual service for the real server and make - # changes as neccessary + # changes as necessary foreach $v (@VIRTUAL){ - # Use found rather than relying on tmp_id being + # Use found rather than relying on tmp_id being # set when we leave the foreach loop. There # seems to some weirdness in Perl (5.6.0 on Redhat 7.2) - my $found = 0; + my $found = 0; my $tmp_id; my $virtual_id = get_virtual_id_str($v); my $real_id = get_real_id_str($r, $v); @@ -3674,7 +3635,7 @@ _service_down($v, $r, $$flags{"force"}); &ld_debug(2, "Disabled $log_str"); } - + if ($$v{"monitorfile"} and $$flags{"do_log"}) { my $real_log_msg = $real_id; $real_log_msg =~ tr/:/ /s; @@ -3689,16 +3650,15 @@ } } - # _remove_service -# Remove a real server by either making it quiescent or deleteing it +# Remove a real server by either making it quiescent or deleting it # Should be called by _service_down or fallback_off # I.e. If you want to change the state of a real server call service_set. # If you call this function directly then ldirectord will lose track # of the state of real servers. # If the real server exists (which it should) make it quiescent or -# delete it, depending on the global and per virtual service quiecent flag. -# If it # doesn't exist, just leave it as it will be added by the +# delete it, depending on the global and per virtual service quiescent flag. +# If it # doesn't exist, just leave it as it will be added by the # _service_up code as appropriate. # pre: v: reference to virtual service to with the real server belongs # rservice: service to restore. Of the form server:port for a tcp or @@ -3709,31 +3669,31 @@ # post: real service is taken up from the respective virtual service # if it is inactive # return: none - -sub _remove_service { +sub _remove_service +{ my ($v, $rservice, $rforw, $tag) = (@_); - my $oldsrv; - my $ov; - my $or; - my $ipvsadm_args; - my $log_args; + my $oldsrv; + my $ov; + my $or; + my $ipvsadm_args; + my $log_args; my $virtual_str; my $old_rservice; my $is_quiescent; $virtual_str = &get_virtual($v); - $oldsrv=&ld_read_ipvsadm(); - $ov=$oldsrv->{$virtual_str . " " . $v->{"protocol"}}; + $oldsrv=&ld_read_ipvsadm(); + $ov=$oldsrv->{$virtual_str . " " . $v->{"protocol"}}; if(!defined($ov)){ return; } - if ($tag ne "fallback" - and ((defined $$v{quiescent} + if ($tag ne "fallback" + and ((defined $$v{quiescent} and $$v{quiescent} eq "yes") - or (!defined($$v{quiescent}) + or (!defined($$v{quiescent}) and $QUIESCENT eq "yes"))){ $is_quiescent = "quiescent"; } @@ -3756,9 +3716,9 @@ $rservice = $1; $virtual_str =~ /(.*):(.*)/; $rservice .= ":" . $2; - $or=$ov->{"real"}->{$rservice}; + $or=$ov->{"real"}->{$rservice}; # If this doesn't exist either, use the original service. - # Otherwise if masq and quescence is in use, the + # Otherwise if masq and quiescence is in use, the # real server is not local, and it has an alternate port to # the virtual server, using the mapped service will # result in a quiescent service being created on the @@ -3769,15 +3729,15 @@ } } - if((!defined($or) and !defined($is_quiescent)) or + if((!defined($or) and !defined($is_quiescent)) or (defined($is_quiescent) and defined($or) and - $or->{"weight"} eq 0 and + $or->{"weight"} eq 0 and get_forward_flag($or->{"forward"}) eq $rforw)){ return; } $ipvsadm_args = "$$v{proto} " . $virtual_str . " -r $rservice"; - $log_args = "$tag server: $rservice "; + $log_args = "$tag server: $rservice "; if(defined($old_rservice)) { $log_args .= "mapped from $old_rservice " } @@ -3787,20 +3747,20 @@ my $currenttime=time(); if(defined($is_quiescent)) { if (defined($or)) { - &system_wrapper("$IPVSADM -e " + &system_wrapper("$IPVSADM -e " . "$ipvsadm_args $rforw -w 0"); } else { - &system_wrapper("$IPVSADM -a " + &system_wrapper("$IPVSADM -a " . "$ipvsadm_args $rforw -w 0"); } - &ld_log("Quiescent $log_args (Weight set to 0)"); + &ld_log("Quiescent $log_args (Weight set to 0)"); &ld_emailalert_send("Quiescent $log_args (Weight set to 0)", $v, $rservice, $currenttime); - } + } else { - &system_wrapper("$IPVSADM -d $ipvsadm_args"); - &ld_log("Deleted $log_args"); + &system_wrapper("$IPVSADM -d $ipvsadm_args"); + &ld_log("Deleted $log_args"); &ld_emailalert_send("Deleted $log_args", $v, $rservice, $currenttime); } @@ -3826,49 +3786,47 @@ # post: real service is taken up from the respective virtual service # if it is inactive # return: none - -sub _restore_service { +sub _restore_service +{ my ($v, $rservice, $rforw, $rwght, $tag) = (@_); - my $oldsrv; - my $ov; - my $or; - my $ipvsadm_args; - my $log_args; - - $ipvsadm_args = "$$v{proto} " . &get_virtual($v) - . " -r $rservice $rforw -w $rwght"; - $log_args = "$tag server: $rservice " - . "(" #. scalar(%{$v->{real_status}}) + my $oldsrv; + my $ov; + my $or; + my $ipvsadm_args; + my $log_args; + + $ipvsadm_args = "$$v{proto} " . &get_virtual($v) + . " -r $rservice $rforw -w $rwght"; + $log_args = "$tag server: $rservice " + . "(" #. scalar(%{$v->{real_status}}) . &get_virtual($v) . ")"; - #if the server exists then restore its weight - # otherwise add the server - $oldsrv=&ld_read_ipvsadm(); - $ov=$oldsrv->{&get_virtual($v) . " " . $v->{"protocol"}}; - if(defined($ov)){ - $or=$ov->{"real"}->{$rservice}; - } - if(defined($or)){ - unless($or->{"weight"} eq $rwght and - get_forward_flag($or->{"forward"}) eq $rforw){ - &system_wrapper("$IPVSADM -e $ipvsadm_args"); - &ld_log("Restored $log_args (Weight set to $rwght)"); + #if the server exists then restore its weight + # otherwise add the server + $oldsrv=&ld_read_ipvsadm(); + $ov=$oldsrv->{&get_virtual($v) . " " . $v->{"protocol"}}; + if(defined($ov)){ + $or=$ov->{"real"}->{$rservice}; + } + if(defined($or)){ + unless($or->{"weight"} eq $rwght and + get_forward_flag($or->{"forward"}) eq $rforw){ + &system_wrapper("$IPVSADM -e $ipvsadm_args"); + &ld_log("Restored $log_args (Weight set to $rwght)"); &ld_emailalert_send("Restored $log_args " . "(Weight set to $rwght)", $v, $rservice, 0); - } - } - else { - &system_wrapper("$IPVSADM -a $ipvsadm_args"); - &ld_log("Added $log_args (Weight set to $rwght)"); + } + } + else { + &system_wrapper("$IPVSADM -a $ipvsadm_args"); + &ld_log("Added $log_args (Weight set to $rwght)"); &ld_emailalert_send("Added $log_args (Weight set to $rwght)", $v, $rservice, 0); - } + } } - - # Check the status of a server # Should only be called from _status_up, _status_down, # _service_up, or _service_down @@ -3896,10 +3854,8 @@ return 0; } - # Set the status of a server as up # Should only be called from _service_up or _ld_start - sub _status_up { my ($v, $r, $is_fallback) = (@_); @@ -3922,7 +3878,6 @@ # Set the status of a server as down # Should only be called from _service_down or ld_stop - sub _status_down { my ($v, $r, $is_fallback) = (@_); @@ -3953,9 +3908,6 @@ return 1; } - - - # _service_up # Bring a real service up if it is down # Should be called by service_set only @@ -3963,11 +3915,10 @@ # If you call this function directly then ldirectord will lose track # of the state of real servers. # pre: v: reference to virtual service to with the real server belongs -# r: refernece to the real server to take down +# r: reference to the real server to take down # post: real service is taken up from the respective virtual service # if it is inactive # return: none - sub _service_up { my ($v, $r, $force) = (@_); @@ -3983,12 +3934,11 @@ return; } - &_restore_service($v, $r->{server} . ":" . $r->{port}, - $r->{forw}, $r->{weight}, "real"); + &_restore_service($v, $r->{server} . ":" . $r->{port}, + $r->{forw}, $r->{weight}, "real"); &fallback_off($v); } - # _service_down # Bring a real service down if it is up # Should be called by service_set only @@ -3996,11 +3946,10 @@ # If you call this function directly then ldirectord will lose track # of the state of real servers. # pre: v: reference to virtual service to with the real server belongs -# r: refernece to the real server to take down +# r: reference to the real server to take down # post: real service is taken down from the respective virtual service # if it is active # return: none - sub _service_down { my ($v, $r, $force) = @_; @@ -4021,19 +3970,17 @@ _status_down($v, $r); - &_remove_service($v, $r->{server} . ":" . $r->{port}, - $r->{forw}, "real"); + &_remove_service($v, $r->{server} . ":" . $r->{port}, + $r->{forw}, "real"); &fallback_on($v); } - # fallback_on # Turn on the fallback server for a virtual service if it is inactive # pre: v: virtual to turn fallback service on for # post: fallback server is turned on if it was inactive # return: none - sub fallback_on { my ($v, $force) = (@_); @@ -4043,7 +3990,7 @@ if (defined($fallback) and (_status_up($v, $fallback, "fallback") or defined($force))) { &_restore_service($v, $fallback->{server} . ":" . $fallback->{port}, - get_forward_flag($fallback->{forward}), + get_forward_flag($fallback->{forward}), "1", "fallback"); } @@ -4052,13 +3999,11 @@ } } - # fallback_off # Turn off the fallback server for a virtual service if it is active # pre: v: virtual to turn fallback service off for # post: fallback server is turned off if it was active # return: none - sub fallback_off { my ($v, $force) = (@_); @@ -4077,7 +4022,6 @@ } } - # fallback_find # Determine the fallback for a virtual service # pre: virtual: reference to a virtual service @@ -4085,7 +4029,6 @@ # return: $virtual->{"fallback"} if defined # else $FALLBACK->{$virtual->{"protocol"}} if defined # else undef - sub fallback_find { my ($virtual) = (@_); @@ -4108,12 +4051,10 @@ return \%anon_fallback; } - # fallback_command # Execute the fallback command with the given status if it wasn't executed # with this status already for the supplied virtual service. - -sub do_fallback_command() +sub do_fallback_command { my ($v, $status) = (@_); @@ -4135,18 +4076,17 @@ { my ($v, $rservice, $tag) = (@_); - my $log_arg = "Purged real server ($tag): $rservice (" . + my $log_arg = "Purged real server ($tag): $rservice (" . &get_virtual($v) . ")"; - &system_wrapper("$IPVSADM -d $v->{proto} " . &get_virtual($v) . + &system_wrapper("$IPVSADM -d $v->{proto} " . &get_virtual($v) . " -r $rservice"); &ld_log($log_arg); &ld_emailalert_send($log_arg, $v, $rservice, 0); } - # Used during stop, start and reload to remove stale real servers from LVS -sub purge_service +sub purge_service { my ($v, $r, $tag) = (@_); @@ -4154,9 +4094,8 @@ _status_down($v, $r); } - # Used during stop, start and reload to remove stale virtual services from LVS -sub purge_virtual +sub purge_virtual { my ($v, $tag) = (@_); @@ -4164,10 +4103,9 @@ &ld_log("Purged virtual server ($tag): " . &get_virtual($v)); } - sub check_cfgfile { - my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime) = stat($CONFIG); my ($status); return if ($stattime==$mtime); @@ -4199,7 +4137,6 @@ return $status; } - # ld_openlog # Open logger # make log rotation work @@ -4207,7 +4144,7 @@ # post: If logger is a file, it opened and closed again as a test # If logger is syslog, it is opened so it can be used without # needing to be opened again. -# Otherwiese, nothing is done. +# Otherwise, nothing is done. # return: 0 on success # 1 on error sub ld_openlog @@ -4215,19 +4152,19 @@ if ($opt_d or $SUPERVISED eq "yes") { # Instantly do nothing return(0); - } + } if( $LDIRLOG =~ /^\/(.*)/ ) { - # Open and close the file as a test. - # We open the file each time we want to log to it - unless (open(LOGFILE, ">>$LDIRLOG") and close(LOGFILE)) { - return 1; - } + # Open and close the file as a test. + # We open the file each time we want to log to it + unless (open(LOGFILE, ">>$LDIRLOG") and close(LOGFILE)) { + return 1; + } } else { - # Assume LDIRLOG is a logfacility, log to syslog - setlogsock( "unix" ); - openlog( "ldirectord", "pid", "$LDIRLOG" ); + # Assume LDIRLOG is a logfacility, log to syslog + setlogsock( "unix" ); + openlog( "ldirectord", "pid", "$LDIRLOG" ); } return(0); } @@ -4236,15 +4173,15 @@ # Log a message. # pre: message: Message to write # post: message and timetsamp is written to loged -# If logger is a file, it is opened and closed again as a -# primative means to make log rotation work +# If logger is a file, it is opened and closed again as a +# primitive means to make log rotation work # return: 0 on success # 1 on error sub ld_log { my ($message) = (@_); - my $now = localtime(); + my $now = localtime(); &ld_debug(2, $message); chomp $message; @@ -4257,17 +4194,16 @@ and print LOGFILE "[$now|$CFGNAME|$$] $message\n" and close(LOGFILE)) { print STDERR "$message\n"; - return 1; - } + return 1; + } } else { - # Assume LDIRLOG is a logfacility, log to syslog - syslog( "info", "$message" ); + # Assume LDIRLOG is a logfacility, log to syslog + syslog( "info", "$message" ); } return(0); } - sub daemon_status_str { if ($DAEMON_STATUS == $DAEMON_STATUS_STARTING) { @@ -4285,14 +4221,12 @@ return "UNKNOWN"; } - # ld_emailalert_send # Send email alerts per virtual server # pre: message: Message to email -# post: message is emailed if emailalert defined for virtualserver +# post: message is emailed if emailalert defined for virtualserver # return: 0 on success # 1 on error - sub ld_emailalert_send { my ($subject, $v, $rserver, $currenttime) = (@_); @@ -4318,7 +4252,7 @@ $EMAILSTATUS{$id}->{alerttime} = $currenttime; } - $statusfilter = defined $v->{emailalertstatus} ? + $statusfilter = defined $v->{emailalertstatus} ? $v->{emailalertstatus} : $EMAILALERTSTATUS; if (($DAEMON_STATUS & $statusfilter) == 0) { return 0; @@ -4349,7 +4283,6 @@ # post: message is emailed if SMTP server is valid and working # return: 0 on success # 1 on error - sub ld_emailalert_net_smtp { my ($smtp_server, $to_addr, $subject) = (@_); @@ -4393,7 +4326,6 @@ # post: message is emailed if one of the Mail::Send methods works # return: 0 on success # 1 on error - sub ld_emailalert_mail_send { my ($to_addr, $subject) = (@_); @@ -4418,11 +4350,10 @@ } # ld_emailalert_resend -# Resend email alerts as neccessary +# Resend email alerts as necessary # pre: none -# post: EMAILSTATUS array is updated and alears are sent as neccessary +# post: EMAILSTATUS array is updated and alerts are sent as necessary # return: none - sub ld_emailalert_resend { my $currenttime = time(); @@ -4433,7 +4364,7 @@ foreach $id (keys %EMAILSTATUS) { $es = $EMAILSTATUS{$id}; - $frequency = defined $es->{v}->{emailalertfreq} ? + $frequency = defined $es->{v}->{emailalertfreq} ? $es->{v}->{emailalertfreq} : $EMAILALERTFREQ; $id =~ m/(.*) /; @@ -4441,8 +4372,8 @@ if ($currenttime - $es->{alerttime} < $frequency) { next; } - &ld_emailalert_send("Inaccessible real server: $id", - $es->{v}, $rserver, $currenttime); + &ld_emailalert_send("Inaccessible real server: $id", + $es->{v}, $rserver, $currenttime); } } @@ -4452,7 +4383,6 @@ # message: Message to write # post: message is written to STDOUT if $DEBUG >= priority # return: none - sub ld_debug { my ($priority, $message) = (@_); @@ -4463,21 +4393,19 @@ } } - # system_wrapper # Wrapper around system() to log errors # pre: LIST: arguments to pass to system() -# post: system() is called and if it returns non-zero a failure +# post: system() is called and if it returns non-zero a failure # message is logged # return: return value of system() - sub system_wrapper { my (@args)=(@_); my $status; - &ld_log("Running system(@args)") if $DEBUG>2; + &ld_log("Running system(@args)") if $DEBUG>2; $status = system(@args); if($status != 0) { &ld_log("system(@args) failed: $!"); @@ -4486,15 +4414,13 @@ return($status) } - # exec_wrapper # Wrapper around exec() to log errors # pre: LIST: arguments to pass to exec() -# post: exec() is called and if it returns non-zero a failure +# post: exec() is called and if it returns non-zero a failure # message is logged # return: return value of exec() on failure # does not return on success - sub exec_wrapper { my (@args)=(@_); @@ -4506,7 +4432,6 @@ return($status) } - # ld_rm_file # Remove a file, symink, or anything that isn't a directory # and exists @@ -4517,7 +4442,6 @@ # If $DEBUG >=2 errors are logged # return: 0 on success # -1 on error - sub ld_rm_file { my ($filename)=(@_); @@ -4539,79 +4463,71 @@ return(($status==1)?0:-1) } - # is_octet # See if a number is an octet, that is >=0 and <=255 -# pre: alleged_octet: the octect to test -# post: alleged_octect is checked to see if it is valid +# pre: alleged_octet: the octet to test +# post: alleged_octet is checked to see if it is valid # return: 1 if the alleged_octet is an octet # 0 otherwise - sub is_octet { - my ($alleged_octet)=(@_); + my ($alleged_octet)=(@_); - if($alleged_octet<0){ return 0; } - if($alleged_octet>255){ return 0; } + if($alleged_octet<0){ return 0; } + if($alleged_octet>255){ return 0; } - return(1); + return(1); } - # is_ip # Check that a given string is an IP address # pre: alleged_ip: string representing ip address # post: alleged_ip is checked to see if it is valid # return: 1 if alleged_ip is a valid ip address # 0 otherwise - sub is_ip { - my ($alleged_ip)=(@_); + my ($alleged_ip)=(@_); - if ($alleged_ip =~ /:/) { + if ($alleged_ip =~ /:/) { unless(inet_pton(AF_INET6,$alleged_ip)){ return 0; } - return(1); - } + return(1); + } - #If we don't have four, . delimited numbers then we have no hope - unless($alleged_ip=~m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { return 0; } + #If we don't have four, . delimited numbers then we have no hope + unless($alleged_ip=~m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { return 0; } - #Each octet mist be >=0 and <=255 - unless(&is_octet($1)){ return 0; } - unless(&is_octet($2)){ return 0; } - unless(&is_octet($3)){ return 0; } - unless(&is_octet($4)){ return 0; } + #Each octet mist be >=0 and <=255 + unless(&is_octet($1)){ return 0; } + unless(&is_octet($2)){ return 0; } + unless(&is_octet($3)){ return 0; } + unless(&is_octet($4)){ return 0; } - return(1); + return(1); } - # ip_to_int # Turn an IP address given as a dotted quad into an integer # pre: ip_address: string representing IP address # post: post ip_address is converted to an integer # return: -1 if an error occurs # integer representation of IP address otherwise - sub ip_to_int { - my ($ip_address)=(@_); + my ($ip_address)=(@_); - unless(&is_ip($ip_address)){ return(-1); } - unless($ip_address=~m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/){ return(-1); } + unless(&is_ip($ip_address)){ return(-1); } + unless($ip_address=~m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/){ return(-1); } - return(((((($1<<8)+$2)<<8)+$3)<<8)+$4); + return(((((($1<<8)+$2)<<8)+$3)<<8)+$4); } - # int_to_ip # Turn an IP address given as a dotted quad into an integer # pre: ip_address: string representing IP address # post: Decimal is converted to a dotted quad # return: -1 if an error occurs # integer representation of IP address otherwise - sub int_to_ip { my ($ip_address)=(@_); @@ -4627,14 +4543,12 @@ )); } - # get_virtual # Get the service for a virtual # pre: nv: virtual to get the service for # post: none # return: fwmark of service if it is a fwm service # ip_address:port otherwise - sub get_virtual { my ($nv) = (@_); @@ -4642,11 +4556,10 @@ if ($nv->{"protocol"} eq "fwm"){ return $nv->{"fwm"}; } else { - return $nv->{"server"} . ":" . $nv->{"port"}; + return $nv->{"server"} . ":" . $nv->{"port"}; } } - # get_real_id_str # Get an id string for a real server # pre: r: Real service. @@ -4655,7 +4568,6 @@ # service: type of service # post: none # return: Id string for the real server - sub get_real_id_str { my ($r, $v) = (@_); @@ -4701,20 +4613,18 @@ $virtualhost = $v->{"virtualhost"}; } - $real = $check . ":" . $v->{"protocol"} . ":" - . $r->{"server"} . ":" . $r->{"port"} . ":" - . $virtualhost . ":" . $checkport . ":" + $real = $check . ":" . $v->{"protocol"} . ":" + . $r->{"server"} . ":" . $r->{"port"} . ":" + . $virtualhost . ":" . $checkport . ":" . $r->{"weight"} . ":" . $r->{"forward"} . ":" . quotemeta($request) . ":" . quotemeta($receive); } - # get_virtual_id_str # Get an id string for a virtual service # pre: v: Virtual service # post: none # return: Id string for the virtual service - sub get_virtual_id_str { my ($v) = (@_); @@ -4722,47 +4632,43 @@ return $v->{"protocol"} . ":" . &get_virtual($v); } - # get_forward_flag -# Get the ipvsadm flag corresponging to a forwarding mechanism +# Get the ipvsadm flag corresponding to a forwarding mechanism # pre: forward: Name of forwarding mechanism. u # Should be one of ipip, masq or gate # post: none -# return: ipvsadm flag corresponding to the forwading mechanism +# return: ipvsadm flag corresponding to the forwarding mechanism # " " if $forward is unknown - sub get_forward_flag { - my ($forward) = (@_); + my ($forward) = (@_); - unless(defined($forward)) { - return(" "); - } + unless(defined($forward)) { + return(" "); + } if ($forward eq "masq") { return("-m"); - } - elsif ($forward eq "gate") { + } + elsif ($forward eq "gate") { return("-g"); - } - elsif ($forward eq "ipip") { + } + elsif ($forward eq "ipip") { return("-i"); - } + } return(" "); } - # ld_exit # Exit and log a message # pre: exit_status: Integer exit status to exit with -# 0 wiil be used if parameter is omitted +# 0 will be used if parameter is omitted # message: Message to log when exiting. May be omitted # post: If exit_status is non-zero or $DEBUG>2 then # message logged. # Programme exits with exit_status # return: does not return - sub ld_exit { my ($exit_status, $message)=(@_); @@ -4775,16 +4681,14 @@ exit($exit_status); } - # ld_open_socket # Open a socket connection # pre: remote: IP address as a dotted quad of remote host to connect to # port: port to connect to -# protocol: Prococol to use. Should be either "tcp" or "udp" +# protocol: Protocol to use. Should be either "tcp" or "udp" # post: A Socket connection is opened to the remote host # return: Open socket # undef on error - sub ld_open_socket { my ($remote, $port, $protocol) = @_; @@ -4792,17 +4696,17 @@ local *SOCK; if (inet_pton(AF_INET6,$remote)) { - $iaddr = inet_pton(AF_INET6,$remote); - $paddr = pack_sockaddr_in6($port, $iaddr); - $pf = PF_INET6; + $iaddr = inet_pton(AF_INET6,$remote); + $paddr = pack_sockaddr_in6($port, $iaddr); + $pf = PF_INET6; } else { - $iaddr = inet_aton($remote) || die "no host: $remote"; - $paddr = sockaddr_in($port, $iaddr); - $pf = PF_INET; + $iaddr = inet_aton($remote) || die "no host: $remote"; + $paddr = sockaddr_in($port, $iaddr); + $pf = PF_INET; } $pro = getprotobyname($protocol); if ($protocol eq "udp") { - socket(SOCK, $pf, SOCK_DGRAM, $pro) || die "socket: $!"; + socket(SOCK, $pf, SOCK_DGRAM, $pro) || die "socket: $!"; } else { socket(SOCK, $pf, SOCK_STREAM, $pro) || die "socket: $!"; @@ -4814,7 +4718,6 @@ return *SOCK; } - # daemon # Close and fork to become a daemon. # @@ -4829,9 +4732,8 @@ # # Gratuitously over documented, because it can be # -# Writen by Horms, horms@verge.net.au for an unrelated project while +# Written by Horms, horms@verge.net.au for an unrelated project while # working for Zip World, http://www.zipworld.com.au/, 1997-1999. - sub ld_daemon { # `fork()' so the parent can exit, this returns control to the command @@ -4864,7 +4766,7 @@ # error we inherited from our parent process. We have no way of knowing # where these fds might have been redirected to. Note that many daemons # use `sysconf()' to determine the limit `_SC_OPEN_MAX'. `_SC_OPEN_MAX' - # tells you the maximun open files/process. Then in a loop, the daemon + # tells you the maximum open files/process. Then in a loop, the daemon # can close all possible file descriptors. You have to decide if you # need to do this or not. If you think that there might be # file-descriptors open you should close them, since there's a limit on @@ -4880,11 +4782,11 @@ # and open `/dev/null' as stdin; alternatively, you could open # `/dev/console' as stderr and/or stdout, and `/dev/null' as stdin, or # any other combination that makes sense for your particular daemon. - # - # This code used to open /dev/console for STDOUT and STDERR, - # but that was changed to /dev/null to stop the code hanging in - # the case where /dev/console is unavailable for some reason - # http://www.osdl.org/developer_bugzilla/show_bug.cgi?id=1180 + # + # This code used to open /dev/console for STDOUT and STDERR, + # but that was changed to /dev/null to stop the code hanging in + # the case where /dev/console is unavailable for some reason + # http://www.osdl.org/developer_bugzilla/show_bug.cgi?id=1180 if(open(STDIN, "0){ - &ld_exit(0, + &ld_exit(0, "ld_daemon_become_child: Parent exiting as it should"); } } - # ld_gethostbyname -# Wrapper to gethostbyname. Look up the/an IP address of a hostname +# Wrapper to gethostbyname. Look up the/an IP address of a hostname # If an IP address is given is it returned # pre: name: Hostname of IP address to lookup # post: gethostbyname is called to find an IP address for $name # This is converted to a string # return: IP address # undef on error - -sub ld_gethostbyname +sub ld_gethostbyname { my ($name)=(@_); @@ -4954,7 +4852,6 @@ # post: gethostbyaddr is called to find a hostname for IP $ip # return: hostname # undef on error - sub ld_gethostbyaddr { my ($ip)=(@_); @@ -4969,39 +4866,36 @@ } # ld_getservbyname -# Wraper for getservbyname. Look up the port for a service name +# Wrapper for getservbyname. Look up the port for a service name # If a port is given it is returned. # pre: name: Port or Service name to look up -# post: if $name is a number +# post: if $name is a number # if 0<=$name<=65536 $name is returned # else undef is returned # else getservbyname is called to look up the port for the service # return: Port # undef on error - -sub ld_getservbyname +sub ld_getservbyname { my ($name, $protocol)=(@_); - if($name=~/^[0-9]+$/){ + if($name=~/^[0-9]+$/){ return(($name>=0 and $name<65536)?$name:undef); - } + } my @serv=getservbyname($name, $protocol); return((@serv and defined($serv[2]))?$serv[2]:undef); } - # ld_getservhostbyname -# Wraper for ld_gethostbyname and ld_getservbyname. Given a server of the +# Wrapper for ld_gethostbyname and ld_getservbyname. Given a server of the # form ip_address|hostname[:port|servicename] return ip_address[:port] # pre: hostserv: Servver of the form ip_address|hostname[:port|servicename] # protocol: Protocol for service. Should be either "tcp" or "udp" # post: lookups performed as per ld_getservbyname and ld_gethostbyname # return: ip_address[:port] # undef on error - sub ld_gethostservbyname{ my ($hostserv, $protocol) = (@_); @@ -5012,8 +4906,8 @@ $ip=$1; $port=$3; } else { - $hostserv =~ - /(\d+\.\d+\.\d+\.\d+|[A-Za-z0-9.-]+)(:(\d+|[A-Za-z0-9-]+))?/ + $hostserv =~ + /(\d+\.\d+\.\d+\.\d+|[A-Za-z0-9.-]+)(:(\d+|[A-Za-z0-9-]+))?/ or return(undef); $ip=$1; $port=$3; @@ -5022,22 +4916,21 @@ } if(defined($port)){ - $port=&ld_getservbyname($port, $protocol); + $port=&ld_getservbyname($port, $protocol); if (defined($port)) { - return("$ip:$port"); + return("$ip:$port"); } else { - return(undef); + return(undef); } } return($ip); } - # ld_find_cmd_path # Find executable in path # pre: cmd: command to find # path: ':' delimited paths to check -# relative: if set, allow cmd to be a relative path, +# relative: if set, allow cmd to be a relative path, # which is checked first # return: path to command # undef if not found @@ -5066,7 +4959,7 @@ # ld_find_cmd_path # Find executable in $ENV{'PATH'} # pre: cmd: command to find -# relative: if set, allow cmd to be a relative path, +# relative: if set, allow cmd to be a relative path, # which is checked first # return: path to command # undef if not found --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/cl_log.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/cl_log.c @@ -567,7 +567,6 @@ * non-blocking IPC. */ -gboolean last_log_failed = FALSE; static int cl_log_depth = 0; /* Cluster logging function */ @@ -762,7 +761,7 @@ logging_daemon_chan->ops->waitout(logging_daemon_chan); } -int +static int LogToLoggingDaemon(int priority, const char * buf, int bufstrlen, gboolean use_pri_str) { --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/ipctransientclient.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/ipctransientclient.c @@ -19,7 +19,7 @@ #include #define MAX_MESSAGES 3 -char *messages[MAX_MESSAGES]; +static char *messages[MAX_MESSAGES]; IPC_Message *create_simple_message(const char *text, IPC_Channel *ch); IPC_Channel *init_client_ipctest_comms( --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/cl_random.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/cl_random.c @@ -196,9 +196,11 @@ if (fread(buf, 1, sizeof(buf), fs)!= sizeof(buf)){ cl_log(LOG_INFO, "%s: reading file %s failed" , __FUNCTION__, randdevname[idev]); + fclose(fs); }else{ + fclose(fs); return (unsigned int)cl_binary_to_int(buf, sizeof(buf)); - } + } } } --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/coredumps.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/coredumps.c @@ -249,7 +249,7 @@ * prctl(2). This is an untested theory at this time... */ void -cl_set_all_coredump_signal_handlers() +cl_set_all_coredump_signal_handlers(void) { static const int coresigs [] = {SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV #ifdef SIGBUS --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/cl_msg_types.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/cl_msg_types.c @@ -49,7 +49,7 @@ #define NL_TO_SYM 0 #define SYM_TO_NL 1 -int SPECIAL_SYMS[MAXDEPTH]={ +static const int SPECIAL_SYMS[MAXDEPTH] = { 20, 21, 22, --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/GSource.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/GSource.c @@ -365,8 +365,16 @@ , GDestroyNotify notify) { int rfd, wfd; - GCHSource* chp; + + if( !source ) { + cl_log(LOG_WARNING, "%s:%d: got null source", __FUNCTION__,__LINE__); + return NULL; + } + if( !ch ) { + cl_log(LOG_WARNING, "%s:%d: got null channel", __FUNCTION__,__LINE__); + return NULL; + } chp = (GCHSource*)source; chp->magno = MAG_GCHSOURCE; @@ -409,9 +417,14 @@ , gpointer userdata , GDestroyNotify notify) { - GCHSource* chp; - - GSource * source = g_source_new(&G_CH_SourceFuncs, + GCHSource *chp; + GSource *source; + + if( !ch ) { + cl_log(LOG_WARNING, "%s:%d: got null channel", __FUNCTION__,__LINE__); + return NULL; + } + source = g_source_new(&G_CH_SourceFuncs, sizeof(GCHSource)); G_main_IPC_Channel_constructor(source,ch,userdata,notify); @@ -642,7 +655,6 @@ /* * Free up our data, and notify the user process... */ -int ch_destroy_debug_me = 0; void G_CH_destroy_int(GSource* source) { --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/realtime.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/realtime.c @@ -236,7 +236,7 @@ } void -cl_make_normaltime() +cl_make_normaltime(void) { #ifdef DEFAULT_REALTIME struct sched_param sp; --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/ipctest.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/ipctest.c @@ -57,10 +57,10 @@ = (int (*)(struct pollfd * fds, unsigned int, int)) poll; static gboolean checkmsg(IPC_Message* rmsg, const char * who, int rcount); -const char *procname; +static const char *procname; -int iter_def = 10000; /* number of iterations */ -int verbosity = 0; /* verbosity level */ +static const int iter_def = 10000; /* number of iterations */ +static int verbosity; /* verbosity level */ /* * The ipc interface can be invoked as either: @@ -72,7 +72,7 @@ */ /* *** CLIENTS_MAX currently 1 while coding *** */ #define CLIENTS_MAX 1 /* max. number of independent clients */ -int clients_def = 0; /* number of independent clients */ +static int clients_def; /* number of independent clients */ static int channelpair(TestFunc_t clientfunc, TestFunc_t serverfunc, int count) @@ -394,7 +394,7 @@ return rc; } -int data_size = 10; +static int data_size = 10; int main(int argc, char ** argv) --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/cpulimits.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/cpulimits.c @@ -186,13 +186,13 @@ } int -cl_cpu_limit_ms_interval() +cl_cpu_limit_ms_interval(void) { return cpuinterval_ms; } int -cl_cpu_limit_update() +cl_cpu_limit_update(void) { longclock_t now = time_longclock(); long msleft; --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/ipcsocket.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/ipcsocket.c @@ -209,7 +209,7 @@ int last_send_rc; }; -struct IPC_Stats SocketIPCStats = {0,0,0,0}; +static struct IPC_Stats SocketIPCStats = {0, 0, 0, 0}; extern int debug_level; /* unix domain socket implementations of IPC functions. */ --- heartbeat-2.99.2+sles11r9.orig/lib/clplumbing/cl_msg.c +++ heartbeat-2.99.2+sles11r9/lib/clplumbing/cl_msg.c @@ -55,7 +55,6 @@ static int compression_threshold = (2*1024); static enum cl_msgfmt msgfmt = MSGFMT_NVPAIR; -int cl_max_msg_size = (512*1024); static gboolean use_traditional_compression = TRUE; const char* --- heartbeat-2.99.2+sles11r9.orig/lib/hbclient/api_test.c +++ heartbeat-2.99.2+sles11r9/lib/hbclient/api_test.c @@ -68,14 +68,14 @@ , node, client, status); } -int quitnow = 0; +static int quitnow; void gotsig(int nsig) { (void)nsig; quitnow = 1; } -const char * mandparms[] = +static const char *mandparms[] = { KEY_HBVERSION , KEY_HOPS , KEY_KEEPALIVE @@ -91,7 +91,7 @@ , KEY_DEBUGLEVEL , KEY_NORMALPOLL}; -const char * optparms[] = +static const char *optparms[] = { KEY_LOGFILE , KEY_DBGFILE , KEY_FACILITY --- heartbeat-2.99.2+sles11r9.orig/lib/lrm/racommon.c +++ heartbeat-2.99.2+sles11r9/lib/lrm/racommon.c @@ -115,7 +115,7 @@ *rsc_info = NULL; } - file_num = scandir(class_path, &namelist, 0, alphasort); + file_num = scandir(class_path, &namelist, NULL, alphasort); if (file_num < 0) { cl_log(LOG_ERR, "scandir failed in RA plugin"); return -2; @@ -125,7 +125,7 @@ tmp_buffer[0] = '\0'; tmp_buffer[FILENAME_MAX] = '\0'; - snprintf(tmp_buffer, FILENAME_MAX, "%s/%s", + snprintf(tmp_buffer, FILENAME_MAX, "%s/%s", class_path, namelist[file_num]->d_name ); if ( filtered(tmp_buffer) == TRUE ) { *rsc_info = g_list_append(*rsc_info, --- heartbeat-2.99.2+sles11r9.orig/lib/plugins/lrm/raexechb.c +++ heartbeat-2.99.2+sles11r9/lib/plugins/lrm/raexechb.c @@ -129,8 +129,8 @@ #define MAX_PARAMETER_NUM 40 typedef char * RA_ARGV[MAX_PARAMETER_NUM]; -const int MAX_LENGTH_OF_RSCNAME = 40, - MAX_LENGTH_OF_OPNAME = 40; +static const int MAX_LENGTH_OF_RSCNAME = 40, + MAX_LENGTH_OF_OPNAME = 40; static int prepare_cmd_parameters(const char * rsc_type, const char * op_type, GHashTable * params, RA_ARGV params_argv); --- heartbeat-2.99.2+sles11r9.orig/lib/plugins/lrm/raexecocf.c +++ heartbeat-2.99.2+sles11r9/lib/plugins/lrm/raexecocf.c @@ -238,7 +238,7 @@ "will cause memory leak."); *rsc_info = NULL; } - file_num = scandir(RA_PATH, &namelist, 0, alphasort); + file_num = scandir(RA_PATH, &namelist, NULL, alphasort); if (file_num < 0) { return -2; } --- heartbeat-2.99.2+sles11r9.orig/lib/plugins/stonith/Makefile.am +++ heartbeat-2.99.2+sles11r9/lib/plugins/stonith/Makefile.am @@ -199,7 +199,7 @@ # readme files -stdocdir = $(datadir)/doc/packages/@HB_PKG@/stonith +stdocdir = $(docdir)/stonith README_FILES = README.bladehpi README.cyclades README.drac3 \ README.external README.ipmilan README.meatware \ --- heartbeat-2.99.2+sles11r9.orig/lib/plugins/stonith/external/Makefile.am +++ heartbeat-2.99.2+sles11r9/lib/plugins/stonith/external/Makefile.am @@ -35,6 +35,6 @@ # readme files -stdocdir = $(datadir)/doc/packages/@HB_PKG@/stonith +stdocdir = $(docdir)/stonith stdoc_DATA = $(README_FILES) --- heartbeat-2.99.2+sles11r9.orig/lib/stonith/main.c +++ heartbeat-2.99.2+sles11r9/lib/stonith/main.c @@ -226,6 +226,16 @@ int count = 1; int help = 0; + /* The bladehpi stonith plugin makes use of openhpi which is + * threaded. The mix of memory allocation without thread + * initialization followed by g_thread_init followed by + * deallocating that memory results in segfault. Hence the + * following G_SLICE setting; see + * http://library.gnome.org/devel/glib/stable/glib-Memory-Slices.html#g-slice-alloc + */ + + setenv("G_SLICE", "always-malloc", 1); + if ((cmdname = strrchr(argv[0], '/')) == NULL) { cmdname = argv[0]; }else{ --- heartbeat-2.99.2+sles11r9.orig/lib/stonith/sbd.c +++ heartbeat-2.99.2+sles11r9/lib/stonith/sbd.c @@ -49,7 +49,7 @@ static int watchdog_use = 0; static int go_daemon = 0; -const char * watchdogdev = "/dev/watchdog"; +static const char *watchdogdev = "/dev/watchdog"; static char * local_uname; /* Global, non-tunable variables: */ @@ -59,10 +59,10 @@ static char *devname; static char *cmdname; -void -usage() +static void +usage(void) { - fprintf(stderr, + fprintf(stderr, "Shared storage fencing tool.\n" "Syntax:\n" " %s \n" @@ -194,7 +194,7 @@ return -1; } -void * +static void * sector_alloc(void) { void *x; @@ -204,7 +204,7 @@ exit(1); } memset(x, 0, sector_size); - + return x; } --- heartbeat-2.99.2+sles11r9.orig/logd/ha_logd.c +++ heartbeat-2.99.2+sles11r9/logd/ha_logd.c @@ -76,17 +76,17 @@ #define EOS '\0' #define nullchk(a) ((a) ? (a) : "") -int logd_keepalive_ms = 1000; -int logd_warntime_ms = 5000; -int logd_deadtime_ms = 10000; -gboolean RegisteredWithApphbd = FALSE; -gboolean verbose =FALSE; -pid_t write_process_pid; -IPC_Channel* chanspair[2]; -gboolean stop_reading = FALSE; -gboolean needs_shutdown = FALSE; +static const int logd_keepalive_ms = 1000; +static const int logd_warntime_ms = 5000; +static const int logd_deadtime_ms = 10000; +static gboolean RegisteredWithApphbd = FALSE; +static gboolean verbose = FALSE; +static pid_t write_process_pid; +static IPC_Channel *chanspair[2]; +static gboolean stop_reading = FALSE; +static gboolean needs_shutdown = FALSE; -struct { +static struct { char debugfile[MAXLINE]; char logfile[MAXLINE]; char entity[MAXLINE]; @@ -120,10 +120,10 @@ static char* cmdname = NULL; -struct directive{ +static struct directive { const char* name; int (*add_func)(const char*); -} Directives[]= { +} Directives[] = { {"debugfile", set_debugfile}, {"logfile", set_logfile}, {"logfacility", set_facility}, --- heartbeat-2.99.2+sles11r9.orig/lrm/admin/lrmadmin.c +++ heartbeat-2.99.2+sles11r9/lrm/admin/lrmadmin.c @@ -47,36 +47,36 @@ #include #include -const char * optstring = "A:D:X:dE:F:dg:p:M:O:P:c:S:LI:CT:n:h"; +static const char *optstring = "A:D:X:dE:F:dg:p:M:O:P:c:S:LI:CT:n:h"; #ifdef HAVE_GETOPT_H static struct option long_options[] = { - {"daemon", 0, 0, 'd'}, - {"executera", 1, 0, 'E'}, - {"flush",1,0,'F'}, - {"state",1,0,'S'}, - {"listall",0,0,'L'}, - {"information",1,0,'I'}, - {"add",1,0,'A'}, - {"delete",1,0,'D'}, - {"fail",1,0,'X'}, - {"raclass_supported",1,0,'C'}, - {"ratype_supported",1,0,'T'}, - {"all_type_metadata",1,0,'O'}, - {"metadata",1,0,'M'}, - {"provider",1,0,'P'}, - {"set_lrmd_param", 1, 0, 'p'}, - {"get_lrmd_param", 1, 0, 'g'}, - {"help",0,0,'h'}, - {0,0,0,0} + {"daemon", 0, NULL, 'd'}, + {"executera", 1, NULL, 'E'}, + {"flush", 1, NULL, 'F'}, + {"state", 1, NULL, 'S'}, + {"listall", 0, NULL, 'L'}, + {"information", 1, NULL, 'I'}, + {"add", 1, NULL, 'A'}, + {"delete", 1, NULL, 'D'}, + {"fail", 1, NULL, 'X'}, + {"raclass_supported", 1, NULL, 'C'}, + {"ratype_supported", 1, NULL, 'T'}, + {"all_type_metadata", 1, NULL, 'O'}, + {"metadata", 1, NULL, 'M'}, + {"provider", 1, NULL, 'P'}, + {"set_lrmd_param", 1, NULL, 'p'}, + {"get_lrmd_param", 1, NULL, 'g'}, + {"help", 0, NULL, 'h'}, + {NULL, 0, NULL, 0} }; #endif /* HAVE_GETOPT_H */ -GMainLoop *mainloop = NULL; -const char * lrmadmin_name = "lrmadmin"; -const char * fake_name = NULL; +static GMainLoop *mainloop; +static const char *lrmadmin_name = "lrmadmin"; +static const char *fake_name; /* 20 is the length limit for a argv[x] */ -const int ARGVI_MAX_LEN = 48; +static const int ARGVI_MAX_LEN = 48; typedef enum { ERROR_OPTION = -1, @@ -138,7 +138,7 @@ static int call_id = 0; static int TIMEOUT = -1; /* the unit is ms */ -const char * simple_help_screen = +static const char *simple_help_screen = "lrmadmin {-d|--deamon}\n" " {-A|--add} []\n" " {-D|--delete} \n" @@ -197,15 +197,15 @@ static void lrm_op_done_callback(lrm_op_t* op); -int ret_value = 0; +static int ret_value; int main(int argc, char **argv) { int option_char; char rscid_arg_tmp[RID_LEN]; ll_lrm_t* lrmd; lrm_rsc_t * lrm_rsc; - GList *raclass_list = 0, - *ratype_list = 0, + GList *raclass_list = NULL, + *ratype_list = NULL, *rscid_list; GHashTable *all_meta = NULL; char raclass[20]; --- heartbeat-2.99.2+sles11r9.orig/lrm/test/callbacktest.c +++ heartbeat-2.99.2+sles11r9/lrm/test/callbacktest.c @@ -29,16 +29,15 @@ #include #include -void lrm_op_done_callback (lrm_op_t* op); -void printf_rsc(lrm_rsc_t* rsc); -void printf_op(lrm_op_t* op); -void printf_hash_table(GHashTable* hash_table); -void get_all_rsc(ll_lrm_t* lrm); -void get_cur_state(lrm_rsc_t* rsc); -gboolean lrm_dispatch(IPC_Channel* notused, gpointer user_data); -GMainLoop* mainloop = NULL; +static void lrm_op_done_callback(lrm_op_t *op); +static void printf_rsc(lrm_rsc_t *rsc); +static void printf_op(lrm_op_t *op); +static void printf_hash_table(GHashTable *hash_table); +static gboolean lrm_dispatch(IPC_Channel *notused, gpointer user_data); +static GMainLoop *mainloop; -int main (int argc, char* argv[]) +int +main(int argc, char *argv[]) { ll_lrm_t* lrm; lrm_rsc_t* rsc = NULL; @@ -128,22 +127,27 @@ puts("signoff..."); lrm->lrm_ops->signoff(lrm); - + return 0; } -void lrm_op_done_callback(lrm_op_t* op) + +static void +lrm_op_done_callback(lrm_op_t *op) { puts("lrm_op_done_callback..."); printf_op(op); } -gboolean lrm_dispatch(IPC_Channel* notused, gpointer user_data) + +static gboolean +lrm_dispatch(IPC_Channel *notused, gpointer user_data) { ll_lrm_t *lrm = (ll_lrm_t*)user_data; lrm->lrm_ops->rcvmsg(lrm, FALSE); return TRUE; } -void printf_rsc(lrm_rsc_t* rsc) +static void +printf_rsc(lrm_rsc_t *rsc) { printf("print resource\n"); if (NULL == rsc) { @@ -159,7 +163,8 @@ printf("print end\n"); } -void printf_op(lrm_op_t* op) +static void +printf_op(lrm_op_t *op) { printf("print op\n"); @@ -188,8 +193,9 @@ { printf("\t\t%s=%s\n",(char*)key,(char*)value); } -void -printf_hash_table(GHashTable* hash_table) + +static void +printf_hash_table(GHashTable *hash_table) { if (NULL == hash_table) { printf("\t\tnull\n"); @@ -197,39 +203,3 @@ } g_hash_table_foreach(hash_table, printf_pair, NULL); } -void -get_all_rsc(ll_lrm_t* lrm) -{ - GList* element = NULL, * rid_list = NULL; - - puts("get_all_rscs..."); - rid_list = lrm->lrm_ops->get_all_rscs(lrm); - if (NULL != rid_list) { - element = g_list_first(rid_list); - while (NULL != element) { - printf("\tid:%s\n",(char*)element->data); - element = g_list_next(element); - } - } else { - puts("\tnone."); - } -} -void -get_cur_state(lrm_rsc_t* rsc) -{ - state_flag_t state; - GList* node = NULL, * op_list = NULL; - lrm_op_t* op = NULL; - - op_list = rsc->ops->get_cur_state(rsc, &state); - - printf("\tcurrent state:%s\n",state==LRM_RSC_IDLE?"Idel":"Busy"); - - - for(node = g_list_first(op_list); NULL != node; - node = g_list_next(node)) { - op = (lrm_op_t*)node->data; - printf_op(op); - } - -} --- heartbeat-2.99.2+sles11r9.orig/membership/ccm/ccm_testclient.c +++ heartbeat-2.99.2+sles11r9/membership/ccm/ccm_testclient.c @@ -30,7 +30,7 @@ #include -oc_ev_t *ev_token; +static oc_ev_t *ev_token; extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int ); --- heartbeat-2.99.2+sles11r9.orig/membership/ccm/ccmlib_clm.c +++ heartbeat-2.99.2+sles11r9/membership/ccm/ccmlib_clm.c @@ -70,14 +70,14 @@ static SaErrorT retrieve_node_buffer(SaClmNodeIdT nodeId , SaClmClusterNodeT *clusterNode); -static void pthread_lock() +static void pthread_lock(void) { #ifdef POSIX_THREADS pthread_mutex_lock(&__clmlib_mutex); #endif } -static void pthread_unlock() +static void pthread_unlock(void) { #ifdef POSIX_THREADS pthread_mutex_unlock(&__clmlib_mutex); @@ -85,7 +85,7 @@ } static void -clm_init() +clm_init(void) { static gboolean clminit_flag = FALSE; --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Squid +++ heartbeat-2.99.2+sles11r9/resources/OCF/Squid @@ -158,7 +158,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/IPv6addr.c +++ heartbeat-2.99.2+sles11r9/resources/OCF/IPv6addr.c @@ -855,8 +855,8 @@ " \n" " \n" " \n" - " \n" - " \n" + " \n" + " \n" " \n" " \n" " \n" --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/SAPDatabase +++ heartbeat-2.99.2+sles11r9/resources/OCF/SAPDatabase @@ -69,7 +69,7 @@ -1.91 +1.92 Resource script for SAP databases. It manages a SAP database of any type as an HA resource. @@ -158,7 +158,7 @@ - + @@ -274,7 +274,7 @@ # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be used here # as the output might be to long. cnt=`ps efo args --user $sdbuser | grep -c vserver` - if [ $cnt -eq 1 ] + if [ $cnt -ge 1 ] then rc=$OCF_SUCCESS else @@ -899,19 +899,13 @@ DIR_EXECUTABLE="" for EXEPATH in $PATHLIST do - SAPSTARTDB=`which $EXEPATH/$EXESTARTDB 2> /dev/null` - if [ $? -eq 0 ] + if [ -x $EXEPATH/$EXESTARTDB -a -x $EXEPATH/$EXESTOPDB -a -x $EXEPATH/$EXEDBCONNECT ] then - MYPATH=`echo "$SAPSTARTDB" | head -1` - MYPATH=`dirname "$MYPATH"` - if [ -x $MYPATH/$EXESTARTDB -a -x $MYPATH/$EXESTOPDB -a -x $MYPATH/$EXEDBCONNECT ] - then - DIR_EXECUTABLE=$MYPATH - SAPSTARTDB=$MYPATH/$EXESTARTDB - SAPSTOPDB=$MYPATH/$EXESTOPDB - SAPDBCONNECT=$MYPATH/$EXEDBCONNECT - break - fi + DIR_EXECUTABLE=$EXEPATH + SAPSTARTDB=$EXEPATH/$EXESTARTDB + SAPSTOPDB=$EXEPATH/$EXESTOPDB + SAPDBCONNECT=$EXEPATH/$EXEDBCONNECT + break fi done if [ -z "$DIR_EXECUTABLE" ] --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Makefile.am +++ heartbeat-2.99.2+sles11r9/resources/OCF/Makefile.am @@ -53,7 +53,6 @@ AudibleAlarm \ db2 \ Delay \ - drbd \ eDir88 \ EvmsSCC \ Evmsd \ @@ -62,12 +61,15 @@ iscsi \ ICP \ IPsrcaddr \ + iSCSITarget \ + iSCSILogicalUnit \ LinuxSCSI \ LVM \ MailTo \ ManageRAID \ ManageVE \ mysql \ + mysql-proxy \ nfsserver \ oracle \ oralsnr \ --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/iSCSILogicalUnit +++ heartbeat-2.99.2+sles11r9/resources/OCF/iSCSILogicalUnit @@ -0,0 +1,452 @@ +#!/bin/bash +# +# +# iSCSILogicalUnit OCF RA. Exports and manages iSCSI Logical Units. +# +# Copyright (c) 2009 LINBIT HA-Solutions GmbH, Florian Haas +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# + +####################################################################### +# Initialization: +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs +LC_ALL="C" +LANG="C" + +# Defaults +# Set a default implementation based on software installed +if have_binary ietadm; then + OCF_RESKEY_implementation_default="iet" +elif have_binary tgtadm; then + OCF_RESKEY_implementation_default="tgt" +fi +: ${OCF_RESKEY_implementation=${OCF_RESKEY_implementation_default}} + +# Use a default SCSI ID and SCSI SN that is unique across the cluster, +# and persistent in the event of resource migration +# SCSI IDs are limited to 24 bytes, so take the first 24 bytes of +# $OCF_RESOURCE_INSTANCE +OCF_RESKEY_scsi_id_default="${OCF_RESOURCE_INSTANCE:0:24}" +: ${OCF_RESKEY_scsi_id=${OCF_RESKEY_scsi_id_default}} +# To have a reasonably unique default SCSI SN, use the first 8 bytes +# of an MD5 hash of of $OCF_RESOURCE_INSTANCE +sn=`echo -n "${OCF_RESOURCE_INSTANCE}" | openssl md5` +OCF_RESKEY_scsi_sn_default=${sn:0:8} +: ${OCF_RESKEY_scsi_sn=${OCF_RESKEY_scsi_sn_default}} +####################################################################### + +meta_data() { + cat < + + +0.9 + + +Manages iSCSI targets. An iSCSI target is a collection of SCSI Logical +Units (LUs) exported via a daemon that speaks the iSCSI protocol. + +iSCSI target export agent + + + + +The iSCSI target daemon implementation. Must be one of "iet" or "tgt". +If unspecified, an implementation is selected based on the +availability of management utilities, with "iet" being tried first, +then "tgt". + +iSCSI target daemon implementation + + + + + +The iSCSI Qualified Name (IQN) that this Logical Unit belongs to. + +iSCSI target IQN + + + + + +The Logical Unit number (LUN) exposed to initiators. + +Logical Unit number (LUN) + + + + + +The path to the block device exposed. Some implementations allow this +to be a regular file, too. + +Block device (or file) path + + + + + +The SCSI ID to be configured for this Logical Unit. The default +is the resource name, truncated to 24 bytes. + +SCSI ID + + + + + +The SCSI serial number to be configured for this Logical Unit. +The default is a hash of the resource name, truncated to 8 bytes. + +SCSI serial number + + + + + +The SCSI vendor ID to be configured for this Logical Unit. + +SCSI vendor ID + + + + + +The SCSI product ID to be configured for this Logical Unit. + +SCSI product ID + + + + + +Additional LU parameters. A space-separated list of "name=value" pairs +which will be passed through to the iSCSI daemon's management +interface. The supported parameters are implementation +dependent. Neither the name nor the value may contain whitespace. + +List of iSCSI LU parameters + + + + + + + + + + + + + +END +} + +####################################################################### + +do_cmd() { + # Wrap local commands to capture their exit code and output. Some + # implementations (IET, notably) have management commands with + # very terse output. It helps to at least capture exit codes in + # the logs. + local cmd="$*" + ocf_log debug "Calling $cmd" + local cmd_out + cmd_out=$($cmd 2>&1) + ret=$? + + if [ $ret -ne 0 ]; then + ocf_log err "Called \"$cmd\"" + ocf_log err "Exit code $ret" + ocf_log err "Command output: \"$cmd_out\"" + else + ocf_log debug "Exit code $ret" + ocf_log debug "Command output: \"$cmd_out\"" + fi + + echo $cmd_out + return $ret +} + + +iSCSILogicalUnit_usage() { + cat < - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/db2 +++ heartbeat-2.99.2+sles11r9/resources/OCF/db2 @@ -84,7 +84,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Xinetd +++ heartbeat-2.99.2+sles11r9/resources/OCF/Xinetd @@ -58,8 +58,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/vmware +++ heartbeat-2.99.2+sles11r9/resources/OCF/vmware @@ -303,7 +303,7 @@ +start-delay="0" /> --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Filesystem +++ heartbeat-2.99.2+sles11r9/resources/OCF/Filesystem @@ -135,7 +135,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Raid1 +++ heartbeat-2.99.2+sles11r9/resources/OCF/Raid1 @@ -154,8 +154,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/MailTo +++ heartbeat-2.99.2+sles11r9/resources/OCF/MailTo @@ -73,8 +73,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/pingd +++ heartbeat-2.99.2+sles11r9/resources/OCF/pingd @@ -117,7 +117,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ManageRAID +++ heartbeat-2.99.2+sles11r9/resources/OCF/ManageRAID @@ -111,8 +111,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/drbd +++ heartbeat-2.99.2+sles11r9/resources/OCF/drbd @@ -30,11 +30,6 @@ # OCF instance parameters # OCF_RESKEY_drbd_resource # OCF_RESKEY_drbdconf -# OCF_RESKEY_CRM_meta_clone_max -# OCF_RESKEY_CRM_meta_clone_node_max -# OCF_RESKEY_master_max -# OCF_RESKEY_master_node_max - ####################################################################### # Initialization: @@ -90,39 +85,6 @@ Override drbd hostname - - - - -Number of clones of this drbd resource. Do not fiddle with the default. - -Number of clones - - - - - -Clones per node. Do not fiddle with the default. - -Number of nodes - - - - - -Maximum number of active primaries. Do not fiddle with the default. - -Number of primaries - - - - - -Maximum number of primaries per node. Do not fiddle with the default. - -Number of primaries per node - - @@ -131,8 +93,8 @@ - - + + @@ -579,8 +541,8 @@ if [ "$OCF_RESKEY_CRM_meta_clone_max" -ne 2 ] \ || [ "$OCF_RESKEY_CRM_meta_clone_node_max" -ne 1 ] \ - || [ "$OCF_RESKEY_master_node_max" -ne 1 ] \ - || [ "$OCF_RESKEY_master_max" -ne 1 ] ; then + || [ "$OCF_RESKEY_CRM_meta_master_node_max" -ne 1 ] \ + || [ "$OCF_RESKEY_CRM_meta_master_max" -ne 1 ] ; then ocf_log err "Clone options misconfigured." exit $OCF_ERR_CONFIGURED fi --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/apache +++ heartbeat-2.99.2+sles11r9/resources/OCF/apache @@ -266,7 +266,7 @@ Listen="localhost:$Listen" STATUSURL="http://${Listen}$StatusURL" case $WGET in - *wget*) WGETOPTS="$WGETOPTS --bind-address=127.0.0.1";; + *wget*) WGETOPTS="$WGETOPTS --no-proxy --bind-address=127.0.0.1";; esac else STATUSURL="${LOCALHOST}:${PORT}$StatusURL" @@ -517,7 +517,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ClusterMon +++ heartbeat-2.99.2+sles11r9/resources/OCF/ClusterMon @@ -99,7 +99,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/WAS +++ heartbeat-2.99.2+sles11r9/resources/OCF/WAS @@ -134,8 +134,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/portblock +++ heartbeat-2.99.2+sles11r9/resources/OCF/portblock @@ -23,7 +23,7 @@ usage() { - cat <<-!USAGE >&2 + cat <&2 usage: $CMD {start|stop|status|monitor|meta-data|validate-all} $CMD is used to temporarily block ports using iptables. @@ -53,7 +53,7 @@ NOTE: iptables is linux-specific... - !USAGE +END } meta_data() { @@ -98,8 +98,8 @@ - - + + @@ -115,18 +115,6 @@ # This is because we expect an "unblock" resource to come along # and disable us -- but we're still in some sense active... # -# So, we track the state here using the pseudo_resource() function. -# -# The psuedo_resource function should be moved into the functions -# available to resources so other resource scripts could use it... -# -# - -# pseudo_resource filename operation -pseudo_resource() -{ - ha_pseudo_resource $* -} #iptables_spec {udp|tcp} portno,portno iptables_spec() @@ -152,48 +140,54 @@ SayActive() { echo "$CMD DROP rule for INPUT chain [$*] is running (OK)" - return 0 } SayConsideredActive() { echo "$CMD DROP rule for INPUT chain [$*] considered to be running (OK)" - return 0 } SayInactive() { echo "$CMD DROP rule for INPUT chain [$*] is inactive" - return 1 } #IptablesStatus {udp|tcp} portno,portno {block|unblock} -IptablesStatus() -{ - activewords="$CMD $1 $2 is running (OK)" - if - chain_isactive "$1" "$2" - then - case $3 in - block) SayActive $*;; - *) SayInactive $*;; - esac - else - case $3 in - block) - if - pseudo_resource "$RSCNAME" status - then - SayConsideredActive $* +IptablesStatus() { + local rc + rc=$OCF_ERR_GENERIC + activewords="$CMD $1 $2 is running (OK)" + if chain_isactive "$1" "$2"; then + case $3 in + block) + SayActive $* + rc=$OCF_SUCCESS + ;; + *) + SayInactive $* + rc=$OCF_NOT_RUNNING + ;; + esac + else + case $3 in + block) + if ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" status; then + SayConsideredActive $* + rc=$OCF_SUCCESS else - SayInactive $* - fi;; - - *) SayActive $*;; - esac - fi - - return $? + SayInactive $* + rc=$OCF_NOT_RUNNING + fi + ;; + + *) + SayActive $* + rc=$OCF_SUCCESS + ;; + esac + fi + + return $rc } #IptablesBLOCK {udp|tcp} portno,portno @@ -227,7 +221,7 @@ #IptablesStart {udp|tcp} portno,portno {block|unblock} IptablesStart() { - pseudo_resource "$RSCNAME" start + ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" start case $3 in block) IptablesBLOCK "$@";; unblock) IptablesUNBLOCK "$@";; @@ -240,7 +234,7 @@ #IptablesStop {udp|tcp} portno,portno {block|unblock} IptablesStop() { - pseudo_resource "$RSCNAME" stop + ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" stop case $3 in block) IptablesUNBLOCK "$@";; unblock) IptablesBLOCK "$@";; @@ -333,8 +327,6 @@ portno=$OCF_RESKEY_portno action=$OCF_RESKEY_action -RSCNAME=${CMD}_${protocol}_${portno}_${action} - case $1 in start) IptablesStart $protocol $portno $action --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/IPaddr +++ heartbeat-2.99.2+sles11r9/resources/OCF/IPaddr @@ -195,7 +195,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/mysql-proxy +++ heartbeat-2.99.2+sles11r9/resources/OCF/mysql-proxy @@ -0,0 +1,365 @@ +#!/bin/sh +# +# Resource script for MySQL Proxy +# +# Description: Manages MySQL Proxy as an OCF resource in +# an high-availability setup. +# +# Tested with mysql-proxy 0.7.0 on Debian 5.0. +# Based on the mysql and Pure-Ftpd OCF resource agents. +# +# Author: Raoul Bhatia : Original Author +# License: GNU General Public License (GPL) +# +# +# usage: $0 {start|stop|reload|status|monitor|validate-all|meta-data} +# +# The "start" arg starts a MySQL Proxy instance +# +# The "stop" arg stops it. +# +# TODO +# * add error checking like in mysql ocf ra (e.g. socketdir) +# * verify if mysql-proxy supports multiple --proxy-address(es) +# +# Test via +# */usr/sbin/ocf-tester -n mp /usr/lib/ocf/resource.d/heartbeat/mysql-proxy +# */usr/sbin/ocf-tester -n ms -o binary="/usr/sbin/mysql-proxy" -o defaults_file="" -o parameters="--proxy-skip-profiling" \ +# -o admin_address="127.0.0.1:4041" -o proxy_backend_addresses="192.168.100.200:42006" \ +# -o proxy_address="/var/run/mysqld/mysqld.sock" /usr/lib/ocf/resource.d/heartbeat/mysql-proxy +# +# * adding two mysql-instances (mysql-proxy-tcp and mysql-proxy-socket) and killing mysql-proxy-tcp +# beware, that as of mysql-proxy 0.7.0 (and possibly later), the socket is not automatically removed +# +# +# OCF parameters: +# OCF_RESKEY_binary +# OCF_RESKEY_defaults_file +# OCF_RESKEY_proxy_backend_addresses +# OCF_RESKEY_proxy_read_only_backend_addresses +# OCF_RESKEY_proxy_address +# OCF_RESKEY_admin_address +# OCF_RESKEY_parameters +# OCF_RESKEY_pidfile +# +########################################################################## + +# Initialization: + +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs + +: ${OCF_RESKEY_binary="/usr/sbin/mysql-proxy"} +: ${OCF_RESKEY_defaults_file=""} +: ${OCF_RESKEY_proxy_backend_addresses="127.0.0.1:3306"} +: ${OCF_RESKEY_proxy_read_only_backend_addresses=""} +: ${OCF_RESKEY_proxy_address=":4040"} +: ${OCF_RESKEY_admin_address="127.0.0.1:4041"} +: ${OCF_RESKEY_parameters=""} +: ${OCF_RESKEY_pidfile="${HA_RSCTMP}/mysql-proxy-${OCF_RESOURCE_INSTANCE}.pid"} +USAGE="Usage: $0 {start|stop|reload|status|monitor|validate-all|meta-data}"; + +########################################################################## + +usage() { + echo $USAGE >&2 +} + +meta_data() { + cat < + + +0.1 + +This script manages MySQL Proxy as an OCF resource in a high-availability setup. +Tested with MySQL Proxy 0.7.0 on Debian 5.0. + +OCF Resource Agent compliant MySQL Proxy script. + + + + + +Full path to the MySQL Proxy binary. +For example, "/usr/sbin/mysql-proxy". + +Full path to MySQL Proxy binary + + + + + +Full path to a MySQL Proxy configuration file. +For example, "/etc/mysql-proxy.conf". + +Full path to configuration file + + + + + +Address:port of the remote backend-servers (default: 127.0.0.1:3306). + + + + + + + +Address:port of the remote slave-server (default: not set). + + + + + + + +Listening address:port of the proxy-server (default: :4040). +You can also specify a socket like "/tmp/mysql-proxy.sock". + + + + + + + +Listening address:port of the admin-server (default: 127.0.0.1:4041). + + + + + + + +The MySQL Proxy daemon may be called with additional parameters. +Specify any of them here. + + + + + + +PID file +PID file + + + + + + + + + + + + + + +END + exit $OCF_SUCCESS +} + +isRunning() +{ + kill -0 "$1" 2>/dev/null +} + +mysqlproxy_status() +{ + if [ -f "${pidfile}" ]; then + # MySQL Proxy is probably running + PID=`head -n 1 "${pidfile}"` + if [ ! -z "$PID" ] ; then + isRunning "$PID" + return $? + fi + fi + + # MySQL Proxy is not running + false +} + +mysqlproxy_start() +{ + # if MySQL Proxy is running return success + if mysqlproxy_status ; then + ocf_log info "MySQL Proxy already running." + exit $OCF_SUCCESS + fi + + # check that the MySQL Proxy binary exists and can be executed + if [ ! -x "$binary" ]; then + ocf_log err "MySQL Proxy binary '$binary' does not exist or cannot be executed." + exit $OCF_ERR_GENERIC + fi + + # check if the MySQL Proxy defaults-file exist + PARAM_PREFIX='' + if [ -f "$defaults_file" ]; then + PARAM_PREFIX="--defaults-file=$defaults_file " + fi + + # split multiple proxy-address options. + # currently unsupported but let us hope for the future ;) + for pa in $proxy_address; do + [ -z "$pa" ] && continue + OPTIONS=" $OPTIONS --proxy-address=$pa" + done + + # split multiple proxy-backend-addresses options. + for pba in $proxy_backend_addresses; do + [ -z "$pba" ] && continue + OPTIONS=" $OPTIONS --proxy-backend-addresses=$pba" + done + + # split multiple proxy-backend-addresses options. + for proba in $proxy_read_only_backend_addresses; do + [ -z "$proba" ] && continue + OPTIONS=" $OPTIONS --proxy-read-only-backend-addresses=$proba" + done + + # build $OPTIONS and add addmin-address and pidfile + OPTIONS="$PARAM_PREFIX $OPTIONS --admin-address=$admin_address --pid-file=${pidfile} $PARAM_SUFFIX" + + # start MySQL Proxy + #start-stop-daemon --start --quiet --pidfile $pidfile --make-pidfile --name mysql-proxy --startas $binary -b -- $OPTIONS + $binary --daemon $OPTIONS + ret=$? + + if [ $ret -ne 0 ]; then + ocf_log err "MySQL Proxy returned error." $ret + exit $OCF_ERR_GENERIC + fi + + exit $OCF_SUCCESS +} + + +mysqlproxy_stop() +{ + if mysqlproxy_status ; then + #start-stop-daemon --stop --quiet --retry 3 --exec $binary --pidfile $pidfile + /bin/kill `cat "${pidfile}"` + ret=$? + + if [ $ret -ne 0 ]; then + ocf_log err "MySQL Proxy returned an error while stopping." $ret + exit $OCF_ERR_GENERIC + fi + + # grant some time for shutdown and recheck + sleep 1 + if mysqlproxy_status ; then + ocf_log err "MySQL Proxy failed to stop." + exit $OCF_ERR_GENERIC + fi + + # remove dangling socketfile, if specified + for pa in $proxy_address; do + if [ -S "$pa" ]; then + ocf_log info "Removing dangling socket file '$pa'." + rm -f "$pa" + fi + done + + # remove dangling pidfile + if [ -f "${pidfile}" ]; then + ocf_log info "Removing dangling pidfile '${pidfile}'." + rm -f "${pidfile}" + fi + fi + + exit $OCF_SUCCESS +} + +mysqlproxy_reload() +{ + if mysqlproxy_status; then + ocf_log info "Reloading MySQL Proxy." + kill -HUP `cat ${pidfile}` + fi +} + +mysqlproxy_monitor() +{ + if mysqlproxy_status ; then + return $OCF_SUCCESS + fi + + return $OCF_NOT_RUNNING +} + +mysqlproxy_validate_all() +{ + + # @TODO + return $OCF_SUCCESS +} + +# +# Main +# + +if [ $# -ne 1 ]; then + usage + exit $OCF_ERR_ARGS +fi + +pidfile=$OCF_RESKEY_pidfile +binary=$OCF_RESKEY_binary +defaults_file=$OCF_RESKEY_defaults_file +proxy_backend_addresses=$OCF_RESKEY_proxy_backend_addresses +proxy_read_only_backend_addresses=$OCF_RESKEY_proxy_read_only_backend_addresses +admin_address=$OCF_RESKEY_admin_address +proxy_address=$OCF_RESKEY_proxy_address + +# debugging stuff +#echo OCF_RESKEY_binary=$OCF_RESKEY_binary >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_defaults_file=$OCF_RESKEY_defaults_file >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_proxy_backend_addresses=$OCF_RESKEY_proxy_backend_addresses >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_proxy_read_only_backend_addresses=$OCF_RESKEY_proxy_read_only_backend_addresses >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_proxy_address=$OCF_RESKEY_proxy_address >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_admin_address=$OCF_RESKEY_admin_address >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_parameters=$OCF_RESKEY_parameters >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE +#echo OCF_RESKEY_pidfile=$OCF_RESKEY_pidfile >> /tmp/prox_conf_$OCF_RESOURCE_INSTANCE + + +case $1 in + start) mysqlproxy_start + ;; + + stop) mysqlproxy_stop + ;; + + reload) mysqlproxy_reload + ;; + + status) if mysqlproxy_status; then + ocf_log info "MySQL Proxy is running." + exit $OCF_SUCCESS + else + ocf_log info "MySQL Proxy is stopped." + exit $OCF_NOT_RUNNING + fi + ;; + + monitor) mysqlproxy_monitor + exit $? + ;; + + validate-all) mysqlproxy_validate_all + exit $? + ;; + + meta-data) meta_data + ;; + + usage) usage + exit $OCF_SUCCESS + ;; + + *) usage + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Xen +++ heartbeat-2.99.2+sles11r9/resources/OCF/Xen @@ -153,7 +153,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/LinuxSCSI +++ heartbeat-2.99.2+sles11r9/resources/OCF/LinuxSCSI @@ -128,8 +128,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/LVM +++ heartbeat-2.99.2+sles11r9/resources/OCF/LVM @@ -85,7 +85,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/IPsrcaddr +++ heartbeat-2.99.2+sles11r9/resources/OCF/IPsrcaddr @@ -93,7 +93,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ServeRAID +++ heartbeat-2.99.2+sles11r9/resources/OCF/ServeRAID @@ -137,8 +137,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/WAS6 +++ heartbeat-2.99.2+sles11r9/resources/OCF/WAS6 @@ -108,8 +108,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/WinPopup +++ heartbeat-2.99.2+sles11r9/resources/OCF/WinPopup @@ -57,8 +57,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/IPaddr2 +++ heartbeat-2.99.2+sles11r9/resources/OCF/IPaddr2 @@ -225,8 +225,8 @@ - - + + @@ -360,7 +360,7 @@ # # List interfaces but exclude FreeS/WAN ipsecN virtual interfaces # - local iface=`$IP2UTIL -o -f inet addr show | grep "\ $BASEIP/" \ + local iface=`$IP2UTIL -o -f inet addr show | grep "\ $BASEIP/$NETMASK" \ | cut -d ' ' -f2 | grep -v '^ipsec[0-9][0-9]*$'` echo $iface return 0 --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/iSCSITarget +++ heartbeat-2.99.2+sles11r9/resources/OCF/iSCSITarget @@ -0,0 +1,452 @@ +#!/bin/bash +# +# +# iSCSITarget OCF RA. Exports and manages iSCSI targets. +# +# Copyright (c) 2009 LINBIT HA-Solutions GmbH, Florian Haas +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# + +####################################################################### +# Initialization: +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs +LC_ALL="C" +LANG="C" + +# Defaults +# Set a default implementation based on software installed +if have_binary ietadm; then + OCF_RESKEY_implementation_default="iet" +elif have_binary tgtadm; then + OCF_RESKEY_implementation_default="tgt" +fi +: ${OCF_RESKEY_implementation=${OCF_RESKEY_implementation_default}} +####################################################################### + +meta_data() { + cat < + + +0.9 + + +Manages iSCSI targets. An iSCSI target is a collection of SCSI Logical +Units (LUs) exported via a daemon that speaks the iSCSI protocol. + +iSCSI target export agent + + + + +The iSCSI target daemon implementation. Must be one of "iet" or "tgt". +If unspecified, an implementation is selected based on the +availability of management utilities, with "iet" being tried first, +then "tgt". + +iSCSI target daemon implementation + + + + + +The target iSCSI Qualified Name (IQN). Should follow the conventional +"iqn.yyyy-mm.<reversed domain name>[:identifier]" syntax. + +iSCSI target IQN + + + + + +The iSCSI target ID. Required for tgt. + +iSCSI target ID + + + + + +Allowed initiators. A space-separated list of initiators allowed to +connect to this target. Initiators may be listed in any syntax +the target implementation allows. If this parameter is empty or +not set, access to this target will be allowed from any initiator. + +List of iSCSI initiators allowed to connect +to this target + + + + + +A username used for incoming initiator authentication. If unspecified, +allowed initiators will be able to log in without authentication. + +Incoming account username + + + + + +A password used for incoming initiator authentication. + +Incoming account password + + + + + +Additional target parameters. A space-separated list of "name=value" +pairs which will be passed through to the iSCSI daemon's management +interface. The supported parameters are implementation +dependent. Neither the name nor the value may contain whitespace. + +List of iSCSI target parameters + + + + + + + + + + + + + +END +} + +####################################################################### + +do_cmd() { + # Wrap local commands to capture their exit code and output. Some + # implementations (IET, notably) have management commands with + # very terse output. It helps to at least capture exit codes in + # the logs. + local cmd="$*" + ocf_log debug "Calling $cmd" + local cmd_out + cmd_out=$($cmd 2>&1) + ret=$? + + if [ $ret -ne 0 ]; then + ocf_log err "Called \"$cmd\"" + ocf_log err "Exit code $ret" + ocf_log err "Command output: \"$cmd_out\"" + else + ocf_log debug "Exit code $ret" + ocf_log debug "Command output: \"$cmd_out\"" + fi + + echo $cmd_out + return $ret +} + + +iSCSITarget_usage() { + cat <> /etc/initiators.deny + echo "${OCF_RESKEY_iqn} ${OCF_RESKEY_allowed_initiators// /,}" >> /etc/initiators.allow + fi + # In iet, adding a new user and assigning it to a target + # is one operation. + if [ -n "${OCF_RESKEY_incoming_username}" ]; then + do_cmd ietadm --op new --user \ + --tid=${tid} \ + --params=IncomingUser=${OCF_RESKEY_incoming_username},Password=${OCF_RESKEY_incoming_password} \ + || return $OCF_ERR_GENERIC + fi + return $OCF_SUCCESS + ;; + tgt) + local tid + tid="${OCF_RESKEY_tid}" + # Create the target. + do_cmd tgtadm --lld iscsi --op new --mode target \ + --tid=${tid} \ + --targetname ${OCF_RESKEY_iqn} || return $OCF_ERR_GENERIC + # Set parameters. + for param in ${OCF_RESKEY_additional_parameters}; do + name=${param%=*} + value=${param#*=} + do_cmd tgtadm --lld iscsi --op update --mode target \ + --tid=${tid} \ + --name=${name} --value=${value} || return $OCF_ERR_GENERIC + done + # For tgt, we always have to add access per initiator; + # access to targets is denied by default. If + # "allowed_initiators" is unset, we must use the special + # keyword ALL. + for initiator in ${OCF_RESKEY_allowed_initiators=ALL}; do + do_cmd tgtadm --lld iscsi --op bind --mode target \ + --tid=${tid} \ + --initiator-address=${initiator} || return $OCF_ERR_GENERIC + done + # In tgt, we must first create a user account, then assign + # it to a target using the "bind" operation. + if [ -n "${OCF_RESKEY_incoming_username}" ]; then + do_cmd tgtadm --lld iscsi --mode account --op new \ + --user=${OCF_RESKEY_incoming_username} \ + --password=${OCF_RESKEY_incoming_password} || return $OCF_ERR_GENERIC + do_cmd tgtadm --lld iscsi --mode account --op bind \ + --tid=${tid} \ + --user=${OCF_RESKEY_incoming_username} || return $OCF_ERR_GENERIC + fi + return $OCF_SUCCESS + ;; + esac + return $OCF_ERR_GENERIC +} + +iSCSITarget_stop() { + iSCSITarget_monitor + if [ $? = $OCF_SUCCESS ]; then + local tid + case $OCF_RESKEY_implementation in + iet) + # Figure out the target ID + tid=`sed -ne "s/tid:\([[:digit:]]\+\) name:${OCF_RESKEY_iqn}/\1/p" < /proc/net/iet/volume` + if [ -z "${tid}" ]; then + ocf_log err "Failed to retrieve target ID for IQN ${OCF_RESKEY_iqn}" + return $OCF_ERR_GENERIC + fi + # Close existing connections. There is no other way to + # do this in IET than to parse the contents of + # /proc/net/iet/session. + set -- $(sed -ne '/^tid:'${tid}' /,/^tid/ { + /^[[:space:]]*sid:\([0-9]\+\)/ { + s/^[[:space:]]*sid:\([0-9]*\).*/--sid=\1/; h; + }; + /^[[:space:]]*cid:\([0-9]\+\)/ { + s/^[[:space:]]*cid:\([0-9]*\).*/--cid=\1/; G; p; + }; + }' < /proc/net/iet/session) + while [[ -n $2 ]]; do + # $2 $1 looks like "--sid=X --cid=Y" + do_cmd ietadm --op delete \ + --tid=${tid} $2 $1 + shift 2 + done + # In iet, unassigning a user from a target and + # deleting the user account is one operation. + if [ -n "${OCF_RESKEY_incoming_username}" ]; then + do_cmd ietadm --op delete --user \ + --tid=${tid} \ + --params=IncomingUser=${OCF_RESKEY_incoming_username} \ + || return $OCF_ERR_GENERIC + fi + do_cmd ietadm --op delete \ + --tid=${tid} || return $OCF_ERR_GENERIC + # Avoid stale /etc/initiators.{allow,deny} entries + # for this target + do_cmd sed -e "/^${OCF_RESKEY_iqn}[[:space:]]/d" \ + -i /etc/initiators.deny + do_cmd sed -e "/^${OCF_RESKEY_iqn}[[:space:]]/d" \ + -i /etc/initiators.allow + return $OCF_SUCCESS + ;; + tgt) + tid="${OCF_RESKEY_tid}" + # Close existing connections. There is no other way to + # do this in tgt than to parse the output of "tgtadm --op + # show". + set -- $(tgtadm --lld iscsi --op show --mode target \ + | sed -ne '/^Target '${tid}':/,/^Target/ { + /^[[:space:]]*I_T nexus: \([0-9]\+\)/ { + s/^.*: \([0-9]*\).*/--sid=\1/; h; + }; + /^[[:space:]]*Connection: \([0-9]\+\)/ { + s/^.*: \([0-9]*\).*/--cid=\1/; G; p; + }; + /^[[:space:]]*LUN information:/ q; + }') + while [[ -n $2 ]]; do + # $2 $1 looks like "--sid=X --cid=Y" + do_cmd tgtadm --lld iscsi --op delete --mode connection \ + --tid=${tid} $2 $1 + shift 2 + done + # In tgt, we must first unbind the user account from + # the target, then remove the account itself. + if [ -n "${OCF_RESKEY_incoming_username}" ]; then + do_cmd tgtadm --lld iscsi --mode account --op unbind \ + --tid=${tid} \ + --user=${OCF_RESKEY_incoming_username} || return $OCF_ERR_GENERIC + do_cmd tgtadm --lld iscsi --mode account --op delete \ + --user=${OCF_RESKEY_incoming_username} || return $OCF_ERR_GENERIC + fi + do_cmd tgtadm --lld iscsi --op delete --mode target \ + --tid=${tid} && return $OCF_SUCCESS + # In tgt, we don't have to worry about our ACL + # entries. They are automatically removed upon target + # deletion. + ;; + esac + else + return $OCF_SUCCESS + fi + return $OCF_ERR_GENERIC +} + +iSCSITarget_monitor() { + case $OCF_RESKEY_implementation in + iet) + grep -Eq "tid:[0-9]+ name:${OCF_RESKEY_iqn}" /proc/net/iet/volume && return $OCF_SUCCESS + ;; + tgt) + tgtadm --lld iscsi --op show --mode target \ + | grep -Eq "Target [0-9]+: ${OCF_RESKEY_iqn}" && return $OCF_SUCCESS + ;; + esac + + return $OCF_NOT_RUNNING +} + +iSCSITarget_validate() { + # Do we have all required variables? + local required_vars + case $OCF_RESKEY_implementation in + iet) + required_vars="implementation iqn" + ;; + tgt) + required_vars="implementation iqn tid" + ;; + esac + for var in ${required_vars}; do + param="OCF_RESKEY_${var}" + if [ -z "${!param}" ]; then + ocf_log error "Missing resource parameter \"$var\"!" + return $OCF_ERR_CONFIGURED + fi + done + + # Do we have all required binaries? + case $OCF_RESKEY_implementation in + iet) + check_binary ietadm + ;; + tgt) + check_binary tgtadm + ;; + *) + # and by the way, is the implementation supported? + ocf_log error "Unsupported iSCSI target implementation \"$OCF_RESKEY_implementation\"!" + return $OCF_ERR_CONFIGURED + esac + + # Is the required kernel functionality available? + case $OCF_RESKEY_implementation in + iet) + [ -d /proc/net/iet ] + if [ $? -ne 0 ]; then + ocf_log err "/proc/net/iet does not exist or is not a directory -- check if required modules are loaded." + return $OCF_ERR_INSTALLED + fi + ;; + tgt) + # tgt is userland only + ;; + esac + + return $OCF_SUCCESS +} + + +case $1 in + meta-data) + meta_data + exit $OCF_SUCCESS + ;; + usage|help) + iSCSITarget_usage + exit $OCF_SUCCESS + ;; +esac + +# Everything except usage and meta-data must pass the validate test +iSCSITarget_validate || exit $? + +case $__OCF_ACTION in +start) iSCSITarget_start;; +stop) iSCSITarget_stop;; +monitor) iSCSITarget_monitor;; +reload) ocf_log err "Reloading..." + iSCSITarget_start + ;; +validate-all) ;; +*) iSCSITarget_usage + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac +rc=$? +ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" +exit $rc --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Delay +++ heartbeat-2.99.2+sles11r9/resources/OCF/Delay @@ -79,8 +79,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/VIPArip +++ heartbeat-2.99.2+sles11r9/resources/OCF/VIPArip @@ -75,7 +75,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/rsyncd +++ heartbeat-2.99.2+sles11r9/resources/OCF/rsyncd @@ -89,7 +89,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/iscsi +++ heartbeat-2.99.2+sles11r9/resources/OCF/iscsi @@ -121,7 +121,7 @@ - + @@ -249,7 +249,7 @@ else $add_disk $portal $OCF_RESKEY_target || return $OCF_ERR_GENERIC - case "$OCF_RESKEY_udev" in + case "$udev" in [Yy]es) wait_for_udev || return $OCF_ERR_GENERIC ;; --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ids +++ heartbeat-2.99.2+sles11r9/resources/OCF/ids @@ -194,7 +194,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/SAPInstance +++ heartbeat-2.99.2+sles11r9/resources/OCF/SAPInstance @@ -11,7 +11,7 @@ # Author: Alexander Krauth, June 2006 # Support: linux@sap.com # License: GNU General Public License (GPL) -# Copyright: (c) 2006, 2007 Alexander Krauth +# Copyright: (c) 2006-2008 Alexander Krauth # # An example usage: # See usage() function below for more details... @@ -23,6 +23,9 @@ # OCF_RESKEY_START_PROFILE (optional, well known directories will be searched by default) # OCF_RESKEY_START_WAITTIME (optional, to solve timing problems during J2EE-Addin start) # OCF_RESKEY_AUTOMATIC_RECOVER (optional, automatic startup recovery using cleanipc, default is false) +# OCF_RESKEY_MONITOR_SERVICES (optional, default is to monitor critical services only) +# OCF_RESKEY_ERS_InstanceName (optional, InstanceName of the ERS instance in a Master/Slave configuration) +# OCF_RESKEY_ERS_START_PROFILE (optional, START_PROFILE of the ERS instance in a Master/Slave configuration) # OCF_RESKEY_PRE_START_USEREXIT (optional, lists a script which can be executed before the resource is started) # OCF_RESKEY_POST_START_USEREXIT (optional, lists a script which can be executed after the resource is started) # OCF_RESKEY_PRE_STOP_USEREXIT (optional, lists a script which can be executed before the resource is stopped) @@ -37,7 +40,7 @@ SH=/bin/sh -usage() { +sapinstance_usage() { methods=`sapinstance_methods` methods=`echo $methods | tr ' ' '|'` cat <<-! @@ -45,22 +48,25 @@ $0 manages a SAP Instance as an HA resource. - The 'start' operation starts the instance. - The 'stop' operation stops the instance. + The 'start' operation starts the instance or the ERS instance in a Master/Slave configuration + The 'stop' operation stops the instance The 'status' operation reports whether the instance is running The 'monitor' operation reports whether the instance seems to be working + The 'promote' operation starts the primary instance in a Master/Slave configuration + The 'demote' operation stops the primary instance and starts the ERS instance + The 'notify' operation always returns SUCCESS The 'validate-all' operation reports whether the parameters are valid The 'methods' operation reports on the methods $0 supports ! } -meta_data() { +sapinstance_meta_data() { cat < -1.91 +2.01 Resource script for SAP. It manages a SAP Instance as an HA resource. @@ -98,6 +104,21 @@ Enable or disable automatic startup recovery + + + + + + + + + + + + + + + The full qualified path where to find a script or program which should be executed before this resource gets started. path to a pre-start script @@ -122,10 +143,11 @@ - - + + + @@ -141,10 +163,12 @@ sapinstance_methods() { cat <<-! start - recover stop status monitor + promote + demote + notify validate-all methods meta-data @@ -153,6 +177,134 @@ } + +# +# is_clone : find out if we are configured to run in a Master/Slave configuration +# +is_clone() { + if [ -n "$OCF_RESKEY_CRM_meta_clone_max" ] \ + && [ "$OCF_RESKEY_CRM_meta_clone_max" -gt 0 ] + then + if [ "$OCF_RESKEY_CRM_meta_clone_max" -ne 2 ] || \ + [ "$OCF_RESKEY_CRM_meta_clone_node_max" -ne 1 ] || \ + [ "$OCF_RESKEY_CRM_meta_master_node_max" -ne 1 ] || \ + [ "$OCF_RESKEY_CRM_meta_master_max" -ne 1 ] + then + ocf_log err "Clone options misconfigured. (expect: clone_max=2,clone_node_max=1,master_node_max=1,master_max=1)" + exit $OCF_ERR_CONFIGURED + fi + + if [ -z "$OCF_RESKEY_ERS_InstanceName" ] + then + ocf_log err "In a Master/Slave configuration the ERS_InstanceName parameter is mandatory." + exit $OCF_ERR_ARGS + fi + else + return 0 + fi + return 1 +} + + +# +# sapinstance_init : Define global variables with default values, if optional parameters are not set +# +# +sapinstance_init() { + + myInstanceName="$1" + + SID=`echo "$myInstanceName" | cut -d_ -f1` + InstanceName=`echo "$myInstanceName" | cut -d_ -f2` + InstanceNr=`echo "$InstanceName" | sed 's/.*\([0-9][0-9]\)$/\1/'` + SAPVIRHOST=`echo "$myInstanceName" | cut -d_ -f3` + + # optional OCF parameters, we try to guess which directories are correct + if [ -z "$OCF_RESKEY_DIR_EXECUTABLE" ] + then + if [ -x /usr/sap/$SID/$InstanceName/exe/sapstartsrv -a -x /usr/sap/$SID/$InstanceName/exe/sapcontrol ] + then + DIR_EXECUTABLE="/usr/sap/$SID/$InstanceName/exe" + SAPSTARTSRV="/usr/sap/$SID/$InstanceName/exe/sapstartsrv" + SAPCONTROL="/usr/sap/$SID/$InstanceName/exe/sapcontrol" + elif [ -x /usr/sap/$SID/SYS/exe/run/sapstartsrv -a -x /usr/sap/$SID/SYS/exe/run/sapcontrol ] + then + DIR_EXECUTABLE="/usr/sap/$SID/SYS/exe/run" + SAPSTARTSRV="/usr/sap/$SID/SYS/exe/run/sapstartsrv" + SAPCONTROL="/usr/sap/$SID/SYS/exe/run/sapcontrol" + else + ocf_log warn "Cannot find sapstartsrv and sapcontrol executable, please set DIR_EXECUTABLE parameter!" + exit $OCF_NOT_RUNNING + fi + else + DIR_EXECUTABLE="$OCF_RESKEY_DIR_EXECUTABLE" + SAPSTARTSRV="$OCF_RESKEY_DIR_EXECUTABLE/sapstartsrv" + SAPCONTROL="$OCF_RESKEY_DIR_EXECUTABLE/sapcontrol" + fi + + if [ -z "$OCF_RESKEY_DIR_PROFILE" ] + then + if [ -d /usr/sap/$SID/SYS/profile/ ] + then + DIR_PROFILE="/usr/sap/$SID/SYS/profile" + else + ocf_log warn "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!" + exit $OCF_NOT_RUNNING + fi + else + DIR_PROFILE="$OCF_RESKEY_DIR_PROFILE" + fi + + if [ "$myInstanceName" != "$OCF_RESKEY_InstanceName" ] + then + currentSTART_PROFILE=$OCF_RESKEY_ERS_START_PROFILE + else + currentSTART_PROFILE=$OCF_RESKEY_START_PROFILE + fi + + if [ -z "$currentSTART_PROFILE" ] + then + SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" + if [ ! -r $SAPSTARTPROFILE ] + then + ocf_log warn "Expected $SAPSTARTPROFILE to be the instance START profile, please set START_PROFILE parameter!" + exit $OCF_NOT_RUNNING + fi + else + SAPSTARTPROFILE="$currentSTART_PROFILE" + fi + + if [ -z "$OCF_RESKEY_START_WAITTIME" ] + then + export OCF_RESKEY_START_WAITTIME=3600 + fi + + if [ -z "$OCF_RESKEY_AUTOMATIC_RECOVER" ] + then + OCF_RESKEY_AUTOMATIC_RECOVER=0 + else + case "$OCF_RESKEY_AUTOMATIC_RECOVER" in + 1|true|TRUE|yes|YES) export OCF_RESKEY_AUTOMATIC_RECOVER=1;; + 0|false|FALSE|no|NO) export OCF_RESKEY_AUTOMATIC_RECOVER=0;; + esac + fi + + if [ -z "$OCF_RESKEY_MONITOR_SERVICES" ] + then + export OCF_RESKEY_MONITOR_SERVICES="disp+work|msg_server|enserver|enrepserver|jcontrol|jstart" + fi + + # as root user we need the library path to the SAP kernel to be able to call sapcontrol + if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then + LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH + fi + + sidadm="`echo $SID | tr [:upper:] [:lower:]`adm" + + return $OCF_SUCCESS +} + + # # check_sapstartsrv : Before using sapcontrol we make sure that the sapstartsrv is running for the correct instance. # We cannot use sapinit and the /usr/sap/sapservices file in case of an enquerep instance, @@ -383,19 +535,19 @@ *) STATE=$OCF_NOT_RUNNING;; esac - case $SERVICE in - disp+work|msg_server|enserver|enrepserver|jcontrol|jstart) - if [ $STATE -eq $OCF_NOT_RUNNING ] - then - if [ "$MONLOG" != "NOLOG" ] - then - ocf_log err "SAP instance service $SERVICE is not running with status $COLOR !" - fi - rc=$STATE - fi - count=1;; - *);; - esac + SEARCH=`echo "$OCF_RESKEY_MONITOR_SERVICES" | sed 's/\+/\\\+/g' | sed 's/\./\\\./g'` + if [ `echo "$SERVICE" | egrep -c "$SEARCH"` -eq 1 ] + then + if [ $STATE -eq $OCF_NOT_RUNNING ] + then + if [ "$MONLOG" != "NOLOG" ] + then + ocf_log err "SAP instance service $SERVICE is not running with status $COLOR !" + fi + rc=$STATE + fi + count=1 + fi done if [ $count -eq 0 -a $rc -eq $OCF_SUCCESS ] @@ -407,7 +559,7 @@ rc=$OCF_ERR_ARGS fi fi - + return $rc } @@ -445,27 +597,142 @@ # +# sapinstance_start_clone +# +sapinstance_start_clone() { + sapinstance_init $OCF_RESKEY_ERS_InstanceName + ${HA_SBIN_DIR}/crm_master -v 100 -l reboot + sapinstance_start + return $? +} + + +# +# sapinstance_stop_clone +# +sapinstance_stop_clone() { + sapinstance_init $OCF_RESKEY_ERS_InstanceName + ${HA_SBIN_DIR}/crm_master -v 0 -l reboot + sapinstance_stop + return $? +} + + +# +# sapinstance_monitor_clone +# +sapinstance_monitor_clone() { + # resource agents running in Master mode must return other returncodes than default + if [ "$OCF_RESKEY_CRM_meta_op_target_rc" -eq $OCF_RUNNING_MASTER ] + then + sapinstance_init $OCF_RESKEY_InstanceName + sapinstance_monitor + case "$?" in + $OCF_SUCCESS) return $OCF_RUNNING_MASTER;; + $OCF_NOT_RUNNING) ${HA_SBIN_DIR}/crm_master -v 10 -l reboot + return $OCF_FAILED_MASTER;; + *) return $?;; + esac + else + sapinstance_init $OCF_RESKEY_ERS_InstanceName + sapinstance_monitor + return $? + fi +} + + +# +# sapinstance_promote_clone: In a Master/Slave configuration get Master by starting the SCS instance and stopping the ERS instance +# The order is important here to behave correct from the application levels view +# +sapinstance_promote_clone() { + sapinstance_init $OCF_RESKEY_InstanceName + ocf_log info "Promoting $SID-$InstanceName to running Master." + sapinstance_start + rc=$? + + if [ $rc -eq $OCF_SUCCESS ]; then + sapinstance_init $OCF_RESKEY_ERS_InstanceName + sapinstance_stop + rc=$? + fi + + return $rc +} + + +# +# sapinstance_demote_clone: In a Master/Slave configuration get Slave by stopping the SCS instance and starting the ERS instance +# +sapinstance_demote_clone() { + sapinstance_init $OCF_RESKEY_InstanceName + ocf_log info "Demoting $SID-$InstanceName to a slave." + sapinstance_stop + rc=$? + + if [ $rc -eq $OCF_SUCCESS ]; then + sapinstance_init $OCF_RESKEY_ERS_InstanceName + sapinstance_start + rc=$? + fi + + return $rc +} + + +# +# sapinstance_notify: After promotion of one master in the cluster, we make sure that all clones reset thier master +# value back to 100. This is because a failed monitor on a master might have degree one clone +# instance to score 10. +# +sapinstance_notify() { + local n_type="$OCF_RESKEY_CRM_meta_notify_type" + local n_op="$OCF_RESKEY_CRM_meta_notify_operation" + + if [ "${n_type}_${n_op}" = "post_promote" ]; then + ${HA_SBIN_DIR}/crm_master -v 100 -l reboot + fi +} + + +# # 'main' starts here... # +## GLOBALS +SID="" +sidadm="" +InstanceName="" +InstanceNr="" +SAPVIRHOST="" +DIR_EXECUTABLE="" +SAPSTARTSRV="" +SAPCONTROL="" +DIR_PROFILE="" +SAPSTARTPROFILE="" +CLONE=0 + + if ( [ $# -ne 1 ] ) then - usage + sapinstance_usage exit $OCF_ERR_ARGS fi -# These operations don't require OCF instance parameters to be set -case "$1" in - meta-data) meta_data - exit $OCF_SUCCESS;; - - usage) usage - exit $OCF_SUCCESS;; - - methods) sapinstance_methods - exit $?;; +ACTION=$1 +if [ "$ACTION" = "status" ]; then + ACTION=monitor +fi +# These operations don't require OCF instance parameters to be set +case "$ACTION" in + usage|methods) sapinstance_$ACTION + exit $OCF_SUCCESS;; + meta-data) sapinstance_meta_data + exit $OCF_SUCCESS;; + notify) sapinstance_notify + exit $OCF_SUCCESS;; *);; esac @@ -485,100 +752,20 @@ exit $OCF_ERR_ARGS fi -SID=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f1` -InstanceName=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f2` -InstanceNr=`echo "$InstanceName" | sed 's/.*\([0-9][0-9]\)$/\1/'` -SAPVIRHOST=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f3` - -# optional OCF parameters, we try to guess which directories are correct -if [ -z "$OCF_RESKEY_DIR_EXECUTABLE" ] -then - if [ -x /usr/sap/$SID/$InstanceName/exe/sapstartsrv -a -x /usr/sap/$SID/$InstanceName/exe/sapcontrol ] - then - DIR_EXECUTABLE="/usr/sap/$SID/$InstanceName/exe" - SAPSTARTSRV="/usr/sap/$SID/$InstanceName/exe/sapstartsrv" - SAPCONTROL="/usr/sap/$SID/$InstanceName/exe/sapcontrol" - elif [ -x /usr/sap/$SID/SYS/exe/run/sapstartsrv -a -x /usr/sap/$SID/SYS/exe/run/sapcontrol ] - then - DIR_EXECUTABLE="/usr/sap/$SID/SYS/exe/run" - SAPSTARTSRV="/usr/sap/$SID/SYS/exe/run/sapstartsrv" - SAPCONTROL="/usr/sap/$SID/SYS/exe/run/sapcontrol" - else - ocf_log warn "Cannot find sapstartsrv and sapcontrol executable, please set DIR_EXECUTABLE parameter!" - exit $OCF_NOT_RUNNING - fi -else - DIR_EXECUTABLE="$OCF_RESKEY_DIR_EXECUTABLE" - SAPSTARTSRV="$OCF_RESKEY_DIR_EXECUTABLE/sapstartsrv" - SAPCONTROL="$OCF_RESKEY_DIR_EXECUTABLE/sapcontrol" -fi - -if [ -z "$OCF_RESKEY_DIR_PROFILE" ] +is_clone; CLONE=$? +if [ ${CLONE} -eq 1 ] then - if [ -d /usr/sap/$SID/SYS/profile/ ] - then - DIR_PROFILE="/usr/sap/$SID/SYS/profile" - else - ocf_log warn "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!" - exit $OCF_NOT_RUNNING - fi + CLACT=_clone else - DIR_PROFILE="$OCF_RESKEY_DIR_PROFILE" + sapinstance_init $OCF_RESKEY_InstanceName fi -if [ -z "$OCF_RESKEY_START_PROFILE" ] -then - SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" - if [ ! -r $SAPSTARTPROFILE ] - then - ocf_log warn "Expected $SAPSTARTPROFILE to be the instance START profile, please set START_PROFILE parameter!" - exit $OCF_NOT_RUNNING - fi -else - SAPSTARTPROFILE="$OCF_RESKEY_START_PROFILE" -fi - -if [ -z "$OCF_RESKEY_START_WAITTIME" ] -then - OCF_RESKEY_START_WAITTIME=3600 -fi - - -if [ -z "$OCF_RESKEY_AUTOMATIC_RECOVER" ] -then - OCF_RESKEY_AUTOMATIC_RECOVER=0 -else - case "$OCF_RESKEY_AUTOMATIC_RECOVER" in - 1|true|TRUE|yes|YES) OCF_RESKEY_AUTOMATIC_RECOVER=1;; - 0|false|FALSE|no|NO) OCF_RESKEY_AUTOMATIC_RECOVER=0;; - esac -fi - -# as root user we need the library path to the SAP kernel to be able to call sapcontrol -if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then - LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH -fi -sidadm="`echo $SID | tr [:upper:] [:lower:]`adm" - # What kind of method was invoked? -case "$1" in - - start) sapinstance_start - exit $?;; - - recover) sapinstance_recover - exit $?;; - - stop) sapinstance_stop - exit $?;; - - status|monitor) - sapinstance_monitor - exit $?;; - - validate-all) sapinstance_validate - exit $?;; - - *) sapinstance_methods - exit $OCF_ERR_UNIMPLEMENTED;; +case "$ACTION" in + start|stop|monitor|promote|demote) sapinstance_$ACTION$CLACT + exit $?;; + validate-all) sapinstance_validate + exit $?;; + *) sapinstance_methods + exit $OCF_ERR_UNIMPLEMENTED;; esac --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ManageVE +++ heartbeat-2.99.2+sles11r9/resources/OCF/ManageVE @@ -88,8 +88,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/tomcat +++ heartbeat-2.99.2+sles11r9/resources/OCF/tomcat @@ -369,7 +369,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/oralsnr +++ heartbeat-2.99.2+sles11r9/resources/OCF/oralsnr @@ -108,7 +108,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/Pure-FTPd +++ heartbeat-2.99.2+sles11r9/resources/OCF/Pure-FTPd @@ -92,7 +92,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/ICP +++ heartbeat-2.99.2+sles11r9/resources/OCF/ICP @@ -87,8 +87,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/.ocf-binaries.in +++ heartbeat-2.99.2+sles11r9/resources/OCF/.ocf-binaries.in @@ -71,7 +71,7 @@ have_binary () { bin=`echo $1 | sed -e 's/ -.*//'` - if [ -x "`which $bin`" ] >/dev/null 2>&1 ; then + if [ -x "`which $bin 2>/dev/null`" ]; then return 0 fi return 1 --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/oracle +++ heartbeat-2.99.2+sles11r9/resources/OCF/oracle @@ -178,7 +178,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/AudibleAlarm +++ heartbeat-2.99.2+sles11r9/resources/OCF/AudibleAlarm @@ -59,8 +59,8 @@ - - + + --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/pgsql +++ heartbeat-2.99.2+sles11r9/resources/OCF/pgsql @@ -194,25 +194,33 @@ return $OCF_ERR_GENERIC fi - if runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o "\'$OCF_RESKEY_start_opt\'" start > /dev/null 2>&1" + output=`runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o "\'$OCF_RESKEY_start_opt\'" start" 2>&1` + + if [ $? -eq 0 ] then # Probably started..... ocf_log info "PostgreSQL start command sent." else - ocf_log err "Can't start PostgreSQL."; return $OCF_ERR_GENERIC + ocf_log err "Can't start PostgreSQL." + echo "$output" + return $OCF_ERR_GENERIC fi else ocf_log err "$OCF_RESKEY_pgctl not found!" return $OCF_ERR_GENERIC fi - rc=$OCF_ERR_GENERIC - while [ $rc -ne 0 ]; do - pgsql_monitor - rc=$? + while : + do + pgsql_monitor warn + rc=$? + if [ $rc -eq 0 ]; then + break; + fi sleep 1 ocf_log debug "PostgreSQL still hasn't started yet. Waiting..." done + ocf_log info "PostgreSQL is started." return $OCF_SUCCESS } @@ -224,9 +232,9 @@ #Already stopped return $OCF_SUCCESS fi - + # Stop PostgreSQL do not wait for clients to disconnect - runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m fast > /dev/null 2>&1" + output=`runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m fast" 2>&1` # stop waiting count=0 @@ -245,13 +253,19 @@ then #PostgreSQL is still up. Use another shutdown mode. ocf_log info "PostgreSQL failed to stop after ${OCF_RESKEY_stop_escalate}s using -m fast. Trying -m immediate..." - runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m immediate > /dev/null 2>&1" + echo "$output" + output=`runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m immediate" 2>&1` + echo "$output" fi - rc=$OCF_ERR_GENERIC - while [ $rc != $OCF_NOT_RUNNING ]; do + while : + do pgsql_monitor - rc=$? + rc=$? + if [ $rc -eq $OCF_NOT_RUNNING ]; then + # An unnecessary debug log is prevented. + break; + fi sleep 1 ocf_log debug "PostgreSQL still hasn't stopped yet. Waiting..." done @@ -283,6 +297,9 @@ # pgsql_monitor() { + # Set the log level of the error message + loglevel=${1:-err} + if ! pgsql_status then ocf_log info "PostgreSQL is down" @@ -291,14 +308,26 @@ if [ "x" = "x$OCF_RESKEY_pghost" ] then - runasowner "$OCF_RESKEY_psql -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();' >/dev/null 2>&1" + output=`runasowner "$OCF_RESKEY_psql -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();'" 2>&1` else - runasowner "$OCF_RESKEY_psql -h $OCF_RESKEY_pghost -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();' >/dev/null 2>&1" + output=`runasowner "$OCF_RESKEY_psql -h $OCF_RESKEY_pghost -p $OCF_RESKEY_pgport -U $OCF_RESKEY_pgdba $OCF_RESKEY_pgdb -c 'select now();'" 2>&1` fi - if [ $? -ne 0 ] + rc=$? + if [ $rc -ne 0 ] then - ocf_log err "PostgreSQL $OCF_RESKEY_pgdb isn't running" + ocf_log $loglevel "PostgreSQL $OCF_RESKEY_pgdb isn't running" + if [ $rc -eq 1 ] + then + ocf_log err "Fatal error(out of memory or file not found, etc.) occurred while executing the psql command." + elif [ $rc -eq 2 ] + then + ocf_log $loglevel "Connection error(connection to the server went bad and the session was not interactive) occurred while executing the psql command." + elif [ $rc -eq 3 ] + then + ocf_log err "Script error(the variable ON_ERROR_STOP was set) occurred while executing the psql command." + fi + echo "$output" return $OCF_ERR_GENERIC fi --- heartbeat-2.99.2+sles11r9.orig/resources/OCF/mysql +++ heartbeat-2.99.2+sles11r9/resources/OCF/mysql @@ -236,7 +236,7 @@ - + --- heartbeat-2.99.2+sles11r9.orig/resources/heartbeat/portblock.in +++ heartbeat-2.99.2+sles11r9/resources/heartbeat/portblock.in @@ -27,7 +27,7 @@ export OCF_RESKEY_action OCF_RESKEY_portno OCF_RESKEY_action OCF_TYPE=portblock -OCF_RESOURCE_INSTANCE=${OCF_TYPE}_$1_$2 +OCF_RESOURCE_INSTANCE=${OCF_TYPE}_$1_$2_$3 export OCF_TYPE OCF_RESOURCE_INSTANCE ra_execocf $4 --- heartbeat-2.99.2+sles11r9.orig/telecom/apphbd/apphbtest.c +++ heartbeat-2.99.2+sles11r9/telecom/apphbd/apphbtest.c @@ -37,7 +37,7 @@ #include #include -int debug = 0; +static int debug; void doafailtest(void); @@ -373,7 +373,7 @@ errno = 0; } -void dup_reg_test() +void dup_reg_test(void) { /* apphbd should not allow a process register two times */ int rc; --- heartbeat-2.99.2+sles11r9.orig/telecom/apphbd/apphbd.c +++ heartbeat-2.99.2+sles11r9/telecom/apphbd/apphbd.c @@ -112,7 +112,7 @@ #endif /* End: Mirrored from ipcsocket.c */ -const char * cmdname = "apphbd"; +static const char *cmdname = "apphbd"; #define DBGMIN 1 #define DBGDETAIL 2 static int usenormalpoll = TRUE; @@ -155,12 +155,12 @@ }; /* Probably ought to eventually make this configurable, but it's a start */ -uid_t critical_uid_list [] = {0, HA_CCMUID}; +static uid_t critical_uid_list[] = {0, HA_CCMUID}; #define MAXNOTIFYPLUGIN 100 -AppHBNotifyOps* NotificationPlugins[MAXNOTIFYPLUGIN]; -int n_Notification_Plugins = 0; +static AppHBNotifyOps *NotificationPlugins[MAXNOTIFYPLUGIN]; +static int n_Notification_Plugins; static void apphb_notify(apphb_client_t* client, apphb_event_t event); static void make_daemon(void); @@ -200,7 +200,7 @@ static int set_notify_plugin(const char* option); static int set_debugfile(const char* option); static int set_logfile(const char* option); -struct { +static struct { int debug_level; char wdt_dev[MAXLINE]; int wdt_interval_ms; @@ -209,10 +209,10 @@ char logfile[MAXLINE]; } apphbd_config; -struct directive{ +static struct directive { const char* name; int (*add_func)(const char*); -} Directives[]= +} Directives[] = { {"debug_level", set_debug_level} , {"watchdog_device", set_watchdog_device} @@ -559,7 +559,7 @@ /* * Put HEARTBEAT message first - it is by far the most common message... */ -struct hbcmd hbcmds[] = +static struct hbcmd hbcmds[] = { {HEARTBEAT, FALSE, apphb_client_hb}, {REGISTER, TRUE, apphb_client_register}, @@ -908,10 +908,10 @@ /* * Main program for monitoring application heartbeats... */ -GMainLoop* mainloop = NULL; +static GMainLoop *mainloop; -void +static void usage(const char* cmd, int exit_status) { FILE* stream; @@ -1027,7 +1027,7 @@ static int -init_start() +init_start(void) { char path[] = IPC_PATH_ATTR; char commpath[] = APPHBSOCKPATH; @@ -1281,7 +1281,7 @@ static GHashTable* Notifications = NULL; -AppHBNotifyImports piimports = { +static AppHBNotifyImports piimports = { authenticate_client }; --- heartbeat-2.99.2+sles11r9.orig/tools/cl_status.c +++ heartbeat-2.99.2+sles11r9/tools/cl_status.c @@ -42,11 +42,12 @@ /* exit code */ -const int OK = 0, - NORMAL_FAIL = 1, /* such as the local node is down */ - PARAMETER_ERROR = 11, - TIMEOUT = 12, - UNKNOWN_ERROR = 13; /* error due to unkown causes */ +static const int + OK = 0, + NORMAL_FAIL = 1, /* such as the local node is down */ + PARAMETER_ERROR = 11, + TIMEOUT = 12, + UNKNOWN_ERROR = 13; /* error due to unkown causes */ /* * The exit values under some situations proposed by Alan. * nodestatus fail when the node is down @@ -238,7 +239,7 @@ * The following is to avoid cl_status sleeping forever. This is due to the * hearbeat's abnormal status or even its crash. */ -unsigned int DEFAULT_TIMEOUT = 5; +static const unsigned int DEFAULT_TIMEOUT = 5; /* the handler of signal SIGALRM */ static void quit(int signum); --- heartbeat-2.99.2+sles11r9.orig/tools/send_arp.linux.c +++ heartbeat-2.99.2+sles11r9/tools/send_arp.linux.c @@ -34,38 +34,38 @@ static void usage(void) __attribute__((noreturn)); -int quit_on_reply=0; -char *device = NULL; -int ifindex; -char *source; -struct in_addr src, dst; -char *target; -int dad, unsolicited, advert; -int quiet; -int count=-1; -int timeout; -int unicasting; -int s; -int broadcast_only; +static int quit_on_reply; +static char *device; +static int ifindex; +static char *source; +static struct in_addr src, dst; +static char *target; +static int dad, unsolicited, advert; +static int quiet; +static int count = -1; +static int timeout; +static int unicasting; +static int s; +static int broadcast_only; -struct sockaddr_ll me; -struct sockaddr_ll he; +static struct sockaddr_ll me; +static struct sockaddr_ll he; -struct timeval start, last; +static struct timeval start, last; -int sent, brd_sent; -int received, brd_recv, req_recv; +static int sent, brd_sent; +static int received, brd_recv, req_recv; #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \ ((tv1).tv_usec-(tv2).tv_usec)/1000 ) -void print_hex(unsigned char *p, int len); -int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM); -void set_signal(int signo, void (*handler)(void)); -int send_pack(int s, struct in_addr src, struct in_addr dst, +static void print_hex(unsigned char *p, int len); +static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM); +static void set_signal(int signo, void (*handler)(void)); +static int send_pack(int s, struct in_addr src, struct in_addr dst, struct sockaddr_ll *ME, struct sockaddr_ll *HE); -void finish(void); -void catcher(void); +static void finish(void); +static void catcher(void); void usage(void) { --- heartbeat-2.99.2+sles11r9.orig/tools/sfex_lib.c +++ heartbeat-2.99.2+sles11r9/tools/sfex_lib.c @@ -45,8 +45,8 @@ #include "sfex.h" #include "sfex_lib.h" -void *locked_mem = NULL; -int dev_fd = 0; +static void *locked_mem; +static int dev_fd; unsigned long sector_size = 0; int --- heartbeat-2.99.2+sles11r9.orig/tools/sfex_daemon.c +++ heartbeat-2.99.2+sles11r9/tools/sfex_daemon.c @@ -14,22 +14,21 @@ #include "sfex.h" #include "sfex_lib.h" -int sysrq_fd; -int lock_index = 1; /* default 1st lock */ -time_t collision_timeout = 1; /* default 1 sec */ -time_t lock_timeout = 60; /* default 60 sec */ -time_t unlock_timeout = 60; -time_t monitor_interval = 10; - -sfex_controldata cdata; -sfex_lockdata ldata; -sfex_lockdata ldata_new; +static int sysrq_fd; +static int lock_index = 1; /* default 1st lock */ +static time_t collision_timeout = 1; /* default 1 sec */ +static time_t lock_timeout = 60; /* default 60 sec */ +static time_t monitor_interval = 10; + +static sfex_controldata cdata; +static sfex_lockdata ldata; +static sfex_lockdata ldata_new; -const char *device; +static const char *device; const char *progname; char *nodename; -const char *rsc_id = "sfex"; -const char *rscpidfile = NULL; +static const char *rsc_id = "sfex"; +static const char *rscpidfile; static void usage(FILE *dist) { fprintf(dist, "usage: %s [-i ] [-c ] [-t ] \n", progname); --- heartbeat-2.99.2+sles11r9.orig/tools/hb_report.in +++ heartbeat-2.99.2+sles11r9/tools/hb_report.in @@ -169,6 +169,9 @@ logmark() { logger -p $* } +# +# a special stamp is logged through syslog on _all_ nodes +# logmarks() { msg=$1 c="$PROGDIR/hb_report __slave $DESTDIR logmark $msg" @@ -201,12 +204,104 @@ # # find log slices # -findlogseg() { - logf=$1 - from_time=$2 - to_time=$3 - FROM_LINE=`findln_by_time $logf $from_time` +find_decompressor() { + if echo $1 | grep -qs 'bz2$'; then + echo "bzip2 -dc" + elif echo $1 | grep -qs 'gz$'; then + echo "gzip -dc" + else + echo "cat" + fi +} +# +# check if the log contains a piece of our segment +# +is_our_log() { + local logf=$1 + local from_time=$2 + local to_time=$3 + + local cat=`find_decompressor $logf` + local first_time=$(str2time "`$cat $logf | head -1 | $getstampproc`") + local last_time=$(str2time "`$cat $logf | tail -1 | $getstampproc`") + if [ x = "x$first_time" -o x = "x$last_time" ]; then + return 0 # skip (empty log?) + fi + if [ $from_time -gt $last_time ]; then + # we shouldn't get here anyway if the logs are in order + return 2 # we're past good logs; exit + fi + if [ $from_time -ge $first_time ]; then + return 3 # this is the last good log + fi + # have to go further back + if [ x = "x$to_time" -o $to_time -ge $first_time ]; then + return 1 # include this log + else + return 0 # don't include this log + fi +} +# +# go through archived logs (timewise backwards) and see if there +# are lines belonging to us +# (we rely on untouched log files, i.e. that modify time +# hasn't been changed) +# +arch_logs() { + local logf=$1 + local from_time=$2 + local to_time=$3 + + # look for files such as: ha-log-20090308 or + # ha-log-20090308.gz (.bz2) or ha-log.0, etc + ls -t $logf $logf*[0-9z] 2>/dev/null | + while read next_log; do + is_our_log $next_log $from_time $to_time + case $? in + 0) ;; # noop, continue + 1) echo $next_log # include log and continue + info "found log $next_log" + ;; + 2) break;; # don't go through older logs! + 3) echo $next_log # include log and continue + info "found log $next_log" + break + ;; # don't go through older logs! + esac + done +} +# +# print part of the log +# +drop_tmp_file() { + [ -z "$tmp" ] || rmtempfile "$tmp" +} +print_log() { + local cat=`find_decompressor $1` + $cat $1 +} +print_logseg() { + local logf=$1 + local from_time=$2 + local to_time=$3 + + # uncompress to a temp file (if necessary) + local cat=`find_decompressor $logf` + if [ "$cat" != "cat" ]; then + tmp=`maketempfile` + $cat $logf > $tmp + trap drop_tmp_file 0 + logf=$tmp + else + tmp="" + fi + + if [ "$from_time" = 0 ]; then + FROM_LINE=1 + else + FROM_LINE=`findln_by_time $logf $from_time` + fi if [ -z "$FROM_LINE" ]; then warning "couldn't find line for time $from_time; corrupt log file?" return @@ -220,8 +315,48 @@ return fi fi + dumplog $logf $FROM_LINE $TO_LINE + drop_tmp_file + trap "" 0 +} +# +# find log/set of logs which are interesting for us +# +dumplogset() { + local logf=$1 + local from_time=$2 + local to_time=$3 + + local logf_set=`arch_logs $logf $from_time $to_time` + if [ x = "x$logf_set" ]; then + return + fi + + local num_logs=`echo "$logf_set" | wc -l` + local oldest=`echo $logf_set | awk '{print $NF}'` + local newest=`echo $logf_set | awk '{print $1}'` + local mid_logfiles=`echo $logf_set | awk '{for(i=NF-1; i>1; i--) print $i}'` + + # the first logfile: from $from_time to $to_time (or end) + # logfiles in the middle: all + # the last logfile: from beginning to $to_time (or end) + case $num_logs in + 1) print_logseg $newest $from_time $to_time;; + *) + print_logseg $oldest $from_time 0 + for f in $mid_logfiles; do + print_log $f + done + print_logseg $newest 0 $to_time + ;; + esac } +# +# cts_findlogseg finds lines for the CTS test run (FROM_LINE and +# TO_LINE) and then extracts the timestamps to get FROM_TIME and +# TO_TIME +# cts_findlogseg() { logf=$1 testnum=$2 @@ -800,17 +935,17 @@ getstampproc=`find_getstampproc < $HA_LOG` if [ "$getstampproc" ]; then export getstampproc # used by linetime - if [ "$CTS" ]; then - cts_findlogseg $HA_LOG $CTS - else - findlogseg $HA_LOG $FROM_TIME $TO_TIME - fi - dumplog $HA_LOG $FROM_LINE $TO_LINE | if [ "$THIS_IS_NODE" ]; then - cat > $DESTDIR/$WE/$HALOG_F + outf=$DESTDIR/$WE/$HALOG_F else - cat > $DESTDIR/$HALOG_F # we are log server, probably + outf=$DESTDIR/$HALOG_F # we are log server, probably fi + if [ "$CTS" ]; then + cts_findlogseg $HA_LOG $CTS + dumplog $HA_LOG $FROM_LINE $TO_LINE + else + dumplogset $HA_LOG $FROM_TIME $TO_TIME + fi > $outf else warning "could not figure out the log format of $HA_LOG" fi @@ -857,8 +992,7 @@ getstampproc=`find_getstampproc < $l` if [ "$getstampproc" ]; then export getstampproc # used by linetime - findlogseg $l $FROM_TIME $TO_TIME - dumplog $l $FROM_LINE $TO_LINE > $DESTDIR/$WE/`basename $l` + dumplogset $l $FROM_TIME $TO_TIME > $DESTDIR/$WE/`basename $l` else warning "could not figure out the log format of $l" fi --- heartbeat-2.99.2+sles11r9.orig/tools/send_arp.libnet.c +++ heartbeat-2.99.2+sles11r9/tools/send_arp.libnet.c @@ -46,7 +46,7 @@ #define PIDDIR HA_VARRUNDIR "/" PACKAGE "/rsctmp/send_arp" #define PIDFILE_BASE PIDDIR "/send_arp-" -static int send_arp(LTYPE* l, u_long ip, u_char *device, u_char mac[6] +static int send_arp(LTYPE* l, uint32_t ip, u_char *device, u_char mac[6] , u_char *broadcast, u_char *netmask, u_short arptype); static char print_usage[]={ @@ -115,22 +115,22 @@ int main(int argc, char *argv[]) { - int c = -1; - char errbuf[LIBNET_ERRBUF_SIZE]; - char* device; - char* ipaddr; - char* macaddr; - char* broadcast; - char* netmask; - u_long ip; - u_char src_mac[6]; - LTYPE* l; - int repeatcount = 1; - int j; - long msinterval = 1000; - int flag; - char pidfilenamebuf[64]; - char *pidfilename = NULL; + int c = -1; + char errbuf[LIBNET_ERRBUF_SIZE]; + char* device; + char* ipaddr; + char* macaddr; + char* broadcast; + char* netmask; + uint32_t ip; + u_char src_mac[6]; + LTYPE* l; + int repeatcount = 1; + int j; + long msinterval = 1000; + int flag; + char pidfilenamebuf[64]; + char *pidfilename = NULL; CL_SIGNAL(SIGTERM, byebye); CL_SIGINTERRUPT(SIGTERM, 1); @@ -192,9 +192,9 @@ #if defined(HAVE_LIBNET_1_0_API) #ifdef ON_DARWIN - if ((ip = libnet_name_resolve((unsigned char*)ipaddr, 1)) == -1UL) { + if ((ip = libnet_name_resolve((unsigned char*)ipaddr, 1)) == -1U) { #else - if ((ip = libnet_name_resolve(ipaddr, 1)) == -1UL) { + if ((ip = libnet_name_resolve(ipaddr, 1)) == -1U) { #endif cl_log(LOG_ERR, "Cannot resolve IP address [%s]", ipaddr); unlink(pidfilename); @@ -377,7 +377,7 @@ #ifdef HAVE_LIBNET_1_0_API int -send_arp(struct libnet_link_int *l, u_long ip, u_char *device, u_char *macaddr, u_char *broadcast, u_char *netmask, u_short arptype) +send_arp(struct libnet_link_int *l, uint32_t ip, u_char *device, u_char *macaddr, u_char *broadcast, u_char *netmask, u_short arptype) { int n; u_char *buf; @@ -454,7 +454,7 @@ #ifdef HAVE_LIBNET_1_1_API int -send_arp(libnet_t* lntag, u_long ip, u_char *device, u_char macaddr[6], u_char *broadcast, u_char *netmask, u_short arptype) +send_arp(libnet_t* lntag, uint32_t ip, u_char *device, u_char macaddr[6], u_char *broadcast, u_char *netmask, u_short arptype) { int n; u_char *target_mac;