|
|
e87a70 |
From 5a65f66ff803ad7ed15af958cc1efdde4d53dcb7 Mon Sep 17 00:00:00 2001
|
|
|
e87a70 |
From: Reid Wahl <nrwahl@protonmail.com>
|
|
|
e87a70 |
Date: Thu, 17 Feb 2022 03:53:21 -0800
|
|
|
e87a70 |
Subject: [PATCH] IPsrcaddr: Better error message when no matching route found
|
|
|
e87a70 |
|
|
|
e87a70 |
If OCF_RESKEY_destination is not explicitly set and `ip route list`
|
|
|
e87a70 |
can't find a route matching the specifications, the NETWORK variable
|
|
|
e87a70 |
doesn't get set. This causes a certain failure of the start operation,
|
|
|
e87a70 |
because there is no PREFIX argument to `ip route replace` (syntax
|
|
|
e87a70 |
error). It may also cause unexpected behavior for stop operations (but
|
|
|
e87a70 |
not in all cases). During a monitor, this event can only happen if
|
|
|
e87a70 |
something has changed outside the cluster's control, and so is cause
|
|
|
e87a70 |
for warning there.
|
|
|
e87a70 |
|
|
|
e87a70 |
Exit OCF_ERR_ARGS for start, log debug for probe, log warning for all
|
|
|
e87a70 |
other ops.
|
|
|
e87a70 |
|
|
|
e87a70 |
Resolves: RHBZ#1654862
|
|
|
e87a70 |
|
|
|
e87a70 |
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
|
|
e87a70 |
---
|
|
|
e87a70 |
heartbeat/IPsrcaddr | 14 ++++++++++++++
|
|
|
e87a70 |
1 file changed, 14 insertions(+)
|
|
|
e87a70 |
|
|
|
e87a70 |
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
|
|
|
e87a70 |
index fd7b6f68d..f0216722d 100755
|
|
|
e87a70 |
--- a/heartbeat/IPsrcaddr
|
|
|
e87a70 |
+++ b/heartbeat/IPsrcaddr
|
|
|
e87a70 |
@@ -549,6 +549,20 @@ rc=$?
|
|
|
e87a70 |
INTERFACE=`echo $findif_out | awk '{print $1}'`
|
|
|
e87a70 |
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
|
|
e87a70 |
NETWORK=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress|grep -m 1 -o '^[^ ]*'`
|
|
|
e87a70 |
+
|
|
|
e87a70 |
+ if [ -z "$NETWORK" ]; then
|
|
|
e87a70 |
+ err_str="command '$IP2UTIL route list dev $INTERFACE scope link $PROTO"
|
|
|
e87a70 |
+ err_str="$err_str match $ipaddress' failed to find a matching route"
|
|
|
e87a70 |
+
|
|
|
e87a70 |
+ if [ "$__OCF_ACTION" = "start" ]; then
|
|
|
e87a70 |
+ ocf_exit_reason "$err_str"
|
|
|
e87a70 |
+ exit $OCF_ERR_ARGS
|
|
|
e87a70 |
+ elif ! ocf_is_probe; then
|
|
|
e87a70 |
+ ocf_log warn "$err_str"
|
|
|
e87a70 |
+ else
|
|
|
e87a70 |
+ ocf_log debug "$err_str"
|
|
|
e87a70 |
+ fi
|
|
|
e87a70 |
+ fi
|
|
|
e87a70 |
else
|
|
|
e87a70 |
NETWORK="$OCF_RESKEY_destination"
|
|
|
e87a70 |
fi
|