import sources

This commit is contained in:
Adam Samalik 2023-05-10 10:00:12 +02:00
commit 8ebbea0d5f
11 changed files with 681 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/ClusterLabs-resource-agents-e711383f.tar.gz
/sap_cluster_connector-0015fe2.tar.gz

View File

@ -0,0 +1,92 @@
From 70a28e8130be863a9073b0a80e0511e971e205c4 Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Fri, 27 Jul 2018 12:33:19 +0200
Subject: [PATCH 1/2] SAPInstance: implemeted reload method The reload method
is needed to avoid resource restarts after a non-unique parameter has been
changed. This is in special for interest of the MONITOR_SERVICES parameter.
---
heartbeat/SAPInstance | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 8de7cee8c..c25839f0c 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -61,6 +61,7 @@ sapinstance_usage() {
The 'monitor' operation reports whether the instance seems to be working
The 'promote' operation starts the primary instance in a Master/Slave configuration
The 'demote' operation stops the primary instance and starts the ERS instance
+ The 'reload' operation allows changed parameters (non-unique only) without restarting the service
The 'notify' operation always returns SUCCESS
The 'validate-all' operation reports whether the parameters are valid
The 'methods' operation reports on the methods $0 supports
@@ -224,6 +225,7 @@ The name of the SAP START profile. Specify this parameter, if you have changed t
<action name="monitor" depth="0" timeout="60s" interval="119s" role="Master" />
<action name="promote" timeout="320s" />
<action name="demote" timeout="320s" />
+<action name="reload" timeout="320" />
<action name="validate-all" timeout="5s" />
<action name="meta-data" timeout="5s" />
<action name="methods" timeout="5s" />
@@ -244,6 +246,7 @@ sapinstance_methods() {
monitor
promote
demote
+ reload
notify
validate-all
methods
@@ -965,6 +968,9 @@ case "$ACTION" in
exit $?;;
validate-all) sapinstance_validate
exit $?;;
+ reload )
+ ocf_log info "reloading SAPInstance parameters"
+ exit $OCF_SUCCESS;;
*) sapinstance_methods
exit $OCF_ERR_UNIMPLEMENTED;;
esac
From ee529b088cc1111656e94dea56b9fcfa6d813313 Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Fri, 27 Jul 2018 13:02:39 +0200
Subject: [PATCH 2/2] SAPInstance: Improved indents
---
heartbeat/SAPInstance | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index c25839f0c..174ea36ef 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -61,7 +61,7 @@ sapinstance_usage() {
The 'monitor' operation reports whether the instance seems to be working
The 'promote' operation starts the primary instance in a Master/Slave configuration
The 'demote' operation stops the primary instance and starts the ERS instance
- The 'reload' operation allows changed parameters (non-unique only) without restarting the service
+ The 'reload' operation allows changed parameters (non-unique only) without restarting the service
The 'notify' operation always returns SUCCESS
The 'validate-all' operation reports whether the parameters are valid
The 'methods' operation reports on the methods $0 supports
@@ -246,7 +246,7 @@ sapinstance_methods() {
monitor
promote
demote
- reload
+ reload
notify
validate-all
methods
@@ -969,8 +969,8 @@ case "$ACTION" in
validate-all) sapinstance_validate
exit $?;;
reload )
- ocf_log info "reloading SAPInstance parameters"
- exit $OCF_SUCCESS;;
+ ocf_log info "reloading SAPInstance parameters"
+ exit $OCF_SUCCESS;;
*) sapinstance_methods
exit $OCF_ERR_UNIMPLEMENTED;;
esac

View File

@ -0,0 +1,26 @@
From 8eda4725a946ca669df035ed0ffdf053a65e1258 Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Thu, 2 Aug 2018 15:36:31 +0200
Subject: [PATCH] SAPInstance: Improved SAP instance profile detection
---
heartbeat/SAPInstance | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 174ea36ef..eb058cccf 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -371,7 +371,11 @@ sapinstance_init() {
if [ -z "$currentSTART_PROFILE" ]
then
- SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}"
+ if [ ! -r "$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}" -a -r "$DIR_PROFILE/${SID}_${InstanceName}_${SAPVIRHOST}" ]; then
+ SAPSTARTPROFILE="$DIR_PROFILE/${SID}_${InstanceName}_${SAPVIRHOST}"
+ else
+ SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}"
+ fi
else
SAPSTARTPROFILE="$currentSTART_PROFILE"
fi

View File

@ -0,0 +1,37 @@
--- a/heartbeat/SAPInstance 2019-02-20 12:42:55.655819263 +0100
+++ b/heartbeat/SAPInstance 2019-02-08 10:57:02.281048136 +0100
@@ -159,14 +159,14 @@
<content type="string" default="disp+work|msg_server|enserver|enrepserver|jcontrol|jstart|enq_server|enq_replicator"/>
</parameter>
<parameter name="SHUTDOWN_METHOD" unique="0" required="0">
- <longdesc lang="en">Usual a SAP Instance is stopped by the command 'sapcontrol -nr InstanceNr -function Stop'. SHUTDOWN_METHOD=KILL means to kill the SAP Instance using OS commands. SAP processes of the instance are terminated with 'kill -9', shared memory is deleted with 'cleanipc' and the 'kill.sap' file will be deleted. That method is much faster than the gracefull stop, but the instance does not have the chance to say goodbye to other SAPinstances in the same system. USE AT YOUR OWN RISK !!</longdesc>
+ <longdesc lang="en">Usually a SAP Instance is stopped by the command 'sapcontrol -nr InstanceNr -function Stop'. SHUTDOWN_METHOD=KILL means to kill the SAP Instance using OS commands. SAP processes of the instance are terminated with 'kill -9', shared memory is deleted with 'cleanipc' and the 'kill.sap' file will be deleted. That method is much faster than the graceful stop, but the instance does not have the chance to say goodbye to other SAPinstances in the same system. USE AT YOUR OWN RISK !!</longdesc>
<shortdesc lang="en">Shutdown graceful or kill a SAP instance by terminating the processes. (normal|KILL)</shortdesc>
<content type="string" default="normal"/>
</parameter>
<parameter name="ERS_InstanceName" unique="1" required="0">
<longdesc lang="en">Only used in a Master/Slave resource configuration:
The full qualified SAP enqueue replication instance name. e.g. P01_ERS02_sapp01ers. Usually this is the name of the SAP instance profile.
-The enqueue replication instance must be installed, before you want to configure a master-slave cluster recource.
+The enqueue replication instance must be installed, before you want to configure a master-slave cluster resource.
The master-slave configuration in the cluster must use this properties:
clone_max = 2
@@ -209,7 +209,7 @@
<longdesc lang="en">Only used for ASCS/ERS SAP Netweaver installations without implementing a master/slave resource to
allow the ASCS to 'find' the ERS running on another cluster node after a resource failure. This parameter should be set
to true 'only' for the ERS instance for implementations following the SAP NetWeaver 7.40 HA certification (NW-HA-CLU-740). This includes also
- systems for NetWeaver less than 7.40, if you like to impelemnt the NW-HA-CLU-740 scenario.
+ systems for NetWeaver less than 7.40, if you like to implement the NW-HA-CLU-740 scenario.
</longdesc>
<shortdesc lang="en">Mark SAPInstance as ERS instance</shortdesc>
<content type="boolean" default="false" />
@@ -225,7 +225,7 @@
<action name="monitor" depth="0" timeout="60s" interval="119s" role="Master" />
<action name="promote" timeout="320s" />
<action name="demote" timeout="320s" />
-<action name="reload" timeout="320" />
+<action name="reload" timeout="320s" />
<action name="validate-all" timeout="5s" />
<action name="meta-data" timeout="5s" />
<action name="methods" timeout="5s" />

View File

@ -0,0 +1,44 @@
diff -uNr a/heartbeat/ClusterMon b/heartbeat/ClusterMon
--- a/heartbeat/ClusterMon 2018-06-29 14:05:02.000000000 +0200
+++ b/heartbeat/ClusterMon 2020-03-27 12:09:23.636845893 +0100
@@ -86,7 +86,7 @@
PID file location to ensure only one instance is running
</longdesc>
<shortdesc lang="en">PID file</shortdesc>
-<content type="string" default="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid" />
+<content type="string" default="${HA_RSCTMP}/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid" />
</parameter>
<parameter name="htmlfile" unique="1" required="0">
@@ -94,7 +94,7 @@
Location to write HTML output to.
</longdesc>
<shortdesc lang="en">HTML output</shortdesc>
-<content type="string" default="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.html" />
+<content type="string" default="${HA_RSCTMP}/ClusterMon_${OCF_RESOURCE_INSTANCE}.html" />
</parameter>
</parameters>
@@ -233,8 +233,8 @@
fi
: ${OCF_RESKEY_update:="15000"}
-: ${OCF_RESKEY_pidfile:="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid"}
-: ${OCF_RESKEY_htmlfile:="/tmp/ClusterMon_${OCF_RESOURCE_INSTANCE}.html"}
+: ${OCF_RESKEY_pidfile:="${HA_RSCTMP}/ClusterMon_${OCF_RESOURCE_INSTANCE}.pid"}
+: ${OCF_RESKEY_htmlfile:="${HA_RSCTMP}/ClusterMon_${OCF_RESOURCE_INSTANCE}.html"}
OCF_RESKEY_update=`expr $OCF_RESKEY_update / 1000`
diff -uNr a/heartbeat/sapdb-nosha.sh b/heartbeat/sapdb-nosha.sh
--- a/heartbeat/sapdb-nosha.sh 2018-06-29 14:05:02.000000000 +0200
+++ b/heartbeat/sapdb-nosha.sh 2020-03-27 12:07:16.183958164 +0100
@@ -740,5 +740,5 @@
}
# Set a tempfile and make sure to clean it up again
-TEMPFILE="/tmp/SAPDatabase.$$.tmp"
-trap trap_handler INT TERM
\ No newline at end of file
+TEMPFILE="${HA_RSCTMP}/SAPDatabase.$$.tmp"
+trap trap_handler INT TERM

View File

@ -0,0 +1,41 @@
From d6b954890b496fcdd8a76d7c2dd44a36fa0ad42c Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 7 Oct 2021 11:10:16 +0200
Subject: [PATCH 1/3] all agents: specify agent and OCF versions corrently in
metadata
---
heartbeat/SAPDatabase | 4 ++--
heartbeat/SAPInstance | 4 ++--
133 files changed, 169 insertions(+), 169 deletions(-)
diff --git a/heartbeat/SAPDatabase b/heartbeat/SAPDatabase
index 3486303f10..563a6f3469 100755
--- a/heartbeat/SAPDatabase
+++ b/heartbeat/SAPDatabase
@@ -109,8 +109,8 @@ meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPDatabase">
-<version>2.14</version>
+<resource-agent name="SAPDatabase" version="2.14">
+<version>1.0</version>
<longdesc lang="en">
Resource script for SAP databases. It manages a SAP database of any type as an HA resource.
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index f8bcbc05b8..016f59aff2 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -110,8 +110,8 @@ sapinstance_meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPInstance">
-<version>2.14</version>
+<resource-agent name="SAPInstance" version="2.14">
+<version>1.0</version>
<longdesc lang="en">
Usually a SAP system consists of one database and at least one or more SAP instances (sometimes called application servers). One SAP Instance is defined by having exactly one instance profile. The instance profiles can usually be found in the directory /sapmnt/SID/profile. Each instance must be configured as it's own resource in the cluster configuration.

View File

@ -0,0 +1,196 @@
From 2d50c76c366df4e6021c2992e085bbc48fa112b0 Mon Sep 17 00:00:00 2001
From: fmherschel <fh-github@herschel-mainz.org>
Date: Fri, 25 Jun 2021 16:16:51 +0200
Subject: [PATCH] SAPInstance: add systemd compatability (#1662)
* SAPInstance: for systemd integrated sapstartsrv instances use systemd to check/start the service
---
heartbeat/SAPInstance | 146 ++++++++++++++++++++++++++----------------
1 file changed, 91 insertions(+), 55 deletions(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 8c404d4376..15b24024e0 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -369,6 +369,7 @@ sapinstance_init() {
InstanceName=`echo "$myInstanceName" | cut -d_ -f2`
InstanceNr=`echo "$InstanceName" | sed 's/.*\([0-9][0-9]\)$/\1/'`
SAPVIRHOST=`echo "$myInstanceName" | cut -d_ -f3`
+ SYSTEMCTL="systemctl"
# optional OCF parameters, we try to guess which directories are correct
if [ -z "$OCF_RESKEY_DIR_EXECUTABLE" ]
@@ -446,6 +447,25 @@ sapinstance_init() {
return $OCF_SUCCESS
}
+#
+# check_systemd_integration : Check, if SAP instance is controlled by systemd unit file SAP<SID>_<InstanceNr>.service
+# rc == 0 : sap instance is controlled by the unit file (file at least exists)
+# rc == 1 : sap instance is NOT controlled by the unit file (file does not exist)
+#
+check_systemd_integration() {
+ local systemd_unit_name="SAP${SID}_${InstanceNr}"
+ local rc=1
+
+ if [ -x "$SYSTEMCTL" ]; then
+ if $SYSTEMCTL list-unit-files | \
+ awk '$1 == service { found=1 } END { if (! found) {exit 1}}' service="${systemd_unit_name}.service"; then
+ rc=0
+ else
+ rc=1
+ fi
+ fi
+ return "$rc"
+}
#
# check_sapstartsrv : Before using sapcontrol we make sure that the sapstartsrv is running for the correct instance.
@@ -458,76 +478,92 @@ check_sapstartsrv() {
local chkrc=$OCF_SUCCESS
local output=""
- if [ ! -S /tmp/.sapstream5${InstanceNr}13 ]; then
- ocf_log warn "sapstartsrv is not running for instance $SID-$InstanceName (no UDS), it will be started now"
- restart=1
- else
- output=`$SAPCONTROL -nr $InstanceNr -function ParameterValue INSTANCE_NAME -format script`
- if [ $? -eq 0 ]
- then
- runninginst=`echo "$output" | grep '^0 : ' | cut -d' ' -f3`
- if [ "$runninginst" != "$InstanceName" ]
- then
- ocf_log warn "sapstartsrv is running for instance $runninginst, that service will be killed"
+ # check for sapstartsrv/systemd integration
+
+ if check_systemd_integration; then
+ # do it the systemd way
+ local systemd_unit_name="SAP${SID}_${InstanceNr}"
+
+ if $SYSTEMCTL status "$systemd_unit_name" 1>/dev/null 2>/dev/null; then
+ ocf_log info "systemd service $systemd_unit_name is active"
+ else
+ ocf_log warn "systemd service $systemd_unit_name is not active, it will be started using systemd"
+ $SYSTEMCTL start "$systemd_unit_name" 1>/dev/null 2>/dev/null
+ # use start, because restart does also stop sap instance
+ fi
+
+ return 0
+ else # otherwise continue with old code...
+ if [ ! -S /tmp/.sapstream5${InstanceNr}13 ]; then
+ ocf_log warn "sapstartsrv is not running for instance $SID-$InstanceName (no UDS), it will be started now"
restart=1
else
- output=`$SAPCONTROL -nr $InstanceNr -function AccessCheck Start`
- if [ $? -ne 0 ]; then
- ocf_log warn "FAILED : sapcontrol -nr $InstanceNr -function AccessCheck Start (`ls -ld1 /tmp/.sapstream5${InstanceNr}13`)"
- ocf_log warn "sapstartsrv will be restarted to try to solve this situation, otherwise please check sapstsartsrv setup (SAP Note 927637)"
+ output=`$SAPCONTROL -nr $InstanceNr -function ParameterValue INSTANCE_NAME -format script`
+ if [ $? -eq 0 ]
+ then
+ runninginst=`echo "$output" | grep '^0 : ' | cut -d' ' -f3`
+ if [ "$runninginst" != "$InstanceName" ]
+ then
+ ocf_log warn "sapstartsrv is running for instance $runninginst, that service will be killed"
+ restart=1
+ else
+ output=`$SAPCONTROL -nr $InstanceNr -function AccessCheck Start`
+ if [ $? -ne 0 ]; then
+ ocf_log warn "FAILED : sapcontrol -nr $InstanceNr -function AccessCheck Start (`ls -ld1 /tmp/.sapstream5${InstanceNr}13`)"
+ ocf_log warn "sapstartsrv will be restarted to try to solve this situation, otherwise please check sapstsartsrv setup (SAP Note 927637)"
+ restart=1
+ fi
+ fi
+ else
+ ocf_log warn "sapstartsrv is not running for instance $SID-$InstanceName, it will be started now"
restart=1
fi
fi
- else
- ocf_log warn "sapstartsrv is not running for instance $SID-$InstanceName, it will be started now"
- restart=1
- fi
- fi
- if [ -z "$runninginst" ]; then runninginst=$InstanceName; fi
+ if [ -z "$runninginst" ]; then runninginst=$InstanceName; fi
- if [ $restart -eq 1 ]
- then
+ if [ $restart -eq 1 ]
+ then
+ if [ -d /usr/sap/$SID/SYS/profile/ ]
+ then
+ DIR_PROFILE="/usr/sap/$SID/SYS/profile"
+ else
+ abnormal_end "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!"
+ fi
- if [ -d /usr/sap/$SID/SYS/profile/ ]
- then
- DIR_PROFILE="/usr/sap/$SID/SYS/profile"
- else
- abnormal_end "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!"
- fi
+ [ ! -r $SAPSTARTPROFILE ] && abnormal_end "Expected $SAPSTARTPROFILE to be the instance START profile, please set START_PROFILE parameter!"
- [ ! -r $SAPSTARTPROFILE ] && abnormal_end "Expected $SAPSTARTPROFILE to be the instance START profile, please set START_PROFILE parameter!"
+ pkill -9 -f "sapstartsrv.*$runninginst"
- pkill -9 -f "sapstartsrv.*$runninginst"
+ # removing the unix domain socket files as they might have wrong permissions
+ # or ownership - they will be recreated by sapstartsrv during next start
+ rm -f /tmp/.sapstream5${InstanceNr}13
+ rm -f /tmp/.sapstream5${InstanceNr}14
- # removing the unix domain socket files as they might have wrong permissions
- # or ownership - they will be recreated by sapstartsrv during next start
- rm -f /tmp/.sapstream5${InstanceNr}13
- rm -f /tmp/.sapstream5${InstanceNr}14
+ $SAPSTARTSRV pf=$SAPSTARTPROFILE -D -u $sidadm
- $SAPSTARTSRV pf=$SAPSTARTPROFILE -D -u $sidadm
+ # now make sure the daemon has been started and is able to respond
+ local srvrc=1
+ while [ $srvrc -eq 1 -a `pgrep -f "sapstartsrv.*$runninginst" | wc -l` -gt 0 ]
+ do
+ sleep 1
+ $SAPCONTROL -nr $InstanceNr -function GetProcessList > /dev/null 2>&1
+ srvrc=$?
+ done
- # now make sure the daemon has been started and is able to respond
- local srvrc=1
- while [ $srvrc -eq 1 -a `pgrep -f "sapstartsrv.*$runninginst" | wc -l` -gt 0 ]
- do
- sleep 1
- $SAPCONTROL -nr $InstanceNr -function GetProcessList > /dev/null 2>&1
- srvrc=$?
- done
+ if [ $srvrc -ne 1 ]
+ then
+ ocf_log info "sapstartsrv for instance $SID-$InstanceName was restarted !"
+ chkrc=$OCF_SUCCESS
+ else
+ ocf_log error "sapstartsrv for instance $SID-$InstanceName could not be started!"
+ chkrc=$OCF_ERR_GENERIC
+ ocf_is_probe && chkrc=$OCF_NOT_RUNNING
+ fi
+ fi
- if [ $srvrc -ne 1 ]
- then
- ocf_log info "sapstartsrv for instance $SID-$InstanceName was restarted !"
- chkrc=$OCF_SUCCESS
- else
- ocf_log error "sapstartsrv for instance $SID-$InstanceName could not be started!"
- chkrc=$OCF_ERR_GENERIC
- ocf_is_probe && chkrc=$OCF_NOT_RUNNING
- fi
+ return $chkrc
fi
-
- return $chkrc
}

View File

@ -0,0 +1,24 @@
From 9a851525c30a4bdb522e64301268c9ef2188ae83 Mon Sep 17 00:00:00 2001
From: fmherschel <fh-github@herschel-mainz.org>
Date: Mon, 9 Aug 2021 11:57:22 +0200
Subject: [PATCH] SAPInstance: Fix for issue #1680 - SAPInstance fails to
detect systemd integration (#1681)
* SAPInstance: Fix for issue #1680 - SAPInstance fails to detect systemd integration
---
heartbeat/SAPInstance | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 15b24024e..f8bcbc05b 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -456,7 +456,7 @@ check_systemd_integration() {
local systemd_unit_name="SAP${SID}_${InstanceNr}"
local rc=1
- if [ -x "$SYSTEMCTL" ]; then
+ if which "$SYSTEMCTL" 1>/dev/null 2>/dev/null; then
if $SYSTEMCTL list-unit-files | \
awk '$1 == service { found=1 } END { if (! found) {exit 1}}' service="${systemd_unit_name}.service"; then
rc=0

View File

@ -0,0 +1,46 @@
From 08ed464aa803f03cbb6cabc79afe462fc98ad213 Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Mon, 5 Dec 2022 18:13:36 +0100
Subject: [PATCH 1/2] SAPInstance: be more resilient against broken kill.sap
files
---
heartbeat/SAPInstance | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index e3fe788ae..fbf6c5245 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -830,7 +830,7 @@ sapinstance_status() {
local pids
[ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
- pids=`grep '^kill -[0-9]' /usr/sap/$SID/$InstanceName/work/kill.sap | awk '{print $3}'`
+ pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
for pid in $pids
do
[ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS
From a7153dd3f31fe5a14bf76d367cd8185848821fcd Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Tue, 6 Dec 2022 09:15:56 +0100
Subject: [PATCH 2/2] SAPInstance: Also need the begin-end markers
---
heartbeat/SAPInstance | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index fbf6c5245..26fd54136 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -830,7 +830,7 @@ sapinstance_status() {
local pids
[ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
- pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
+ pids=$(awk '$3 ~ "^[0-9]+$" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
for pid in $pids
do
[ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS

171
resource-agents-sap.spec Normal file
View File

@ -0,0 +1,171 @@
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Below is the script used to generate a new source file
# from the resource-agent upstream git repo.
#
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="ClusterLabs-resource-agents-${TAG}"
# TARFILE="${distdir}.tar.gz"
# rm -rf $TARFILE $distdir
# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE
#
%global upstream_prefix ClusterLabs-resource-agents
%global upstream_version e711383f
%global sap_script_prefix sap_cluster_connector
%global sap_script_hash 0015fe2
Name: resource-agents-sap
Summary: SAP cluster resource agents
Version: 4.1.1
Release: 34%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
License: GPLv2+
URL: https://github.com/ClusterLabs/resource-agents
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
Group: System Environment/Base
%else
Group: Productivity/Clustering/HA
%endif
Source0: %{upstream_prefix}-%{upstream_version}.tar.gz
Source1: %{sap_script_prefix}-%{sap_script_hash}.tar.gz
Patch0: bz1751949-1-SAPInstance-add-reload-action.patch
Patch1: bz1751949-2-SAPInstance-improve-profile-detection.patch
Patch2: bz1751949-3-SAPInstance-metadata-improvements.patch
Patch3: bz1817439-use-safe-temp-file-location.patch
Patch4: bz2024140-SAPInstance-1-add-systemd-support.patch
Patch5: bz2024140-SAPInstance-2-fix-systemd-issue.patch
Patch6: bz1937026-SAPDatabase-SAPInstance-set-correct-agent-ocf-version.patch
Patch7: bz2151296-SAPInstance-improve-killsap-logic.patch
BuildArch: noarch
BuildRequires: automake autoconf gcc
BuildRequires: perl-interpreter python3-devel
BuildRequires: libxslt glib2-devel
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds
%endif
Requires: resource-agents >= 4.1.1
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
%description
The SAP resource agents interface with Pacemaker to allow
SAP instances to be managed in a cluster environment.
%prep
%setup -q -n %{upstream_prefix}-%{upstream_version}
%setup -q -T -D -a 1 -n %{upstream_prefix}-%{upstream_version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
if [ ! -f configure ]; then
./autogen.sh
fi
%global rasset linux-ha
%configure BASH_SHELL="/bin/bash" \
PYTHON="%{__python3}" \
%{conf_opt_fatal} \
%if %{defined _unitdir}
--with-systemdsystemunitdir=%{_unitdir} \
%endif
%if %{defined _tmpfilesdir}
--with-systemdtmpfilesdir=%{_tmpfilesdir} \
--with-rsctmpdir=/run/resource-agents \
%endif
--with-pkg-name=%{name} \
--with-ras-set=%{rasset}
%if %{defined jobs}
JFLAGS="$(echo '-j%{jobs}')"
%else
JFLAGS="$(echo '%{_smp_mflags}')"
%endif
make $JFLAGS
%install
make install DESTDIR=%{buildroot}
# remove other agents
find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAP*" -exec rm {} \;
find %{buildroot}/%{_mandir} -type f ! -iname "*SAP*" -exec rm {} \;
cp %{sap_script_prefix}-%{sap_script_hash}/redhat/sap_redhat_cluster_connector %{buildroot}/%{_sbindir}/sap_redhat_cluster_connector
## tree fixup
# remove docs (there is only one and they should come from doc sections in files)
rm -rf %{buildroot}/usr/share/doc/resource-agents
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%{_usr}/lib/ocf/resource.d/heartbeat/SAP*
%{_usr}/lib/ocf/lib/heartbeat/sap*
%{_mandir}/man7/*SAP*
%{_sbindir}/sap_redhat_cluster_connector
%exclude /etc
%exclude /usr/include
%exclude %{_usr}/lib/debug
%exclude %{_usr}/lib/systemd
%exclude %{_usr}/lib/tmpfiles.d
%exclude /usr/libexec/heartbeat
%exclude /usr/sbin/ldirectord
%exclude /usr/sbin/ocf*
%exclude /usr/share/%{name}
%exclude /usr/src
%changelog
* Wed Dec 07 2022 Janine Fuchs <jfuchs@redhat.com> - 4.1.1-34
- SAPInstance: be more resilient against broken kill.sap files
Resolves: rhbz#2151296
* Fri Jun 17 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.1.1-32
- SAPDatabase/SAPInstance: set correct agent and OCF version in metadata
Resolves: rhbz#1937026
* Thu Nov 18 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.1.1-31
- SAPInstance: add systemd support
Resolves: rhbz#2024140
* Fri Apr 17 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.1.1-30
- use safe temp file location
Resolves: rhbz#1817439
* Thu Jan 23 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.1.1-29
- SAPInstance: add reload-action
Resolves: rhbz#1751949
* Tue Jun 18 2019 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.1.1-28
- Initial build as separate package
Resolves: rhbz#1688341

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (ClusterLabs-resource-agents-e711383f.tar.gz) = 170ad41571fb0dc717b9f145cbc0cd73b11afa2f73fd4f0dd45f1acbc3d5c109117892e871278cd2d8af4639ceaf9f74ce581009eda864309a297f9018805c4c
SHA512 (sap_cluster_connector-0015fe2.tar.gz) = 4005350d6fb8d2999861f1cc5f56335d2688c040067e4a01f565953bc060c605e77933d5033b32f9cf6e901ddbf9f5311842e716a832d931d6ffba0ff9e7eac8