Skip to content

Commit

Permalink
High: Exit reason string support updates
Browse files Browse the repository at this point in the history
High: apache: exit reason string support
High: clvmd: exit reason support
High: conntrackd: exit reason support
High: CTDB: exit reason support
High: Delay: exit reason string support
High: delay: exit reason support
High: Filesystem: exit reason support
High: galera: exit reason string support
High: IPsrcaddr: exit reason support
High: clvmd: exit reason support
High: MailTo: exit string support
High: mysql: exit string support
High: named: exit reason support
High: pgsql: exit reason support
High: postfix: exit reason support
High: Route: exit reason support
High: rsyncd: exit reason support
High: SendArp: exit string support
High: slapd: exit reason support
High: Squid: exit reason support
High: symlink: exit reason support
High: mysql-common: exit reason support
High: tomcat: exit reason support
High: Xinetd: exit reason support
  • Loading branch information
davidvossel committed Aug 19, 2014
1 parent c5902ff commit 0c97413
Show file tree
Hide file tree
Showing 24 changed files with 234 additions and 234 deletions.
24 changes: 12 additions & 12 deletions heartbeat/CTDB
Expand Up @@ -544,15 +544,15 @@ ctdb_start() {
mkdir -p $persistent_db_dir 2>/dev/null
for pdbase in $(ls $persistent_db_dir/*.tdb.[0-9] 2>/dev/null$) ; do
/usr/bin/tdbdump $pdbase >/dev/null 2>/dev/null || {
ocf_log err "Persistent database $pdbase is corrupted! CTDB will not start."
ocf_exit_reason "Persistent database $pdbase is corrupted! CTDB will not start."
return $OCF_ERR_GENERIC
}
done

# Add necessary configuration to smb.conf
init_smb_conf
if [ $? -ne 0 ]; then
ocf_log err "Failed to update $OCF_RESKEY_smb_conf."
ocf_exit_reason "Failed to update $OCF_RESKEY_smb_conf."
return $OCF_ERR_GENERIC
fi

Expand Down Expand Up @@ -596,7 +596,7 @@ ctdb_start() {
# cleanup smb.conf
cleanup_smb_conf

ocf_log err "Failed to execute $OCF_RESKEY_ctdbd_binary."
ocf_exit_reason "Failed to execute $OCF_RESKEY_ctdbd_binary."
return $OCF_ERR_GENERIC
else
# Wait a bit for CTDB to stabilize
Expand All @@ -610,7 +610,7 @@ ctdb_start() {
if [ $? -ne 0 ]; then
# CTDB will be running, kill it before returning
ctdb_stop
ocf_log err "Can't invoke $OCF_RESKEY_ctdb_binary --socket=$OCF_RESKEY_ctdb_socket status"
ocf_exit_reason "Can't invoke $OCF_RESKEY_ctdb_binary --socket=$OCF_RESKEY_ctdb_socket status"
return $OCF_ERR_GENERIC
fi
if ! echo $status | grep -qs 'UNHEALTHY (THIS'; then
Expand All @@ -626,7 +626,7 @@ ctdb_start() {
# ctdbd will (or can) actually still be running at this point, so kill it
ctdb_stop

ocf_log err "Timeout waiting for CTDB to stabilize"
ocf_exit_reason "Timeout waiting for CTDB to stabilize"
return $OCF_ERR_GENERIC
}

Expand Down Expand Up @@ -681,15 +681,15 @@ ctdb_monitor() {
elif echo $status | grep -qs 'No such file or directory'; then
return $OCF_NOT_RUNNING
else
ocf_log err "CTDB status call failed: $status"
ocf_exit_reason "CTDB status call failed: $status"
return $OCF_ERR_GENERIC
fi
fi
if echo $status | grep -Eqs '(OK|DISABLED) \(THIS'; then
return $OCF_SUCCESS
fi

ocf_log err "CTDB status is bad: $status"
ocf_exit_reason "CTDB status is bad: $status"
return $OCF_ERR_GENERIC
}

Expand All @@ -702,12 +702,12 @@ ctdb_validate() {
done

if [ -z "$CTDB_SYSCONFIG" ]; then
ocf_log err "Can't find CTDB config file (expecting /etc/sysconfig/ctdb, /etc/default/ctdb or similar)"
ocf_exit_reason "Can't find CTDB config file (expecting /etc/sysconfig/ctdb, /etc/default/ctdb or similar)"
return $OCF_ERR_INSTALLED
fi

if ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" && [ ! -f "$OCF_RESKEY_smb_conf" ]; then
ocf_log err "Samba config file '$OCF_RESKEY_smb_conf' does not exist."
ocf_exit_reason "Samba config file '$OCF_RESKEY_smb_conf' does not exist."
return $OCF_ERR_INSTALLED
fi

Expand All @@ -716,19 +716,19 @@ ctdb_validate() {
fi

if [ ! -f "$OCF_RESKEY_ctdb_config_dir/nodes" ]; then
ocf_log err "$OCF_RESKEY_ctdb_config_dir/nodes does not exist."
ocf_exit_reason "$OCF_RESKEY_ctdb_config_dir/nodes does not exist."
return $OCF_ERR_ARGS
fi

if [ -z "$OCF_RESKEY_ctdb_recovery_lock" ]; then
ocf_log err "ctdb_recovery_lock not specified."
ocf_exit_reason "ctdb_recovery_lock not specified."
return $OCF_ERR_CONFIGURED
fi

lock_dir=$(dirname "$OCF_RESKEY_ctdb_recovery_lock")
touch "$lock_dir/$$" 2>/dev/null
if [ $? != 0 ]; then
ocf_log err "Directory for lock file '$OCF_RESKEY_ctdb_recovery_lock' does not exist, or is not writable."
ocf_exit_reason "Directory for lock file '$OCF_RESKEY_ctdb_recovery_lock' does not exist, or is not writable."
return $OCF_ERR_ARGS
fi
rm "$lock_dir/$$"
Expand Down
2 changes: 1 addition & 1 deletion heartbeat/Delay
Expand Up @@ -184,7 +184,7 @@ Delay_Validate_All() {
# _Return_ on validation success
return $OCF_SUCCESS
else
echo "Some of the instance parameters are invalid"
ocf_exit_reason "Some of the instance parameters are invalid"
# _Exit_ on validation failure
exit $OCF_ERR_ARGS
fi
Expand Down
32 changes: 16 additions & 16 deletions heartbeat/Filesystem
Expand Up @@ -368,7 +368,7 @@ fstype_supported()
# check the if the filesystem support exists again.
$MODPROBE $support >/dev/null
if [ $? -ne 0 ]; then
ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems and failed to load kernal module"
ocf_exit_reason "Couldn't find filesystem $FSTYPE in /proc/filesystems and failed to load kernal module"
return $OCF_ERR_INSTALLED
fi

Expand All @@ -385,7 +385,7 @@ fstype_supported()
sleep 1
done

ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems"
ocf_exit_reason "Couldn't find filesystem $FSTYPE in /proc/filesystems"
return $OCF_ERR_INSTALLED
}

Expand All @@ -409,7 +409,7 @@ Filesystem_start()

if [ $blockdevice = "yes" ]; then
if [ "$DEVICE" != "/dev/null" -a ! -b "$DEVICE" ] ; then
ocf_log err "Couldn't find device [$DEVICE]. Expected /dev/??? to exist"
ocf_exit_reason "Couldn't find device [$DEVICE]. Expected /dev/??? to exist"
exit $OCF_ERR_INSTALLED
fi

Expand All @@ -424,7 +424,7 @@ Filesystem_start()
# NOTE: if any errors at all are detected, it returns non-zero
# if the error is >= 4 then there is a big problem
if [ $? -ge 4 ]; then
ocf_log err "Couldn't sucessfully fsck filesystem for $DEVICE"
ocf_exit_reason "Couldn't sucessfully fsck filesystem for $DEVICE"
return $OCF_ERR_GENERIC
fi
fi
Expand All @@ -433,7 +433,7 @@ Filesystem_start()
[ -d "$MOUNTPOINT" ] ||
ocf_run mkdir -p $MOUNTPOINT
if [ ! -d "$MOUNTPOINT" ] ; then
ocf_log err "Couldn't find directory [$MOUNTPOINT] to use as a mount point"
ocf_exit_reason "Couldn't find directory [$MOUNTPOINT] to use as a mount point"
exit $OCF_ERR_INSTALLED
fi

Expand All @@ -448,7 +448,7 @@ Filesystem_start()
esac

if [ $? -ne 0 ]; then
ocf_log err "Couldn't mount filesystem $DEVICE on $MOUNTPOINT"
ocf_exit_reason "Couldn't mount filesystem $DEVICE on $MOUNTPOINT"
return $OCF_ERR_GENERIC
fi
return $OCF_SUCCESS
Expand Down Expand Up @@ -507,7 +507,7 @@ fs_stop() {
while [ $cnt -gt 0 ]; do
try_umount $SUB &&
return $OCF_SUCCESS
ocf_log err "Couldn't unmount $SUB; trying cleanup with $sig"
ocf_exit_reason "Couldn't unmount $SUB; trying cleanup with $sig"
signal_processes $SUB $sig
cnt=$((cnt-1))
sleep 1
Expand Down Expand Up @@ -558,7 +558,7 @@ Filesystem_stop()
fs_stop $SUB $timeout
rc=$?
if [ $rc -ne $OCF_SUCCESS ]; then
ocf_log err "Couldn't unmount $SUB, giving up!"
ocf_exit_reason "Couldn't unmount $SUB, giving up!"
fi
done
fi
Expand Down Expand Up @@ -611,7 +611,7 @@ Filesystem_monitor_10()
dd_opts="iflag=direct bs=4k count=1"
err_output=`dd if=$DEVICE $dd_opts 2>&1 >/dev/null`
if [ $? -ne 0 ]; then
ocf_log err "Failed to read device $DEVICE"
ocf_exit_reason "Failed to read device $DEVICE"
ocf_log err "dd said: $err_output"
return $OCF_ERR_GENERIC
fi
Expand All @@ -634,18 +634,18 @@ Filesystem_monitor_20()
[ -d "$status_dir" ] || mkdir -p "$status_dir"
err_output=`echo "${OCF_RESOURCE_INSTANCE}" | dd of=${STATUSFILE} $dd_opts 2>&1`
if [ $? -ne 0 ]; then
ocf_log err "Failed to write status file ${STATUSFILE}"
ocf_exit_reason "Failed to write status file ${STATUSFILE}"
ocf_log err "dd said: $err_output"
return $OCF_ERR_GENERIC
fi
test -f ${STATUSFILE}
if [ $? -ne 0 ]; then
ocf_log err "Cannot stat the status file ${STATUSFILE}"
ocf_exit_reason "Cannot stat the status file ${STATUSFILE}"
return $OCF_ERR_GENERIC
fi
cat ${STATUSFILE} > /dev/null
if [ $? -ne 0 ]; then
ocf_log err "Cannot read the status file ${STATUSFILE}"
ocf_exit_reason "Cannot read the status file ${STATUSFILE}"
return $OCF_ERR_GENERIC
fi
return $OCF_SUCCESS
Expand All @@ -663,7 +663,7 @@ Filesystem_monitor()
10) Filesystem_monitor_10; rc=$?;;
20) Filesystem_monitor_20; rc=$?;;
*)
ocf_log err "unsupported monitor level $OCF_CHECK_LEVEL"
ocf_exit_reason "unsupported monitor level $OCF_CHECK_LEVEL"
rc=$OCF_ERR_CONFIGURED
;;
esac
Expand Down Expand Up @@ -780,7 +780,7 @@ case $OP in
esac

if [ x = x"$DEVICE" ]; then
ocf_log err "Please set OCF_RESKEY_device to the device to be managed"
ocf_exit_reason "Please set OCF_RESKEY_device to the device to be managed"
exit $OCF_ERR_CONFIGURED
fi

Expand All @@ -792,7 +792,7 @@ set_blockdevice_var
# But the output of `mount` and /proc/mounts do not.
if [ -z "$OCF_RESKEY_directory" ]; then
if [ X$OP = "Xstart" -o $blockdevice = "no" ]; then
ocf_log err "Please specify the directory"
ocf_exit_reason "Please specify the directory"
exit $OCF_ERR_CONFIGURED
fi
else
Expand Down Expand Up @@ -854,7 +854,7 @@ esac
if ocf_is_clone; then
case $CLUSTERSAFE in
0)
ocf_log err "DANGER! $FSTYPE on $DEVICE is NOT cluster-aware!"
ocf_exit_reason "DANGER! $FSTYPE on $DEVICE is NOT cluster-aware!"
ocf_log err "DO NOT RUN IT AS A CLONE!"
ocf_log err "Politely refusing to proceed to avoid data corruption."
exit $OCF_ERR_CONFIGURED
Expand Down
14 changes: 7 additions & 7 deletions heartbeat/IPsrcaddr
Expand Up @@ -111,7 +111,7 @@ END
}

errorexit() {
ocf_log err "$*"
ocf_exit_reason "$*"
exit $OCF_ERR_GENERIC
}

Expand Down Expand Up @@ -253,7 +253,7 @@ CheckIP() {
( [ $1 -le 254 ] && [ $2 -le 254 ] && [ $3 -le 254 ] && [ $4 -le 254 ] )
then
if [ $1 -eq 127 ]; then
ocf_log err "IP address [$ip] is a loopback address, thus can not be preferred source address"
ocf_exit_reason "IP address [$ip] is a loopback address, thus can not be preferred source address"
exit $OCF_ERR_CONFIGURED
fi
else
Expand Down Expand Up @@ -368,7 +368,7 @@ ip_status() {

case $IF in
lo*)
ocf_log err "IP address [$BASEIP] is served by loopback, thus can not be preferred source address"
ocf_exit_reason "IP address [$BASEIP] is served by loopback, thus can not be preferred source address"
exit $OCF_ERR_CONFIGURED
;;
*)return $OCF_SUCCESS;;
Expand All @@ -394,7 +394,7 @@ srca_validate_all() {
if CheckIP "$ipaddress"; then
:
else
ocf_log err "Invalid IP address [$ipaddress]"
ocf_exit_reason "Invalid IP address [$ipaddress]"
exit $OCF_ERR_CONFIGURED
fi

Expand All @@ -406,7 +406,7 @@ srca_validate_all() {
if ip_status "$ipaddress"; then
:
else
ocf_log err "We are not serving [$ipaddress], hence can not make it a preferred source address"
ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
exit $OCF_ERR_INSTALLED
fi
}
Expand Down Expand Up @@ -434,7 +434,7 @@ if
[ -z "$OCF_RESKEY_ipaddress" ]
then
# usage
ocf_log err "Please set OCF_RESKEY_ipaddress to the preferred source IP address!"
ocf_exit_reason "Please set OCF_RESKEY_ipaddress to the preferred source IP address!"
exit $OCF_ERR_CONFIGURED
fi

Expand All @@ -447,7 +447,7 @@ fi
findif_out=`$FINDIF -C`
rc=$?
[ $rc -ne 0 ] && {
ocf_log err "[$FINDIF -C] failed"
ocf_exit_reason "[$FINDIF -C] failed"
exit $rc
}

Expand Down

0 comments on commit 0c97413

Please sign in to comment.