File 0007-LVM-activate-return-OCF_NOT_RUNNING-on-initial-probe.patch of Package resource-agents

From 6934468b115902ea2662edb3a3e8fc1d877ffa79 Mon Sep 17 00:00:00 2001
From: Roger Zhou <zzhou@suse.com>
Date: Mon, 1 Apr 2019 22:57:26 +0800
Subject: [PATCH] LVM-activate: return OCF_NOT_RUNNING on initial probe

In the use case of lvm on top of cluster md/raid. When the fenced node
rejoins to the cluster, Pacemaker will run the monitor action for the
probe operation. At that time, LVM PV and VG won't exist before cluster
md/raid get assembled, and the probe should return $OCF_NOT_RUNNING
instead of $OCF_ERR_CONFIGURED.

Signed-off-by: Roger Zhou <zzhou@suse.com>
---
 heartbeat/LVM-activate | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
index 3c462c75..854ae3fa 100755
--- a/heartbeat/LVM-activate
+++ b/heartbeat/LVM-activate
@@ -329,6 +329,7 @@ lvmlockd_check()
 	# Good: lvmlockd is running, and clvmd is not running
 	if ! pgrep lvmlockd >/dev/null 2>&1 ; then
 		if ocf_is_probe; then
+			ocf_log info "initial probe: lvmlockd is not running yet."
 			exit $OCF_NOT_RUNNING
 		fi
 
@@ -481,6 +482,11 @@ lvm_validate() {
 			exit $OCF_SUCCESS
 		fi
 
+		if ocf_is_probe; then
+			ocf_log info "initial probe: VG [${VG}] doesn't exist on any block device yet."
+			exit $OCF_NOT_RUNNING
+		fi
+
 		ocf_exit_reason "Volume group[${VG}] doesn't exist, or not visible on this node!"
 		exit $OCF_ERR_CONFIGURED
 	fi
-- 
2.12.3