diff --git a/SOURCES/bz2151296-SAPInstance-improve-killsap-logic.patch b/SOURCES/bz2151296-SAPInstance-improve-killsap-logic.patch new file mode 100644 index 0000000..325c3b6 --- /dev/null +++ b/SOURCES/bz2151296-SAPInstance-improve-killsap-logic.patch @@ -0,0 +1,46 @@ +From 08ed464aa803f03cbb6cabc79afe462fc98ad213 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +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 +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 diff --git a/SPECS/resource-agents-sap.spec b/SPECS/resource-agents-sap.spec index 6eed859..47cb622 100644 --- a/SPECS/resource-agents-sap.spec +++ b/SPECS/resource-agents-sap.spec @@ -28,7 +28,7 @@ Name: resource-agents-sap Summary: SAP cluster resource agents Version: 4.1.1 -Release: 32%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +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} @@ -45,6 +45,7 @@ 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 @@ -74,6 +75,7 @@ SAP instances to be managed in a cluster environment. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %build if [ ! -f configure ]; then @@ -121,16 +123,16 @@ rm -rf %{buildroot} %files %defattr(-,root,root) -/usr/lib/ocf/resource.d/heartbeat/SAP* -/usr/lib/ocf/lib/heartbeat/sap* +%{_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}/lib/debug +%exclude %{_usr}/lib/systemd +%exclude %{_usr}/lib/tmpfiles.d %exclude /usr/libexec/heartbeat %exclude /usr/sbin/ldirectord %exclude /usr/sbin/ocf* @@ -138,6 +140,11 @@ rm -rf %{buildroot} %exclude /usr/src %changelog +* Wed Dec 07 2022 Janine Fuchs - 4.1.1-34 +- SAPInstance: be more resilient against broken kill.sap files + + Resolves: rhbz#2151296 + * Fri Jun 17 2022 Oyvind Albrigtsen - 4.1.1-32 - SAPDatabase/SAPInstance: set correct agent and OCF version in metadata