You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

From 3c383f3dbb3b5351b25d33aa6e516ab8fc04a26a Mon Sep 17 00:00:00 2001
From: David Vossel <dvossel@redhat.com>
Date: Tue, 28 Apr 2015 11:47:21 -0500
Subject: [PATCH] High: IPsrcaddr: return correct error code during stop when
misconfigured
---
heartbeat/IPsrcaddr | 45 +++++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
index 8163c0c..33c5be6 100755
--- a/heartbeat/IPsrcaddr
+++ b/heartbeat/IPsrcaddr
@@ -387,15 +387,27 @@ ip_status() {
srca_validate_all() {
- check_binary $AWK
- check_binary $IFCONFIG
+ if [ -z "$OCF_RESKEY_ipaddress" ]; then
+ # usage
+ ocf_exit_reason "Please set OCF_RESKEY_ipaddress to the preferred source IP address!"
+ return $OCF_ERR_CONFIGURED
+ fi
+
+
+ if ! [ "x$SYSTYPE" = "xLinux" ]; then
+ # checks after this point are only relevant for linux.
+ return $OCF_SUCCESS
+ fi
+
+ check_binary $AWK
+ check_binary $IFCONFIG
# The IP address should be in good shape
if CheckIP "$ipaddress"; then
:
else
ocf_exit_reason "Invalid IP address [$ipaddress]"
- exit $OCF_ERR_CONFIGURED
+ return $OCF_ERR_CONFIGURED
fi
if ocf_is_probe; then
@@ -407,8 +419,9 @@ srca_validate_all() {
:
else
ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
- exit $OCF_ERR_INSTALLED
+ return $OCF_ERR_INSTALLED
fi
+ return $OCF_SUCCESS
}
if
@@ -430,18 +443,22 @@ case $1 in
;;
esac
-if
- [ -z "$OCF_RESKEY_ipaddress" ]
-then
-# usage
- ocf_exit_reason "Please set OCF_RESKEY_ipaddress to the preferred source IP address!"
- exit $OCF_ERR_CONFIGURED
-fi
-
ipaddress="$OCF_RESKEY_ipaddress"
-if [ "x$SYSTYPE" = "xLinux" ]; then
- srca_validate_all
+srca_validate_all
+rc=$?
+if [ $rc -ne $OCF_SUCCESS ]; then
+ case $1 in
+ # if we can't validate the configuration during a stop, that
+ # means the resources isn't configured correctly. There's no way
+ # to actually stop the resource in this situation because there's
+ # no way it could have even started. Return success here
+ # to indicate that the resource is not running, otherwise the
+ # stop action will fail causing the node to be fenced just because
+ # of a mis configuration.
+ stop) exit $OCF_SUCCESS;;
+ *) exit $rc;;
+ esac
fi
findif_out=`$FINDIF -C`
--
1.8.4.2