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

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