Blame SOURCES/bz1718219-podman-1-avoid-double-inspect-call.patch

a89620
From d8400a30604229d349f36855c30a6a438204023b Mon Sep 17 00:00:00 2001
a89620
From: Michele Baldessari <michele@acksyn.org>
a89620
Date: Wed, 12 Jun 2019 11:29:17 +0200
a89620
Subject: [PATCH] Avoid double call to podman inspect in podman_simple_status()
a89620
a89620
Right now podman_simple_status() does the following:
a89620
- It calls container_exists() which then calls "podman inspect --format {{.State.Running}} $CONTAINER | egrep '(true|false)' >/dev/null 2>&1"
a89620
- Then it calls "podman inspect --format {{.State.Running}} $CONTAINER 2>/dev/null"
a89620
a89620
This duplication is unnecessary and we can rely on the second podman inspect
a89620
call.  We need to do this because podman inspect calls are very expensive as
a89620
soon as moderate I/O kicks in.
a89620
a89620
Tested as follows:
a89620
1) Injected the change on an existing bundle-based cluster
a89620
2) Observed that monitoring operations kept working okay
a89620
3) Verified by adding set -x that only a single podman inspect per monitor
a89620
   operation was called (as opposed to two before)
a89620
4) Restarted a bundle with an OCF resource inside correctly
a89620
5) Did a podman stop of a bundle and correctly observed that:
a89620
5.a) It was detected as non running:
a89620
* haproxy-bundle-podman-1_monitor_60000 on controller-0 'not running' (7): call=192, status=complete, exitreason='',
a89620
    last-rc-change='Wed Jun 12 09:22:18 2019', queued=0ms, exec=0ms
a89620
5.b) It was correctly started afterwards
a89620
a89620
Signed-off-by: Michele Baldessari <michele@acksyn.org>
a89620
---
a89620
 heartbeat/podman | 5 -----
a89620
 1 file changed, 5 deletions(-)
a89620
a89620
diff --git a/heartbeat/podman b/heartbeat/podman
a89620
index 34e11da6b..b2b3081f9 100755
a89620
--- a/heartbeat/podman
a89620
+++ b/heartbeat/podman
a89620
@@ -238,11 +238,6 @@ podman_simple_status()
a89620
 {
a89620
 	local val
a89620
 
a89620
-	container_exists
a89620
-	if [ $? -ne 0 ]; then
a89620
-		return $OCF_NOT_RUNNING
a89620
-	fi
a89620
-
a89620
 	# retrieve the 'Running' attribute for the container
a89620
 	val=$(podman inspect --format {{.State.Running}} $CONTAINER 2>/dev/null)
a89620
 	if [ $? -ne 0 ]; then