diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..912fc46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz +SOURCES/sap_cluster_connector-0015fe2.tar.gz diff --git a/.resource-agents-sap.metadata b/.resource-agents-sap.metadata new file mode 100644 index 0000000..85feb6a --- /dev/null +++ b/.resource-agents-sap.metadata @@ -0,0 +1,2 @@ +0358e1cb7fe86b2105bd2646cbe86f3c0273844a SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz +731c683ecc63b50fbc0823170e966b74ec2a0f51 SOURCES/sap_cluster_connector-0015fe2.tar.gz diff --git a/SOURCES/bz1751949-1-SAPInstance-add-reload-action.patch b/SOURCES/bz1751949-1-SAPInstance-add-reload-action.patch new file mode 100644 index 0000000..9f036c0 --- /dev/null +++ b/SOURCES/bz1751949-1-SAPInstance-add-reload-action.patch @@ -0,0 +1,92 @@ +From 70a28e8130be863a9073b0a80e0511e971e205c4 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +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 + + + ++ + + + +@@ -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 +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 diff --git a/SOURCES/bz1751949-2-SAPInstance-improve-profile-detection.patch b/SOURCES/bz1751949-2-SAPInstance-improve-profile-detection.patch new file mode 100644 index 0000000..e21e2da --- /dev/null +++ b/SOURCES/bz1751949-2-SAPInstance-improve-profile-detection.patch @@ -0,0 +1,26 @@ +From 8eda4725a946ca669df035ed0ffdf053a65e1258 Mon Sep 17 00:00:00 2001 +From: Fabian Herschel +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 diff --git a/SOURCES/bz1751949-3-SAPInstance-metadata-improvements.patch b/SOURCES/bz1751949-3-SAPInstance-metadata-improvements.patch new file mode 100644 index 0000000..7421431 --- /dev/null +++ b/SOURCES/bz1751949-3-SAPInstance-metadata-improvements.patch @@ -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 @@ + + + +- 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 !! ++ 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 !! + Shutdown graceful or kill a SAP instance by terminating the processes. (normal|KILL) + + + + 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 @@ + 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. + + Mark SAPInstance as ERS instance + +@@ -225,7 +225,7 @@ + + + +- ++ + + + diff --git a/SPECS/resource-agents-sap.spec b/SPECS/resource-agents-sap.spec new file mode 100644 index 0000000..0e932e4 --- /dev/null +++ b/SPECS/resource-agents-sap.spec @@ -0,0 +1,141 @@ +# +# 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: 29%{?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 + +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 + +%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 +* Thu Jan 23 2020 Oyvind Albrigtsen - 4.1.1-29 +- SAPInstance: add reload-action + + Resolves: rhbz#1751949 + +* Tue Jun 18 2019 Oyvind Albrigtsen - 4.1.1-28 +- Initial build as separate package + + Resolves: rhbz#1688341