[SCM] CTDB repository - branch master updated - ctdb-1.0.105-47-g821333a
Ronnie Sahlberg
sahlberg at samba.org
Mon Nov 30 19:22:13 MST 2009
The branch, master has been updated
via 821333afb458358f90446062b0242790695e5060 (commit)
via e9b3477a5b9a2eff18f727e7d59338bfb5214793 (commit)
via a1f37fdc5217e57d2d643d77a811afca747685e0 (commit)
via 16db4882635d84b8410a77e2ea8b08d0a257b0ab (commit)
via 50c2caed57c0520f506eaaeeb0bba2c272da6ef6 (commit)
via 937823cc73eb098230acff4b1583f6d01f26c21a (commit)
via 0e6c06ac38fd82adf124d111717502055501974a (commit)
via c278c798d41a35f58ca81f8f0e08e4dab51eba9b (commit)
via 28d0648725e7de4e4d0e8569e3fbfb0fa1d7f934 (commit)
via 143f1fa3cc4588505e3992c601153ea08be8432d (commit)
via a1d654a982ca56fade82552f4e6b5586236d3233 (commit)
via d3e7407dc9854ec358d081777c5450ec68b17862 (commit)
via a2830594ebeb54eb51ff90999cb12370aeec6e8b (commit)
via 517e9d9b188b18dffc712a8fecddb41540d27b8d (commit)
via 5d97c07be13a8209a81dfc8f73e49371949e4dc3 (commit)
via 3c93336ab92c2e4829ff4dc360045bfa6df21d50 (commit)
via 1d24a3869fe89fc9a109fd9e9b69df5fc665a5f6 (commit)
via 2e60749de3714239224cc04170a9aeeee158153f (commit)
via 66b22980b14601f29fe8cc64bd8f29883c7ca1c0 (commit)
via 83b7b233cb4707e826f6ba260bd630c8bc8f1e76 (commit)
via a6d353519932eee48f9241ad8887b692882906c9 (commit)
via 33fb0e7ba047ca73969b59bccf70a04a17c25a0a (commit)
via b0648c7f08eba87ec3c9714e2525c9b621bfb4ef (commit)
via 6c79fa33e26cc4f0873577f8e122b1495b4c427e (commit)
via 834c93b3e1b8f4151b8a2cd82c2dd8bacc17f66c (commit)
via 8001488be4f2beb25e943fe01b2afc2e8779930d (commit)
via 470822b329f9d3ca9bef518b56e9ce28d5fedda2 (commit)
via 533c3e053293941d2a9484b495e78d45f478bb08 (commit)
via fe8027309c1f7b987cd368fa98f9b28741baa786 (commit)
via 466beafadb37011fe273de8810ab0012e92a1fd8 (commit)
via e7d57d7ae678b24dab3364a348838c6a3398942c (commit)
via b90bdb07c1f6913ddbf11bde9684bdc8af61c549 (commit)
via 20b15de068d042b292725945927ceda1b01d07c0 (commit)
via 6804f880436645b52c09a78fa300377fa8058d0e (commit)
via defbe318152fc479e8076ad70433cdb4971951af (commit)
via c715746c2f40eb9b21dbf011d16f1f1b0b53fdf9 (commit)
via c5f798116bf3b7954e23c7267b056ee1f5560f45 (commit)
via 35a60a63a9b5c7d98dde514ae552239506b691c9 (commit)
via f1e350f9edb74cc44b6c5be4c062fd93e98ba8c4 (commit)
via ac655b0a65b32d809d47fec9821f7f31bb2fe2a7 (commit)
via 364e70b763f0ccd7714d15723ad3ea4d7e2968a1 (commit)
via 1908bac812650ca25151051f5d86815e0b8ed319 (commit)
from 12b187f971d857353403393a9850503e0e558672 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 821333afb458358f90446062b0242790695e5060
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Dec 1 13:19:58 2009 +1100
When starting up ctdbd, wait until all initial recoveries have finished
and until we have gone through a full re-recovery timeout without triggering
any pending recoveries before we start up the services and start monitoring
the node.
commit e9b3477a5b9a2eff18f727e7d59338bfb5214793
Merge: 12b187f971d857353403393a9850503e0e558672 a1f37fdc5217e57d2d643d77a811afca747685e0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Dec 1 10:53:18 2009 +1100
Merge commit 'martins/status-test-2'
Conflicts:
server/eventscript.c
-----------------------------------------------------------------------
Summary of changes:
config/ctdb.init | 2 +-
config/events.d/00.ctdb | 8 +-
config/events.d/01.reclock | 60 ++---
config/events.d/10.interface | 11 +-
config/events.d/11.natgw | 15 +-
config/events.d/11.routing | 6 +-
config/events.d/20.multipathd | 9 +-
config/events.d/31.clamd | 41 ++--
config/events.d/40.vsftpd | 74 +++----
config/events.d/41.httpd | 71 +++---
config/events.d/50.samba | 161 +++++++-------
config/events.d/60.nfs | 95 ++++----
config/events.d/61.nfstickle | 47 +---
config/events.d/70.iscsi | 30 +--
config/events.d/91.lvs | 16 +--
config/events.d/99.timeout | 15 +-
config/functions | 395 ++++++++++++++++++++--------------
config/statd-callout | 4 +-
include/ctdb_private.h | 33 +++-
server/ctdb_control.c | 2 +-
server/ctdb_monitor.c | 60 +++++-
server/ctdb_recover.c | 25 +-
server/ctdb_recoverd.c | 2 +-
server/ctdb_takeover.c | 17 +-
server/ctdb_tunables.c | 3 +-
server/eventscript.c | 484 +++++++++++++++++++++++------------------
26 files changed, 889 insertions(+), 797 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/ctdb.init b/config/ctdb.init
index 67747fd..4bd570d 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -250,7 +250,7 @@ status() {
}
-case "$1" in
+case "$cmd" in
start)
start
;;
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 90fd92f..f2ec5e8 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -10,13 +10,7 @@
# recovered : called when ctdb has finished a recovery event
. $CTDB_BASE/functions
-loadconfig ctdb
-
-# ensure we have /bin and /usr/bin in the path
-PATH=/bin:/usr/bin:$PATH
-
-cmd="$1"
-shift
+loadconfig
case $cmd in
startup)
diff --git a/config/events.d/01.reclock b/config/events.d/01.reclock
index 281c089..1b6cbf0 100755
--- a/config/events.d/01.reclock
+++ b/config/events.d/01.reclock
@@ -2,55 +2,43 @@
# script to check accessibility to the reclock file on a node
. $CTDB_BASE/functions
-loadconfig ctdb
-
-cmd="$1"
-shift
-
-PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
-
-# Count the number of intervals that have passed when we have tried to
-# but failed to stat the reclock file. after third failure the node
-# becomes unhealthy after the twentieth failure the node we shutdown
-# ctdbd
-RECLOCKCOUNT="fail-count"
+loadconfig
case $cmd in
- startup)
- ctdb_counter_init "$RECLOCKCOUNT"
+ startup)
+ ctdb_counter_init
;;
-
- monitor)
- ctdb_counter_incr "$RECLOCKCOUNT"
- ctdb_counter_limit "$RECLOCKCOUNT" 200 && {
- echo "Reclock file \"$RECLOCKFILE\" can not be accessed. Shutting down."
- df
- sleep 1
- ctdb shutdown
+
+ monitor)
+ RECLOCKFILE=$(ctdb -Y getreclock)
+
+ ctdb_counter_incr
+ (ctdb_check_counter_limit 200 >/dev/null 2>&1) || {
+ echo "Reclock file $RECLOCKFILE\" can not be accessed. Shutting down."
+ df
+ sleep 1
+ ctdb shutdown
}
- RECLOCKFILE=`ctdb -Y getreclock`
[ -z "$RECLOCKFILE" ] && {
- # we are not using a reclock file
- ctdb_counter_init "$RECLOCKCOUNT"
- exit 0
+ # we are not using a reclock file
+ ctdb_counter_init
+ exit 0
}
# try stat the reclock file as a background process
# so that we dont block in case the cluster filesystem is unavailable
(
- stat $RECLOCKFILE && {
- # we could stat the file, reset the counter
- ctdb_counter_init "$RECLOCKCOUNT"
- }
+ stat $RECLOCKFILE && {
+ # we could stat the file, reset the counter
+ ctdb_counter_init
+ }
) >/dev/null 2>/dev/null &
-
- ctdb_counter_limit "$RECLOCKCOUNT" 3 && {
- echo "Reclock file \"$RECLOCKFILE\" can not be accessed. Mark node UNHEALTHY."
- df
- exit 1;
- }
+ ctdb_check_counter_limit 3 quiet
+ ;;
+ status)
+ ctdb_checkstatus || exit $?
;;
esac
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 9a02b15..da6d903 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -6,10 +6,7 @@
# public interface
. $CTDB_BASE/functions
-loadconfig ctdb
-
-cmd="$1"
-shift
+loadconfig
[ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
CTDB_PUBLIC_ADDRESSES=$CTDB_BASE/public_addresses
@@ -177,10 +174,10 @@ case $cmd in
esac
done
;;
-
+ status)
+ ctdb_checkstatus || exit $?
+ ;;
esac
exit 0
-
-
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index 4ef651d..3a35094 100644
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -6,15 +6,10 @@
#
. $CTDB_BASE/functions
-loadconfig ctdb
+loadconfig
[ -z "$CTDB_NATGW_PUBLIC_IFACE" ] && exit 0
-cmd="$1"
-shift
-PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
-
-
delete_all() {
remove_ip $CTDB_NATGW_PUBLIC_IP $CTDB_NATGW_PUBLIC_IFACE
remove_ip $CTDB_NATGW_PUBLIC_IP_HOST lo
@@ -28,7 +23,7 @@ delete_all() {
}
case $cmd in
- startup)
+ startup)
# do not respond to ARPs that are for ip addresses with scope 'host'
echo 3 > /proc/sys/net/ipv4/conf/all/arp_ignore
# do not send out arp requests from loopback addresses
@@ -37,13 +32,13 @@ case $cmd in
ctdb setnatgwstate on
;;
- recovered|updatenatgw)
+ recovered|updatenatgw)
MYPNN=`ctdb pnn | cut -d: -f2`
NATGWMASTER=`ctdb natgwlist | head -1 | sed -e "s/ .*//"`
NATGWIP=`ctdb natgwlist | head -1 | sed -e "s/^[^ ]* *//"`
CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
- if [ "$NATGWMASTER" = "-1" ]; then
+ if [ "$NATGWMASTER" == "-1" ]; then
echo "There is not NATGW master node"
exit 1
fi
@@ -71,7 +66,7 @@ case $cmd in
echo 1 > /proc/sys/net/ipv4/route/flush
;;
- shutdown|removenatgw)
+ shutdown|removenatgw)
delete_all
;;
diff --git a/config/events.d/11.routing b/config/events.d/11.routing
index 0674193..cb34e41 100755
--- a/config/events.d/11.routing
+++ b/config/events.d/11.routing
@@ -13,16 +13,12 @@
# bond1 10.3.3.0/24 10.0.0.1
. $CTDB_BASE/functions
-loadconfig ctdb
+loadconfig
[ -f $CTDB_BASE/static-routes ] || {
exit 0
}
-cmd="$1"
-shift
-PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
-
case $cmd in
takeip|releaseip)
iface=$1
diff --git a/config/events.d/20.multipathd b/config/events.d/20.multipathd
index c740d69..cf722d8 100644
--- a/config/events.d/20.multipathd
+++ b/config/events.d/20.multipathd
@@ -6,14 +6,11 @@
# CTDB_MONITOR_MPDEVICES="device1 device2 ..."
#
-PATH=/bin:/usr/bin:$PATH
-
. $CTDB_BASE/functions
-loadconfig ctdb
-loadconfig multipathd
-cmd="$1"
-shift
+service_name="multipathd"
+
+loadconfig
[ -z "$CTDB_MONITOR_MPDEVICES" ] && {
exit 0
diff --git a/config/events.d/31.clamd b/config/events.d/31.clamd
index 842096a..a6515a9 100644
--- a/config/events.d/31.clamd
+++ b/config/events.d/31.clamd
@@ -2,52 +2,45 @@
# event script to manage clamd in a cluster environment
. $CTDB_BASE/functions
-loadconfig ctdb
detect_init_style
case $CTDB_INIT_STYLE in
redhat)
- CTDB_SERVICE_CLAMD="clamd"
- CTDB_CONFIG_CLAMD="clamd"
- ;;
- suse)
- CTDB_SERVICE_CLAMD="clamav"
- CTDB_CONFIG_CLAMD="clamav"
- ;;
- debian)
- CTDB_SERVICE_CLAMD="clamav"
- CTDB_CONFIG_CLAMD="clamav"
+ service_name="clamd"
+ service_config="clamd"
;;
*)
- # should not happen.
- # for now use red hat style as default
- CTDB_SERVICE_CLAMD="clamd"
- CTDB_CONFIG_CLAMD="clamd"
+ service_name="clamav"
+ service_config="clamav"
;;
esac
-loadconfig "${CTDB_CONFIG_CLAMD}"
+service_start="service $service_name stop > /dev/null 2>&1 ; service $service_name start"
+service_stop="service $service_name stop"
+
+loadconfig
-[ "$CTDB_MANAGES_CLAMD" = "yes" ] || exit 0
+ctdb_start_stop_service
-cmd="$1"
-shift
+is_ctdb_managed_service || exit 0
case $cmd in
startup)
- service "${CTDB_SERVICE_CLAMD}" stop > /dev/null 2>&1
- service "${CTDB_SERVICE_CLAMD}" start
+ ctdb_service_start
;;
shutdown)
- service "${CTDB_SERVICE_CLAMD}" stop
+ ctdb_service_stop
;;
monitor)
- ctdb_check_unix_socket "clamd" ${CTDB_CLAMD_SOCKET}
+ ctdb_check_unix_socket ${CTDB_CLAMD_SOCKET} || exit $?
;;
+
+ status)
+ ctdb_checkstatus || exit $?
+ ;;
esac
exit 0
-
diff --git a/config/events.d/40.vsftpd b/config/events.d/40.vsftpd
index 315c150..582604a 100755
--- a/config/events.d/40.vsftpd
+++ b/config/events.d/40.vsftpd
@@ -2,67 +2,61 @@
# event strict to manage vsftpd in a cluster environment
. $CTDB_BASE/functions
-loadconfig ctdb
-loadconfig vsftpd
-[ "$CTDB_MANAGES_VSFTPD" = "yes" ] || exit 0
+service_name="vsftpd"
+# make sure the service is stopped first
+service_start="service $service_name stop > /dev/null 2>&1 ; service $service_name start"
+service_stop="service $service_name stop"
+service_reconfigure="service $service_name restart"
+service_fail_limit=2
+service_tcp_ports=21
-cmd="$1"
-shift
+loadconfig
-# Count the number of monitor failures. The cluster only becomes
-# unhealthy after 2 failures.
-VSFTPD_FAILS="fail-count"
-VSFTPD_LIMIT=2
+ctdb_start_stop_service
+
+is_ctdb_managed_service || exit 0
case $cmd in
startup)
- /bin/mkdir -p $CTDB_BASE/state/vsftpd
-
- # make sure the service is stopped first
- service vsftpd stop > /dev/null 2>&1
- service vsftpd start
-
- ctdb_counter_init "$VSFTPD_FAILS"
+ ctdb_service_start
;;
shutdown)
- service vsftpd stop
+ ctdb_service_stop
;;
- takeip)
- echo "restart" > $CTDB_BASE/state/vsftpd/restart
- ;;
-
- releaseip)
- echo "restart" > $CTDB_BASE/state/vsftpd/restart
+ takeip|releaseip)
+ ctdb_service_set_reconfigure
;;
recovered)
# if we have taken or released any ips we must
# restart vsftpd to ensure that all tcp connections are reset
- [ -f $CTDB_BASE/state/vsftpd/restart ] && {
- service vsftpd stop > /dev/null 2>&1
- service vsftpd start
- /bin/rm -f $CTDB_BASE/state/vsftpd/restart 2>/dev/null
- ctdb_counter_init "$VSFTPD_FAILS"
- } >/dev/null 2>&1
+ if ctdb_service_needs_reconfigure ; then
+ ctdb_service_reconfigure
+ fi
;;
monitor)
- # Subshell catches the "exit 1"
- if (ctdb_check_tcp_ports "ftp" 21) ; then
- ctdb_counter_init "$VSFTPD_FAILS"
- else
- ctdb_counter_incr "$VSFTPD_FAILS"
- if ctdb_counter_limit "$VSFTPD_FAILS" $VSFTPD_LIMIT ; then
- echo "ERROR: more than $VSFTPD_LIMIT consecutive failures, marking cluster unhealthy"
- exit 1
+ if ctdb_service_needs_reconfigure ; then
+ ctdb_service_reconfigure
+ exit 0
+ fi
+
+ if [ -n "$service_tcp_ports" ] ; then
+ if ctdb_check_tcp_ports $service_tcp_ports ; then
+ ctdb_counter_init
else
- echo "WARNING: less than $VSFTPD_LIMIT consecutive failures, not unhealthy yet"
+ ctdb_counter_incr
+ ctdb_check_counter_limit
+ exit 0 # only count 1 failure per monitor event
fi
-
- fi
+ fi
+ ;;
+
+ status)
+ ctdb_checkstatus || exit $?
;;
esac
diff --git a/config/events.d/41.httpd b/config/events.d/41.httpd
index d6e7f99..7f9ee23 100755
--- a/config/events.d/41.httpd
+++ b/config/events.d/41.httpd
@@ -2,67 +2,66 @@
# event script to manage httpd in a cluster environment
. $CTDB_BASE/functions
-loadconfig ctdb
detect_init_style
case $CTDB_INIT_STYLE in
- redhat)
- CTDB_SERVICE_HTTP="httpd"
- CTDB_CONFIG_HTTP="http"
- ;;
- suse)
- CTDB_SERVICE_HTTP="apache2"
- CTDB_CONFIG_HTTP="apache2"
- ;;
- debian)
- CTDB_SERVICE_HTTP="apache2"
- CTDB_CONFIG_HTTP="apache2"
- ;;
- *)
- # should not happen.
- # for now use red hat style as default
- CTDB_SERVICE_HTTP="httpd"
- CTDB_CONFIG_HTTP="http"
- ;;
+ redhat)
+ service_name="httpd"
+ service_config="http"
+ ;;
+ suse|debian|*)
+ service_name="apache2"
+ service_config="apache2"
+ ;;
esac
-loadconfig "${CTDB_CONFIG_HTTP}"
-
-[ "$CTDB_MANAGES_HTTPD" = "yes" ] || exit 0
-
-cmd="$1"
-shift
-
# RHEL5 sometimes use a SIGKILL to terminate httpd, which then leaks
# semaphores. This is a hack to clean them up.
cleanup_httpd_semaphore_leak() {
- killall -q -0 "${CTDB_SERVICE_HTTP}" ||
+ killall -q -0 "$service_name" ||
for i in $(ipcs -s | awk '$3 == "apache" { print $2 }') ; do
ipcrm -s $i
done
}
+##########
+
+service_start="cleanup_httpd_semaphore_leak; service $service_name start"
+service_stop="service $service_name stop; killall -q -9 $service_name || true"
+service_reconfigure="service $service_name restart"
+
+loadconfig
+
+ctdb_start_stop_service
+
+is_ctdb_managed_service || exit 0
+
case $cmd in
startup)
- cleanup_httpd_semaphore_leak
- service "${CTDB_SERVICE_HTTP}" start
+ ctdb_service_start
--
CTDB repository
More information about the samba-cvs
mailing list