Blame SOURCES/bz1624741-1-aws-vpc-move-ip-avoid-false-positive-monitor.patch

7b144c
From 7632a85bcf642b484df52a25dbffbfa0031421bc Mon Sep 17 00:00:00 2001
7b144c
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
7b144c
Date: Mon, 6 Aug 2018 18:04:52 +0200
7b144c
Subject: [PATCH] aws-vpc-move-ip: Use ip utility to check address
7b144c
7b144c
When pinging the assigned address during initial monitor (probe) on one
7b144c
node we may actually ping the reachable address when the resource is
7b144c
running on another node. This yields false positive monitor result on
7b144c
the pinging node. Avoid this by merely checking the assignment of the
7b144c
address to an interface.
7b144c
---
7b144c
 heartbeat/aws-vpc-move-ip | 10 +++++-----
7b144c
 1 file changed, 5 insertions(+), 5 deletions(-)
7b144c
7b144c
diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip
7b144c
index cefa38e03..3bbbed474 100755
7b144c
--- a/heartbeat/aws-vpc-move-ip
7b144c
+++ b/heartbeat/aws-vpc-move-ip
7b144c
@@ -167,15 +167,15 @@ ec2ip_monitor() {
7b144c
 		ocf_log debug "monitor: Enhanced Monitoring disabled - omitting API call"
7b144c
 	fi
7b144c
 
7b144c
-	cmd="ping -W 1 -c 1 $OCF_RESKEY_ip"
7b144c
+	cmd="ip addr show to '$OCF_RESKEY_ip' up"
7b144c
 	ocf_log debug "executing command: $cmd"
7b144c
-	$cmd > /dev/null
7b144c
-	if [ "$?" -gt 0 ]; then
7b144c
-		ocf_log warn "IP $OCF_RESKEY_ip not locally reachable via ping on this system"
7b144c
+	RESULT=$($cmd | grep '$OCF_RESKEY_ip')
7b144c
+	if [ -z "$RESULT" ]; then
7b144c
+		ocf_log warn "IP $OCF_RESKEY_ip not assigned to running interface"
7b144c
 		return $OCF_NOT_RUNNING
7b144c
 	fi
7b144c
 
7b144c
-	ocf_log debug "route in VPC and locally reachable"
7b144c
+	ocf_log debug "route in VPC and address assigned"
7b144c
 	return $OCF_SUCCESS
7b144c
 }
7b144c