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

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