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

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