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

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