commit 577bd89f2c14eaad131c693087a56b1f67f4dd97 Author: eabdullin Date: Mon Nov 25 14:49:20 2024 +0000 import CS sap-hana-ha-1.2.8-2.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c9995a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +sap-hana-ha-87a5781.tar.gz diff --git a/create-rename-patches.sh b/create-rename-patches.sh new file mode 100644 index 0000000..c46c54c --- /dev/null +++ b/create-rename-patches.sh @@ -0,0 +1,54 @@ +#!/usr/bin/bash + +# NAME = name of the source unpack dir +NAME="sap-hana-ha-87a5781" + +# BROOT = build root +# Enable this path when using 'rpmbuild -bp'. +# In the .spec file this requires '%autopatch -p 6'. +# BROOT="${HOME}/rpmbuild/BUILD/${NAME}" + +# Use this path with 'rhpkg prep', e.g. 'rhpkg --release rhel-10.0 prep'. +BROOT="${NAME}" +RAPATH="${BROOT}/ra/" +SRHOOKPATH="${BROOT}/srHook/" +TOOLSPATH="${BROOT}/tools/" + +PATTERN="provider_company|susChkSrv|suschksrv|sustkover_timeout|susHanaSR|sushanasr|suse_SAPHanaFilesystem|SAPHanaSR-angi" + +# patch100 - patterns in the srHook/ path +PNAME="patch100" +grep -rlE "${PATTERN}" "${SRHOOKPATH}" | xargs sed -i."${PNAME}" \ + -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' \ + -e 's/susChkSrv/ChkSrv/g' \ + -e 's/suschksrv/chksrv/g' \ + -e 's/susTkOver/TkOver/g' \ + -e 's/sustkover/tkover/g' \ + -e 's/susHanaSR/HanaSR/g' \ + -e 's/sushanasr/hanasr/g' \ + -e 's/SAPHanaSR-angi/sap-hana-ha/g' + +gendiff "${BROOT}" ."${PNAME}" >patterns-srHook-files.patch + +# patch101 - patterns in the ra/ path +PNAME="patch101" +grep -rlE "${PATTERN}" "${RAPATH}" | xargs sed -i."${PNAME}" \ + -e 's/suse_SAPHanaFilesystem/heartbeat_SAPHanaFilesystem/g' \ + -e 's/SAPHanaSR-angi/sap-hana-ha/g' + +gendiff "${BROOT}" ."${PNAME}" >patterns-ra-files.patch + +# patch102 - patterns in the tools/ path +PNAME="patch102" +grep -rlE "${PATTERN}" "${TOOLSPATH}" | xargs sed -i."${PNAME}" \ + -e 's/susChkSrv/ChkSrv/g' \ + -e 's/suschksrv/chksrv/g' \ + -e 's/susTkOver/TkOver/g' \ + -e 's/sustkover/tkover/g' \ + -e 's/susHanaSR/HanaSR/g' \ + -e 's/sushanasr/hanasr/g' \ + -e 's/SAPHanaSR-angi/sap-hana-ha/g' + +gendiff "${BROOT}" ."${PNAME}" >patterns-tools-files.patch + +exit 0 diff --git a/patterns-ra-files.patch b/patterns-ra-files.patch new file mode 100644 index 0000000..d1bd54a --- /dev/null +++ b/patterns-ra-files.patch @@ -0,0 +1,72 @@ +diff -up sap-hana-ha-87a5781/ra/SAPHanaController.patch101 sap-hana-ha-87a5781/ra/SAPHanaController +--- sap-hana-ha-87a5781/ra/SAPHanaController.patch101 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/ra/SAPHanaController 2024-08-19 12:30:40.033351892 +0200 +@@ -47,11 +47,11 @@ OCF_FUNCTIONS_DIR="${OCF_FUNCTIONS_DIR:- + source "${OCF_FUNCTIONS_DIR}/ocf-shellfuncs" + # TODO PRIO1: NG - adjust the correct path and file name for the library to be sourced for first testing use current directory + # shellcheck source=./ra/saphana-common-lib +-source /usr/lib/SAPHanaSR-angi/saphana-common-lib ++source /usr/lib/sap-hana-ha/saphana-common-lib + # shellcheck source=./ra/saphana-controller-common-lib +-source /usr/lib/SAPHanaSR-angi/saphana-controller-common-lib ++source /usr/lib/sap-hana-ha/saphana-controller-common-lib + # shellcheck source=./ra/saphana-controller-lib +-source /usr/lib/SAPHanaSR-angi/saphana-controller-lib ++source /usr/lib/sap-hana-ha/saphana-controller-lib + + # + ####################################################################### +diff -up sap-hana-ha-87a5781/ra/saphana-filesystem-lib.patch101 sap-hana-ha-87a5781/ra/saphana-filesystem-lib +--- sap-hana-ha-87a5781/ra/saphana-filesystem-lib.patch101 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/ra/saphana-filesystem-lib 2024-08-19 12:30:40.034351894 +0200 +@@ -109,7 +109,7 @@ until it gains success or migration-thre + + + The directory to be checked. Default is "/hana/shared/\$SID". +-The RA creates data in an own subdirectory .suse_SAPHanaFilesystem. Do not touch this hidden subdirectory. ++The RA creates data in an own subdirectory .heartbeat_SAPHanaFilesystem. Do not touch this hidden subdirectory. + The directory to be checked. Default is "/hana/shared/\$SID" + + +@@ -186,7 +186,7 @@ function shfs_init() { + fs_hana_shared="${OCF_RESKEY_DIRECTORY:-/hana/shared/$SID}" + HANA_CALL_TIMEOUT="${OCF_RESKEY_HANA_CALL_TIMEOUT:-90}" + ON_FAIL_ACTION="${OCF_RESKEY_ON_FAIL_ACTION:-fail}" +- td_hana_shared="$fs_hana_shared/.suse_SAPHanaFilesystem/${NODENAME}" ++ td_hana_shared="$fs_hana_shared/.heartbeat_SAPHanaFilesystem/${NODENAME}" + pp_hana_shared="/run/SAPHanaFileSystem_poison_pill_${SID}" + sid="${SID,,}" + export sidadm="${sid}adm" +diff -up sap-hana-ha-87a5781/ra/SAPHanaFilesystem.patch101 sap-hana-ha-87a5781/ra/SAPHanaFilesystem +--- sap-hana-ha-87a5781/ra/SAPHanaFilesystem.patch101 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/ra/SAPHanaFilesystem 2024-08-19 12:30:40.033351892 +0200 +@@ -31,11 +31,11 @@ OCF_FUNCTIONS_DIR="${OCF_FUNCTIONS_DIR:- + # shellcheck source=/dev/null + source "${OCF_FUNCTIONS_DIR}/ocf-shellfuncs" + # shellcheck source=./ra/saphana-common-lib +-source /usr/lib/SAPHanaSR-angi/saphana-common-lib ++source /usr/lib/sap-hana-ha/saphana-common-lib + # shellcheck source=./ra/saphana-controller-common-lib +-source /usr/lib/SAPHanaSR-angi/saphana-controller-common-lib ++source /usr/lib/sap-hana-ha/saphana-controller-common-lib + # shellcheck source=./ra/saphana-filesystem-lib +-source /usr/lib/SAPHanaSR-angi/saphana-filesystem-lib ++source /usr/lib/sap-hana-ha/saphana-filesystem-lib + + # + ####################################################################### +diff -up sap-hana-ha-87a5781/ra/SAPHanaTopology.patch101 sap-hana-ha-87a5781/ra/SAPHanaTopology +--- sap-hana-ha-87a5781/ra/SAPHanaTopology.patch101 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/ra/SAPHanaTopology 2024-08-19 12:30:40.034351894 +0200 +@@ -43,9 +43,9 @@ OCF_FUNCTIONS_DIR="${OCF_FUNCTIONS_DIR:- + source "${OCF_FUNCTIONS_DIR}/ocf-shellfuncs" + # TODO PRIO1: NG - adjust the correct path and file name for the library to be sourced for first testing use current directory + # shellcheck source=./ra/saphana-common-lib +-source /usr/lib/SAPHanaSR-angi/saphana-common-lib ++source /usr/lib/sap-hana-ha/saphana-common-lib + # shellcheck source=./ra/saphana-topology-lib +-source /usr/lib/SAPHanaSR-angi/saphana-topology-lib ++source /usr/lib/sap-hana-ha/saphana-topology-lib + + # + ####################################################################### diff --git a/patterns-srHook-files.patch b/patterns-srHook-files.patch new file mode 100644 index 0000000..8a6a0d4 --- /dev/null +++ b/patterns-srHook-files.patch @@ -0,0 +1,287 @@ +diff -up sap-hana-ha-87a5781/srHook/global.ini_susChkSrv.patch100 sap-hana-ha-87a5781/srHook/global.ini_susChkSrv +--- sap-hana-ha-87a5781/srHook/global.ini_susChkSrv.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/global.ini_susChkSrv 2024-08-19 12:30:39.985351798 +0200 +@@ -1,10 +1,10 @@ +-[ha_dr_provider_suschksrv] +-provider = susChkSrv +-path = /usr/share/SAPHanaSR-angi/ ++[ha_dr_provider_chksrv] ++provider = ChkSrv ++path = /usr/share/sap-hana-ha/ + execution_order = 3 + action_on_lost = stop + stop_timeout = 25 + + [trace] +-ha_dr_suschksrv = info ++ha_dr_chksrv = info + +diff -up sap-hana-ha-87a5781/srHook/global.ini_susCostOpt.patch100 sap-hana-ha-87a5781/srHook/global.ini_susCostOpt +--- sap-hana-ha-87a5781/srHook/global.ini_susCostOpt.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/global.ini_susCostOpt 2024-08-19 12:30:39.986351800 +0200 +@@ -1,6 +1,6 @@ + [ha_dr_provider_susCostOpt] + provider = susCostOpt +-path = /usr/share/SAPHanaSR-angi ++path = /usr/share/sap-hana-ha + userKey = costoptkey + execution_order = 1 + +diff -up sap-hana-ha-87a5781/srHook/global.ini_susHanaSR.patch100 sap-hana-ha-87a5781/srHook/global.ini_susHanaSR +--- sap-hana-ha-87a5781/srHook/global.ini_susHanaSR.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/global.ini_susHanaSR 2024-08-19 12:30:39.986351800 +0200 +@@ -1,7 +1,7 @@ +-[ha_dr_provider_susHanaSR] +-provider = susHanaSR +-path = /usr/share/SAPHanaSR-angi ++[ha_dr_provider_HanaSR] ++provider = HanaSR ++path = /usr/share/sap-hana-ha + execution_order = 1 + + [trace] +-ha_dr_sushanasr = info ++ha_dr_hanasr = info +diff -up sap-hana-ha-87a5781/srHook/global.ini_susTkOver.patch100 sap-hana-ha-87a5781/srHook/global.ini_susTkOver +--- sap-hana-ha-87a5781/srHook/global.ini_susTkOver.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/global.ini_susTkOver 2024-08-19 12:30:39.987351802 +0200 +@@ -1,9 +1,9 @@ +-[ha_dr_provider_susTkOver] +-provider = susTkOver +-path = /usr/share/SAPHanaSR-angi +-sustkover_timeout = 30 ++[ha_dr_provider_TkOver] ++provider = TkOver ++path = /usr/share/sap-hana-ha ++tkover_timeout = 30 + execution_order = 1 + + [trace] +-ha_dr_susTkOver = info ++ha_dr_TkOver = info + +diff -up sap-hana-ha-87a5781/srHook/susChkSrv.py.patch100 sap-hana-ha-87a5781/srHook/susChkSrv.py +--- sap-hana-ha-87a5781/srHook/susChkSrv.py.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/susChkSrv.py 2024-08-19 12:30:39.989351806 +0200 +@@ -1,15 +1,15 @@ + # pylint: disable=invalid-name,fixme + """ +-# susChkSrv.py ++# ChkSrv.py + # Author: Fabian Herschel, June 2022 + # License: GNU General Public License (GPL) + # Copyright: (c) 2022 SUSE LLC + +-susChkSrv needs SAP HANA 2.0 SPS4 (2.00.040.00) as minimum version ++ChkSrv needs SAP HANA 2.0 SPS4 (2.00.040.00) as minimum version + + To use this HA/DR hook provide please add the following lines (or similar) to your global.ini: +- [ha_dr_provider_suschksrv] +- provider = susChkSrv ++ [ha_dr_provider_chksrv] ++ provider = ChkSrv + path = /usr/share/SAPHanaSR + execution_order = 2 + action_on_lost = kill | stop | ignore | fence (attr is currently not implemented) +@@ -17,7 +17,7 @@ To use this HA/DR hook provide please ad + # timeout = timeout-in-seconds (currently not implemented) + + [trace] +- ha_dr_suschksrv = info ++ ha_dr_chksrv = info + + TODO: Do we also want this hook to jump-in, if a secondary indexserver is crashing? Maybe to be + selected by a parameter. +@@ -47,7 +47,7 @@ except ImportError as e: + print(f"Module HADRBase not found - running outside of SAP HANA? - {e}") + + # hook section +-SRHookName = "susChkSrv" ++SRHookName = "ChkSrv" + SRHookVersion = "1.001.1" + # parameter section + TIME_OUT_DFLT = 20 +@@ -62,13 +62,13 @@ def getEpisode(): + + + try: +- class susChkSrv(HADRBase): ++ class ChkSrv(HADRBase): + """ class for HADR hook script to handle service changed status events """ + + def logTimestamp(self, method, episode, outputMessage): + """ write message to log file with timestamp """ + traceFilepath = os.path.join(os.environ['SAP_RETRIEVAL_PATH'], 'trace', +- 'nameserver_suschksrv.trc') ++ 'nameserver_chksrv.trc') + try: + with open(traceFilepath, "a", encoding="UTF-8") as saphanasr_multitarget_file: + currentTimeStr = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f ') +@@ -87,7 +87,7 @@ try: + self.logTimestamp(method, episode, "init called") + + # read settings from global.ini +- # read sustkover_timeout ++ # read tkover_timeout + if self.config.hasKey("stop_timeout"): + self.stop_timeout = self.config.get("stop_timeout") + else: +@@ -124,8 +124,8 @@ try: + """ tell something about the HADR hook script """ + method = "about" + self.tracer.info(f"{self.__class__.__name__}.{method}() version {SRHookVersion}") +- return {"provider_company": "SUSE", +- "provider_name": "susChkSrv", # class name ++ return {"provider_company": "Red Hat", ++ "provider_name": "ChkSrv", # class name + "provider_description": "Process service status changed events", + "provider_version": "1.0"} + +diff -up sap-hana-ha-87a5781/srHook/susCostOpt.py.patch100 sap-hana-ha-87a5781/srHook/susCostOpt.py +--- sap-hana-ha-87a5781/srHook/susCostOpt.py.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/susCostOpt.py 2024-08-19 12:30:39.989351806 +0200 +@@ -94,7 +94,7 @@ class susCostOpt(HADRBase): + self.tracer.info(f"{self.__class__.__name__}.{method}() version {FHSRHOOKVERSION}") + desc = ("postTakeover script to reset parameters to default or set parameters as" + " defined in global.ini.") +- return {"provider_company": "SUSE", ++ return {"provider_company": "Red Hat", + "provider_name": "susCostOpt", # class name + "provider_description": desc, + "provider_version": "1.0"} +diff -up sap-hana-ha-87a5781/srHook/susHanaSrMultiTarget.py.to-be-integrated.patch100 sap-hana-ha-87a5781/srHook/susHanaSrMultiTarget.py.to-be-integrated +--- sap-hana-ha-87a5781/srHook/susHanaSrMultiTarget.py.to-be-integrated.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/susHanaSrMultiTarget.py.to-be-integrated 2024-08-19 12:30:39.992351812 +0200 +@@ -100,7 +100,7 @@ try: + def about(self): + method = "about" + self.tracer.info("{0}.{1}() version {2}".format(self.__class__.__name__, method, fhSRHookVersion)) +- return {"provider_company": "SUSE", ++ return {"provider_company": "Red Hat", + "provider_name": "SAPHanaSrMultiTarget", # class name + "provider_description": "Inform Cluster about SR state", + "provider_version": "1.0"} +diff -up sap-hana-ha-87a5781/srHook/susHanaSR.py.patch100 sap-hana-ha-87a5781/srHook/susHanaSR.py +--- sap-hana-ha-87a5781/srHook/susHanaSR.py.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/susHanaSR.py 2024-08-19 12:30:39.990351808 +0200 +@@ -17,9 +17,9 @@ import os + + + # To use this HA/DR hook provide please add the following lines to your global.ini: +-# [ha_dr_provider_susHanaSR] +-# provider = susHanaSR +-# path = /usr/share/SAPHanaSR-angi ++# [ha_dr_provider_HanaSR] ++# provider = HanaSR ++# path = /usr/share/sap-hana-ha + # execution_order = 1 + # + # [trace] +@@ -31,8 +31,8 @@ FH_SR_HOOK_VERSION = "1.001.1" + try: + # remark: case style is given by external configuration + # pylint: disable-next=C0103 +- class susHanaSR(HADRBase): +- """ class susHanaSR to handle HADR events for srConnectionChanged """ ++ class HanaSR(HADRBase): ++ """ class HanaSR to handle HADR events for srConnectionChanged """ + + def __init__(self, *args, **kwargs): + """ constructor - delegate construction to base class """ +@@ -44,8 +44,8 @@ try: + + def about(self): + """ tell about the HADR hook """ +- return {"provider_company": "SUSE", +- "provider_name": "susHanaSR", # class name ++ return {"provider_company": "Red Hat", ++ "provider_name": "HanaSR", # class name + "provider_description": "Inform Cluster about SR state", + "provider_version": "1.0"} + +@@ -53,7 +53,7 @@ try: + def srConnectionChanged(self, ParamDict, **kwargs): + """ process srConnectionChanged event """ + method = "srConnectionChanged" +- self.tracer.info(f"susHanaSR {FH_SR_HOOK_VERSION}" ++ self.tracer.info(f"HanaSR {FH_SR_HOOK_VERSION}" + f" {self.__class__.__name__}.srConnectionChanged" + f" method called with Dict={ParamDict}") + my_system_status = ParamDict["system_status"] +@@ -62,7 +62,7 @@ try: + my_in_sync = ParamDict["is_in_sync"] + my_reason = ParamDict["reason"] + my_site = ParamDict["siteName"] +- self.tracer.info(f"susHanaSR {self.__class__.__name__}.srConnectionChanged" ++ self.tracer.info(f"HanaSR {self.__class__.__name__}.srConnectionChanged" + f" system_status={my_system_status} SID={self.my_sid}" + f" in_sync={my_in_sync} reason={my_reason}") + if my_system_status == 15: +@@ -70,7 +70,7 @@ try: + else: + if my_in_sync: + # ignoring the SFAIL, because we are still in sync +- self.tracer.info(f"susHanaSR {FH_SR_HOOK_VERSION}" ++ self.tracer.info(f"HanaSR {FH_SR_HOOK_VERSION}" + f" {self.__class__.__name__}.srConnectionChanged ignoring bad" + f" SR status because of is_in_sync=True (reason={my_reason})") + my_srs = "" +diff -up sap-hana-ha-87a5781/srHook/susTkOver.py.patch100 sap-hana-ha-87a5781/srHook/susTkOver.py +--- sap-hana-ha-87a5781/srHook/susTkOver.py.patch100 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/srHook/susTkOver.py 2024-08-19 12:30:39.994351816 +0200 +@@ -5,17 +5,17 @@ + # License: GNU General Public License (GPL) + # Copyright: (c) 2022 SUSE LLC + +-susTkOver needs SAP HANA 2.0 SPS4 (2.00.040.00) as minimum version ++TkOver needs SAP HANA 2.0 SPS4 (2.00.040.00) as minimum version + + To use this HA/DR hook provide please add the following lines (or similar) to your global.ini: +- [ha_dr_provider_susTkOver] +- provider = susTkOver ++ [ha_dr_provider_TkOver] ++ provider = TkOver + path = /usr/share/SAPHanaSR +- sustkover_timeout = 30 ++ tkover_timeout = 30 + execution_order = 1 + + [trace] +- ha_dr_sustkover = info ++ ha_dr_tkover = info + + Please make sure to use our supported maintenance procedure together with this HA/DR hook as + described in the man page SAPHanaSR_maitenance_examples(7) - +@@ -41,7 +41,7 @@ RC_TOB = 50277 + + try: + # pylint: disable-next=invalid-name +- class susTkOver(HADRBase): ++ class TkOver(HADRBase): + """ class for HADR hook to handle preTakeover events """ + + def __init__(self, *args, **kwargs): +@@ -50,9 +50,9 @@ try: + method = "init" + + # read settings from global.ini +- # read sustkover_timeout +- if self.config.hasKey("sustkover_timeout"): +- self.time_out = self.config.get("sustkover_timeout") ++ # read tkover_timeout ++ if self.config.hasKey("tkover_timeout"): ++ self.time_out = self.config.get("tkover_timeout") + else: + self.time_out = TIME_OUT_DFLT + self.tracer.info(f"{self.__class__.__name__}.{method}()" +@@ -62,8 +62,8 @@ try: + """ tell something about the HADR hook script """ + method = "about" + self.tracer.info(f"{self.__class__.__name__}.{method}() version {FHSRHOOKVERSION}") +- return {"provider_company": "SUSE", +- "provider_name": "susTkOver", # class name ++ return {"provider_company": "Red Hat", ++ "provider_name": "TkOver", # class name + "provider_description": "Block manual takeover, if cluster is active", + "provider_version": "1.0"} + diff --git a/patterns-tools-files.patch b/patterns-tools-files.patch new file mode 100644 index 0000000..58f9f3a --- /dev/null +++ b/patterns-tools-files.patch @@ -0,0 +1,134 @@ +diff -up sap-hana-ha-87a5781/tools/notes/query_hadr_providers.patch102 sap-hana-ha-87a5781/tools/notes/query_hadr_providers +--- sap-hana-ha-87a5781/tools/notes/query_hadr_providers.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/notes/query_hadr_providers 2024-08-19 12:30:40.049351923 +0200 +@@ -1,7 +1,7 @@ + hdbsql -U TESTER 'select * from M_HA_DR_PROVIDERS + + # PROVIDER_NAME,PROVIDER_COMPANY,PROVIDER_DESCRIPTION,PROVIDER_VERSION,PROVIDER_TYPE,PROVIDER_PATH,EXECUTION_ORDER +-# "susHanaSR","SUSE","Inform Cluster about SR state","1.0","GENERIC","/usr/share/SAPHanaSR-angi",2 +-# "susTkOver","SUSE","Inform Cluster about SR state","1.0","GENERIC","/usr/share/SAPHanaSR-angi",1 ++# "HanaSR","SUSE","Inform Cluster about SR state","1.0","GENERIC","/usr/share/sap-hana-ha",2 ++# "TkOver","SUSE","Inform Cluster about SR state","1.0","GENERIC","/usr/share/sap-hana-ha",1 + # 2 rows selected (overall time 3161 usec; server time 329 usec) + +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-monitor-legacy.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-monitor-legacy +--- sap-hana-ha-87a5781/tools/SAPHanaSR-monitor-legacy.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-monitor-legacy 2024-08-19 12:30:40.048351921 +0200 +@@ -14,7 +14,7 @@ use Sys::Syslog; + use Sys::Hostname; + use File::Path; + use Getopt::Long; +-use lib '/usr/lib/SAPHanaSR-angi'; ++use lib '/usr/lib/sap-hana-ha'; + use lib '/usr/lib/SAPHanaSR'; + use SAPHanaSRTools; + +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive-legacy.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive-legacy +--- sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive-legacy.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive-legacy 2024-08-19 12:30:40.048351921 +0200 +@@ -179,7 +179,7 @@ if [ -n "$outDir" ]; then + mkdir -p "$outDir" + case "$format" in + book ) +- rsync -a /usr/share/SAPHanaSR-angi/icons "$outDir" ++ rsync -a /usr/share/sap-hana-ha/icons "$outDir" + ;; + esac + outNr=0 +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive +--- sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-replay-archive 2024-08-19 12:30:40.048351921 +0200 +@@ -24,7 +24,7 @@ import os + import re + import sys + from dateutil import parser as dateutil_parser +-sys.path.insert(1, '/usr/lib/SAPHanaSR-angi') ++sys.path.insert(1, '/usr/lib/sap-hana-ha') + from saphana_sr_tools import HanaCluster,HanaStatus + # pylint: enable=wrong-import-position + # pylint: enable=unused-import +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr-legacy.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr-legacy +--- sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr-legacy.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr-legacy 2024-08-19 12:30:40.049351923 +0200 +@@ -17,7 +17,7 @@ use Sys::Syslog; + use Sys::Hostname; + use File::Path; + use Getopt::Long; +-use lib '/usr/lib/SAPHanaSR-angi'; ++use lib '/usr/lib/sap-hana-ha'; + use lib '/usr/lib/SAPHanaSR'; + use SAPHanaSRTools; + +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr +--- sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-showAttr 2024-08-19 12:30:40.048351921 +0200 +@@ -23,7 +23,7 @@ import os + import re + import sys + from dateutil import parser as dateutil_parser +-sys.path.insert(1, '/usr/lib/SAPHanaSR-angi') ++sys.path.insert(1, '/usr/lib/sap-hana-ha') + from saphana_sr_tools import HanaCluster,HanaStatus + # pylint: enable=wrong-import-position + # pylint: enable=unused-import +diff -up sap-hana-ha-87a5781/tools/SAPHanaSR-upgrade-to-angi-demo.patch102 sap-hana-ha-87a5781/tools/SAPHanaSR-upgrade-to-angi-demo +--- sap-hana-ha-87a5781/tools/SAPHanaSR-upgrade-to-angi-demo.patch102 2024-07-08 14:39:04.000000000 +0200 ++++ sap-hana-ha-87a5781/tools/SAPHanaSR-upgrade-to-angi-demo 2024-08-19 12:30:40.049351923 +0200 +@@ -20,7 +20,7 @@ TMP=/run/"$EXE"."$RANDOM" + TIMEST=$(date +%s) + ALL_RC=0 + +-# TODO how to use templates from package SAPHanaSR-angi? ++# TODO how to use templates from package sap-hana-ha? + CIB_MSTTMP_ANG="# + primitive rsc_SAPHanaCon_@@sid@@_HDB@@ino@@ ocf:suse:SAPHanaController \ + op start interval=0 timeout=3600 \ +@@ -80,7 +80,7 @@ function init-variables() { + cibadmin -Ql > "$BAKDIR"/cib.xml || exit 1 + SCRIPT=/root/bin/"$EXE" + RPMOLD="SAPHanaSR" +- RPMNEW="SAPHanaSR-angi" ++ RPMNEW="sap-hana-ha" + SID=$(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances |\ + awk '{print $4}') + INO=$(/usr/sap/hostctrl/exe/saphostctrl -function ListInstances |\ +@@ -246,7 +246,7 @@ function del-srhook-local-classic() { + [ $DRYRUN = no ] && grep "^\[ha_dr_provider_" $GLBINI + echo + grep "^\[ha_dr_provider_" $GLBINI | +- grep -i -e susChkSrv -e susTkOver -e SAPHanaSR -e susCostOpt | tr -d "\[\]" |\ ++ grep -i -e ChkSrv -e TkOver -e SAPHanaSR -e susCostOpt | tr -d "\[\]" |\ + while read; do + P=${REPLY:15} + echo "su - $sidadm -c \"/usr/sbin/SAPHanaSR-manageProvider --sid=$SID --show --provider=$P\" > $TMP.global.ini.$P" +@@ -284,9 +284,9 @@ function add-srhook-local-angi() { + EXE=$(basename $0) + source /run/$EXE.variables + [ -z $sid ] && sid=${SID,,} +- for P in susHanaSR susTkOver susChkSrv; do +- echo "su - $sidadm -c \"/usr/bin/SAPHanaSR-manageProvider --sid=$SID --reconfigure --add /usr/share/SAPHanaSR-angi/samples/global.ini_${P}\"" +- [ $DRYRUN = no ] && su - $sidadm -c "/usr/bin/SAPHanaSR-manageProvider --sid=$SID --reconfigure --add /usr/share/SAPHanaSR-angi/samples/global.ini_${P}" ++ for P in HanaSR TkOver ChkSrv; do ++ echo "su - $sidadm -c \"/usr/bin/SAPHanaSR-manageProvider --sid=$SID --reconfigure --add /usr/share/sap-hana-ha/samples/global.ini_${P}\"" ++ [ $DRYRUN = no ] && su - $sidadm -c "/usr/bin/SAPHanaSR-manageProvider --sid=$SID --reconfigure --add /usr/share/sap-hana-ha/samples/global.ini_${P}" + done + echo "su - $sidadm -c \"hdbnsutil -reloadHADRProviders\"" + [ $DRYRUN = no ] && su - $sidadm -c "hdbnsutil -reloadHADRProviders" +@@ -294,7 +294,7 @@ function add-srhook-local-angi() { + [ $DRYRUN = no ] && grep -A2 "^\[ha_dr_provider_" $GLBINI + echo + grep "^\[ha_dr_provider_" $GLBINI | +- grep -i -e susChkSrv -e susTkOver -e SAPHanaSR -e susCostOpt | tr -d "\[\]" |\ ++ grep -i -e ChkSrv -e TkOver -e SAPHanaSR -e susCostOpt | tr -d "\[\]" |\ + while read; do + P=${REPLY:15} + echo "su - $sidadm -c \"/usr/bin/SAPHanaSR-manageProvider --sid=$SID --show --provider=${P}\"" +@@ -452,7 +452,7 @@ function f_install-rpm-angi() { + echo "crm cluster run \"zypper --non-interactive in -l -f -y '${RPMNEW}'\"" + [ $DRYRUN = no ] && crm cluster run "zypper --non-interactive in \ + -l -f -y '${RPMNEW}'" +- # TODO [ $DRYRUN = no ] && crm cluster run "rpm -i ~/SAPHanaSR-angi-1.2.5-150600.3.11.1.noarch.rpm" ++ # TODO [ $DRYRUN = no ] && crm cluster run "rpm -i ~/sap-hana-ha-1.2.5-150600.3.11.1.noarch.rpm" + echo "crm cluster run \"rpm -q '${RPMNEW}' --queryformat %{NAME}\"" + [ $DRYRUN = no ] && crm cluster run "rpm -q '${RPMNEW}' --queryformat %{NAME}" + echo "hash -r" diff --git a/sap-hana-ha.spec b/sap-hana-ha.spec new file mode 100644 index 0000000..ba4332e --- /dev/null +++ b/sap-hana-ha.spec @@ -0,0 +1,136 @@ +# +# 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 are the steps to prepare the source files. +# +# 1) The script to generate a new source file from the SAPHanaSR +# upstream git repo. +# +# git switch main +# TAG=$(git log --pretty="format:%h" -n 1) +# distdir="sap-hana-ha-${TAG}" +# TARFILE="${distdir}.tar.gz" +# rm -rf $TARFILE $distdir +# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE +# +# 2) Update sources with pattern replacements. +# Run ONCE and include the patches. Only re-run if patch conflictcs +# appeared and were solved. +# +# sh -x ./create-rename-patches.sh +# +# Always carefully review the results of the patches, there is no +# automatic check elsewhere! + +# Use %%{name} +# %%global name sap-hana-ha +%global saphana_hash 87a5781 + +Name: sap-hana-ha +Summary: Cluster resource HA for SAP HANA in System Replication +Version: 1.2.8 +Release: 2%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +License: GPLv2+ +URL: https://github.com/SUSE/SAPHanaSR +Source0: %{name}-%{saphana_hash}.tar.gz +# Unpackaged source, just to make sure centpkg keeps it. +Source1: create-rename-patches.sh + +# Patches that will always be needed. +# Other patches: handle conflicts if diff lines overlap +Patch100: patterns-srHook-files.patch +Patch101: patterns-ra-files.patch +Patch102: patterns-tools-files.patch + +BuildArch: noarch + +# Package dependencies +Requires: resource-agents >= 4.8.0 +Conflicts: resource-agents-sap-hana +Conflicts: resource-agents-sap-hana-scaleout + +Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk +Requires: python3 + + +%description +The SAP HANA resource agents and hook scripts interface with Pacemaker +to allow SAP HANA scale-up and scale-out instances to be managed in a cluster +environment. + + +%prep +# Unpack the source and apply patches automatically. +%autosetup -N -n %{name}-%{saphana_hash} +%autopatch -p 1 + +# Fail if there are patterns found after patching. +# Recreate the patches if the source files changed. +# Return success message for the final command RC=0. +grep -r \ + -e "\"provider_company\": \"SUSE\"" \ + -e "susChkSrv" \ + -e "suschksrv" \ + -e "susTkOver" \ + -e "sustkover" \ + -e "susHanaSR" \ + -e "sushanasr" \ + -e "SAPHanaSR-angi" \ + -e "suse_SAPHanaFilesystem" \ + srHook/ ra/ tools/ && { + echo -e "\v>>> CHECK FAILED: Patterns found after patching. Fix the patches.\v" + exit 1 + } || echo "CHECK PASSED: No unpatched patterns found" + +%install +# Dir structure +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_datadir}/%{name}/samples +mkdir -p %{buildroot}%{_usr}/lib/%{name} +mkdir -p %{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat + +# Resource agents and r-a libraries +install -m 0755 ra/SAPHana* %{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat +install -m 0644 ra/saphana-*-lib %{buildroot}%{_usr}/lib/%{name} + +# Hook scripts - sanitize upstream names where needed +install -m 0644 srHook/susHanaSR.py %{buildroot}%{_datadir}/%{name}/HanaSR.py +install -m 0644 srHook/susChkSrv.py %{buildroot}%{_datadir}/%{name}/ChkSrv.py + +# Select sample config files +install -m 0444 srHook/global.ini_susHanaSR %{buildroot}/%{_datadir}/%{name}/samples/global.ini_HanaSR +install -m 0444 srHook/global.ini_susChkSrv %{buildroot}/%{_datadir}/%{name}/samples/global.ini_ChkSrv + +# Scripts for some add-on functionality. +# saphana_sr_tools is a lib imported by SAPHanaSR-* python scripts. +install -m 0555 tools/SAPHanaSR-showAttr %{buildroot}%{_bindir} +install -m 0444 tools/saphana_sr_tools.py %{buildroot}%{_usr}/lib/%{name} + + +%files +%defattr(-,root,root) +%license LICENSE +%dir %{_datadir}/%{name} +%dir %{_usr}/lib/%{name} +%{_bindir}/* +%{_datadir}/%{name}/* +%{_usr}/lib/ocf/resource.d/heartbeat/* +%{_usr}/lib/%{name}/* + + +%changelog +* Tue Aug 13 2024 Janine Fuchs - 1.2.8-2 +- Add package to RHEL 10. + + Resolves: RHEL-53598 + + +# vim:set ai ts=2 sw=2 sts=2 et: diff --git a/sources b/sources new file mode 100644 index 0000000..f684d41 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (sap-hana-ha-87a5781.tar.gz) = b772906a774b4eb0b29b2fafb289ecc410329eea7425e93814477a61a9d4b1a3971010d9eab7d38769555c2e66c29fb2e9df3117f11d43d8677537965966b07d