File 0001-SAPInstance-introduce-MINIMAL_PROBE-resource-paramet.patch of Package resource-agents.21369
From 0ecd1935f333293dbef4f39e1a677424e8097d85 Mon Sep 17 00:00:00 2001
From: fmherschel <fh-github@herschel-mainz.org>
Date: Fri, 23 Oct 2020 09:45:42 +0200
Subject: [PATCH 1/1] SAPInstance - introduce MINIMAL_PROBE resource parameter
(#1564)
* SAPInstance: lightweight probe without starting sapstartsrv for probes in simply mount environemnts
* SAPInstance MINIMAL_PROBE parameter to allow special file system set-ups
---
heartbeat/SAPInstance | 58 ++++++++++++++++++++++++++++++-------------
1 file changed, 41 insertions(+), 17 deletions(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 47e1d095..8c404d43 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -17,21 +17,22 @@
# See usage() function below for more details...
#
# OCF instance parameters:
-# OCF_RESKEY_InstanceName
-# OCF_RESKEY_DIR_EXECUTABLE (optional, well known directories will be searched by default)
-# OCF_RESKEY_DIR_PROFILE (optional, well known directories will be searched by default)
-# OCF_RESKEY_START_PROFILE (optional, well known directories will be searched by default)
-# OCF_RESKEY_START_WAITTIME (optional, to solve timing problems during J2EE-Addin start)
-# OCF_RESKEY_AUTOMATIC_RECOVER (optional, automatic startup recovery using cleanipc, default is false)
-# OCF_RESKEY_MONITOR_SERVICES (optional, default is to monitor critical services only)
-# OCF_RESKEY_SHUTDOWN_METHOD (optional, defaults to NORMAL, KILL: terminate the SAP instance with OS commands - faster, at your own risk)
-# OCF_RESKEY_ERS_InstanceName (optional, InstanceName of the ERS instance in a Master/Slave configuration)
-# OCF_RESKEY_ERS_START_PROFILE (optional, START_PROFILE of the ERS instance in a Master/Slave configuration)
-# OCF_RESKEY_PRE_START_USEREXIT (optional, lists a script which can be executed before the resource is started)
-# OCF_RESKEY_POST_START_USEREXIT (optional, lists a script which can be executed after the resource is started)
-# OCF_RESKEY_PRE_STOP_USEREXIT (optional, lists a script which can be executed before the resource is stopped)
-# OCF_RESKEY_POST_STOP_USEREXIT (optional, lists a script which can be executed after the resource is stopped)
-# OCF_RESKEY_IS_ERS (needed for ENQ/REPL NW 740)
+# OCF_RESKEY_InstanceName
+# OCF_RESKEY_DIR_EXECUTABLE (optional, well known directories will be searched by default)
+# OCF_RESKEY_DIR_PROFILE (optional, well known directories will be searched by default)
+# OCF_RESKEY_START_PROFILE (optional, well known directories will be searched by default)
+# OCF_RESKEY_START_WAITTIME (optional, to solve timing problems during J2EE-Addin start)
+# OCF_RESKEY_AUTOMATIC_RECOVER (optional, automatic startup recovery using cleanipc, default is false)
+# OCF_RESKEY_MONITOR_SERVICES (optional, default is to monitor critical services only)
+# OCF_RESKEY_SHUTDOWN_METHOD (optional, defaults to NORMAL, KILL: terminate the SAP instance with OS commands - faster, at your own risk)
+# OCF_RESKEY_ERS_InstanceName (optional, InstanceName of the ERS instance in a Master/Slave configuration)
+# OCF_RESKEY_ERS_START_PROFILE (optional, START_PROFILE of the ERS instance in a Master/Slave configuration)
+# OCF_RESKEY_PRE_START_USEREXIT (optional, lists a script which can be executed before the resource is started)
+# OCF_RESKEY_POST_START_USEREXIT (optional, lists a script which can be executed after the resource is started)
+# OCF_RESKEY_PRE_STOP_USEREXIT (optional, lists a script which can be executed before the resource is stopped)
+# OCF_RESKEY_POST_STOP_USEREXIT (optional, lists a script which can be executed after the resource is stopped)
+# OCF_RESKEY_IS_ERS (needed for ENQ/REPL NW 740)
+# OCF_RESKEY_MINIMAL_PROBE (optional but needed for simple mount structure architecure)
#
# TODO: - Option to shutdown sapstartsrv for non-active instances -> that means: do probes only with OS tools (sapinstance_status)
# - Option for better standalone enqueue server monitoring, using ensmon (test enque-deque)
@@ -60,6 +61,7 @@ OCF_RESKEY_POST_START_USEREXIT_default=""
OCF_RESKEY_PRE_STOP_USEREXIT_default=""
OCF_RESKEY_POST_STOP_USEREXIT_default=""
OCF_RESKEY_IS_ERS_default="false"
+OCF_RESKEY_MINIMAL_PROBE_default="false"
: ${OCF_RESKEY_InstanceName=${OCF_RESKEY_InstanceName_default}}
: ${OCF_RESKEY_DIR_EXECUTABLE=${OCF_RESKEY_DIR_EXECUTABLE_default}}
@@ -76,6 +78,7 @@ OCF_RESKEY_IS_ERS_default="false"
: ${OCF_RESKEY_PRE_STOP_USEREXIT=${OCF_RESKEY_PRE_STOP_USEREXIT_default}}
: ${OCF_RESKEY_POST_STOP_USEREXIT=${OCF_RESKEY_POST_STOP_USEREXIT_default}}
: ${OCF_RESKEY_IS_ERS=${OCF_RESKEY_IS_ERS_default}}
+: ${OCF_RESKEY_IS_MINIMAL_PROBE=${OCF_RESKEY_IS_MINIMAL_PROBE_default}}
#######################################################################
@@ -248,6 +251,14 @@ The name of the SAP START profile. Specify this parameter, if you have changed t
<shortdesc lang="en">Mark SAPInstance as ERS instance</shortdesc>
<content type="boolean" default="${OCF_RESKEY_IS_ERS_default}" />
</parameter>
+ <parameter name="MINIMAL_PROBE" unique="0" required="0">
+ <longdesc lang="en">Setting MINIMAL_PROBE=true forces the resource agent to do only minimal check during a probe. This is needed for special
+ file system setups. The MINIMAL_PROBE=true is only supported, if requested either by your vendor's support or if described in an architecture document
+ from your HA vendor.
+ </longdesc>
+ <shortdesc lang="en">Switch probe action from full to minimal check</shortdesc>
+ <content type="boolean" default="${OCF_RESKEY_MINIMAL_PROBE_default}" />
+ </parameter>
</parameters>
<actions>
@@ -710,8 +721,21 @@ sapinstance_monitor() {
local MONLOG=$1
local rc
- check_sapstartsrv
- rc=$?
+ if ocf_is_probe && ocf_is_true "$OCF_RESKEY_MINIMAL_PROBE"; then
+ # code for minimal probe: # grep for sapstartsrv and maybe also for sapstart
+ # TODO: Do we need to improve this minimal test?
+ if pgrep -f -l "sapstartsrv .*pf=.*${SID}_${InstanceName}_${SAPVIRHOST}"; then
+ rc="$OCF_SUCCESS"
+ elif pgrep -f -l "sapstart .*pf=.*${SID}_${InstanceName}_${SAPVIRHOST}"; then
+ rc="$OCF_SUCCESS"
+ else
+ rc="$OCF_NOT_RUNNING"
+ fi
+ else
+ # standard probe and monitoring code
+ check_sapstartsrv
+ rc=$?
+ fi
if [ $rc -eq $OCF_SUCCESS ]
then
--
2.26.2