|
|
c608c9 |
From a8adbaa0716f0fa39e41293fe81530686f64e2c8 Mon Sep 17 00:00:00 2001
|
|
|
c608c9 |
From: David Vossel <dvossel@redhat.com>
|
|
|
c608c9 |
Date: Fri, 1 Aug 2014 15:31:38 -0400
|
|
|
c608c9 |
Subject: [PATCH] High: IPaddr2: support ocf_exit_reason
|
|
|
c608c9 |
|
|
|
c608c9 |
---
|
|
|
c608c9 |
heartbeat/IPaddr2 | 40 +++++++++++++++++++++-------------------
|
|
|
c608c9 |
1 file changed, 21 insertions(+), 19 deletions(-)
|
|
|
c608c9 |
|
|
|
c608c9 |
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
|
|
c608c9 |
index b645288..2791ea0 100755
|
|
|
c608c9 |
--- a/heartbeat/IPaddr2
|
|
|
c608c9 |
+++ b/heartbeat/IPaddr2
|
|
|
c608c9 |
@@ -342,12 +342,12 @@ ip_init() {
|
|
|
c608c9 |
local rc
|
|
|
c608c9 |
|
|
|
c608c9 |
if [ X`uname -s` != "XLinux" ]; then
|
|
|
c608c9 |
- ocf_log err "IPaddr2 only supported Linux."
|
|
|
c608c9 |
+ ocf_exit_reason "IPaddr2 only supported Linux."
|
|
|
c608c9 |
exit $OCF_ERR_INSTALLED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
if [ X"$OCF_RESKEY_ip" = "X" ]; then
|
|
|
c608c9 |
- ocf_log err "IP address (the ip parameter) is mandatory"
|
|
|
c608c9 |
+ ocf_exit_reason "IP address (the ip parameter) is mandatory"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -359,7 +359,7 @@ ip_init() {
|
|
|
c608c9 |
then
|
|
|
c608c9 |
: YAY!
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "You must be root for $__OCF_ACTION operation."
|
|
|
c608c9 |
+ ocf_exit_reason "You must be root for $__OCF_ACTION operation."
|
|
|
c608c9 |
exit $OCF_ERR_PERM
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -382,14 +382,14 @@ ip_init() {
|
|
|
c608c9 |
IP_INC_NO=`expr ${OCF_RESKEY_CRM_meta_clone:-0} + 1`
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_true ${OCF_RESKEY_lvs_support} && [ $IP_INC_GLOBAL -gt 1 ]; then
|
|
|
c608c9 |
- ocf_log err "LVS and load sharing do not go together well"
|
|
|
c608c9 |
+ ocf_exit_reason "LVS and load sharing do not go together well"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_decimal "$IP_INC_GLOBAL" && [ $IP_INC_GLOBAL -gt 0 ]; then
|
|
|
c608c9 |
:
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "Invalid OCF_RESKEY_incarnations_max_global [$IP_INC_GLOBAL], should be positive integer"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid meta-attribute clone_max [$IP_INC_GLOBAL], should be positive integer"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -397,20 +397,20 @@ ip_init() {
|
|
|
c608c9 |
if [ $? -ne 0 ];then
|
|
|
c608c9 |
FAMILY=inet
|
|
|
c608c9 |
if ocf_is_true $OCF_RESKEY_lvs_ipv6_addrlabel ;then
|
|
|
c608c9 |
- ocf_log err "IPv4 does not support lvs_ipv6_addrlabel"
|
|
|
c608c9 |
+ ocf_exit_reason "IPv4 does not support lvs_ipv6_addrlabel"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
else
|
|
|
c608c9 |
FAMILY=inet6
|
|
|
c608c9 |
if ocf_is_true $OCF_RESKEY_lvs_support ;then
|
|
|
c608c9 |
- ocf_log err "The IPv6 does not support lvs_support"
|
|
|
c608c9 |
+ ocf_exit_reason "The IPv6 does not support lvs_support"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
if ocf_is_true $OCF_RESKEY_lvs_ipv6_addrlabel ;then
|
|
|
c608c9 |
if ocf_is_decimal "$OCF_RESKEY_lvs_ipv6_addrlabel_value" && [ $OCF_RESKEY_lvs_ipv6_addrlabel_value -ge 0 ]; then
|
|
|
c608c9 |
:
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "Invalid lvs_ipv6_addrlabel_value [$OCF_RESKEY_lvs_ipv6_addrlabel_value], should be positive integer"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid lvs_ipv6_addrlabel_value [$OCF_RESKEY_lvs_ipv6_addrlabel_value], should be positive integer"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
@@ -446,7 +446,7 @@ ip_init() {
|
|
|
c608c9 |
ocf_log warn "[$FINDIF] failed"
|
|
|
c608c9 |
exit $OCF_SUCCESS
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "[$FINDIF] failed"
|
|
|
c608c9 |
+ ocf_exit_reason "[$FINDIF] failed"
|
|
|
c608c9 |
exit $rc
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
@@ -769,7 +769,8 @@ END
|
|
|
c608c9 |
}
|
|
|
c608c9 |
|
|
|
c608c9 |
ip_start() {
|
|
|
c608c9 |
- if [ -z "$NIC" ]; then # no nic found or specified
|
|
|
c608c9 |
+ if [ -z "$NIC" ]; then
|
|
|
c608c9 |
+ ocf_exit_reason "No nic found or specified"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -799,7 +800,7 @@ ip_start() {
|
|
|
c608c9 |
--local-node $IP_INC_NO \
|
|
|
c608c9 |
--hashmode $IP_CIP_HASH
|
|
|
c608c9 |
if [ $? -ne 0 ]; then
|
|
|
c608c9 |
- ocf_log err "iptables failed"
|
|
|
c608c9 |
+ ocf_exit_reason "iptables failed"
|
|
|
c608c9 |
exit $OCF_ERR_GENERIC
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
@@ -822,7 +823,7 @@ ip_start() {
|
|
|
c608c9 |
add_interface $OCF_RESKEY_ip $NETMASK ${BRDCAST:-none} $NIC $IFLABEL
|
|
|
c608c9 |
|
|
|
c608c9 |
if [ $? -ne 0 ]; then
|
|
|
c608c9 |
- ocf_log err "$CMD failed."
|
|
|
c608c9 |
+ ocf_exit_reason "$CMD failed."
|
|
|
c608c9 |
exit $OCF_ERR_GENERIC
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
@@ -897,6 +898,7 @@ ip_stop() {
|
|
|
c608c9 |
if [ "$ip_del_if" = "yes" ]; then
|
|
|
c608c9 |
delete_interface $OCF_RESKEY_ip $NIC $NETMASK
|
|
|
c608c9 |
if [ $? -ne 0 ]; then
|
|
|
c608c9 |
+ ocf_exit_reason "Unable to remove IP [${OCF_RESKEY_ip} from interface [ $NIC ]"
|
|
|
c608c9 |
exit $OCF_ERR_GENERIC
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -940,7 +942,7 @@ set_send_arp_program() {
|
|
|
c608c9 |
ARP_SEND_FUN=run_send_ib_arp
|
|
|
c608c9 |
;;
|
|
|
c608c9 |
*)
|
|
|
c608c9 |
- ocf_log err "unrecognized arp_sender value: $OCF_RESKEY_arp_sender"
|
|
|
c608c9 |
+ ocf_exit_reason "unrecognized arp_sender value: $OCF_RESKEY_arp_sender"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
;;
|
|
|
c608c9 |
esac
|
|
|
c608c9 |
@@ -975,21 +977,21 @@ ip_validate() {
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_true "$OCF_RESKEY_unique_clone_address" &&
|
|
|
c608c9 |
! ocf_is_true "$OCF_RESKEY_CRM_meta_globally_unique"; then
|
|
|
c608c9 |
- ocf_log err "unique_clone_address makes sense only with meta globally_unique set"
|
|
|
c608c9 |
+ ocf_exit_reason "unique_clone_address makes sense only with meta globally_unique set"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_decimal "$OCF_RESKEY_arp_interval" && [ $OCF_RESKEY_arp_interval -gt 0 ]; then
|
|
|
c608c9 |
:
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "Invalid OCF_RESKEY_arp_interval [$OCF_RESKEY_arp_interval]"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid OCF_RESKEY_arp_interval [$OCF_RESKEY_arp_interval]"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_decimal "$OCF_RESKEY_arp_count" && [ $OCF_RESKEY_arp_count -gt 0 ]; then
|
|
|
c608c9 |
:
|
|
|
c608c9 |
else
|
|
|
c608c9 |
- ocf_log err "Invalid OCF_RESKEY_arp_count [$OCF_RESKEY_arp_count]"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid OCF_RESKEY_arp_count [$OCF_RESKEY_arp_count]"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -1001,13 +1003,13 @@ ip_validate() {
|
|
|
c608c9 |
sourceip|sourceip-sourceport|sourceip-sourceport-destport)
|
|
|
c608c9 |
;;
|
|
|
c608c9 |
*)
|
|
|
c608c9 |
- ocf_log err "Invalid OCF_RESKEY_clusterip_hash [$IP_CIP_HASH]"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid OCF_RESKEY_clusterip_hash [$IP_CIP_HASH]"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
;;
|
|
|
c608c9 |
esac
|
|
|
c608c9 |
|
|
|
c608c9 |
if ocf_is_true ${OCF_RESKEY_lvs_support}; then
|
|
|
c608c9 |
- ecf_log err "LVS and load sharing not advised to try"
|
|
|
c608c9 |
+ ocf_exit_reason "LVS and load sharing not advised to try"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
@@ -1020,7 +1022,7 @@ ip_validate() {
|
|
|
c608c9 |
esac
|
|
|
c608c9 |
|
|
|
c608c9 |
if [ $valid -eq 0 ]; then
|
|
|
c608c9 |
- ocf_log err "Invalid IF_MAC [$IF_MAC]"
|
|
|
c608c9 |
+ ocf_exit_reason "Invalid IF_MAC [$IF_MAC]"
|
|
|
c608c9 |
exit $OCF_ERR_CONFIGURED
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
--
|
|
|
c608c9 |
1.8.4.2
|
|
|
c608c9 |
|