susTkOver.py(7)

πŸ“¦ version 1.3.4, in opensuse-leap 16.0

πŸ’… susTkOver.py β€” the SAPHanaSR glow-up page

okay so this is susTkOver.py(7) from the SAPHanaSR fam β€” a whole manual page for one tiny iconic script that does one big job. buckle up bestie πŸŽ€


✨ NAME ✨

susTkOver.py β€” the provider for the SAP HANA srHook method preTakeover().

πŸ¦‹ DESCRIPTION πŸ¦‹

so susTkOver.py is literally here to hand SAP HANA a script for the srHook method preTakeover(). that's the gig. that's the whole vibe.

the SAP HANA nameserver ships a Python-based API (the "HA/DR providers" β€” yes that's the real name, iykyk), and it gets called at the big moments of the host auto-failover and system replication takeover process. these so-called hooks are your spot to do arbitrary operations that need to run. and preTakeover()? called before the sr_takeover action. no cap. πŸ”₯

here's the tea: susTkOver.py allows a manual takeover of the HANA primary if the SAP HANA multi-state resource (managed by SAPHanaController) is set into maintenance or the Linux cluster is stopped. otherwise β€” and this is important β€” the manual takeover is blocked. check the manual page SAPHanaSR_maintenance_examples(7) for the lore.

🫢 heads up: this hook script needs to be configured and activated on all HANA nodes. all of them. no skipping.

🌸 SUPPORTED PARAMETERS 🌸

the "HA/DR providers" API section

the "HA/DR providers" API accepts these parameters for the ha_dr_provider_susTkOver section:

[ha_dr_provider_susTkOver]
  • provider = susTkOver β€” mandatory. must not be changed. like, do not touch it. πŸ™ˆ
  • path = /usr/share/SAPHanaSR-angi β€” mandatory. delivered inside the RPM package. please only change it if someone requests it.
  • execution_order = [ INTEGER ] β€” mandatory. the order might depend on other hook scripts, so think before you rearrange.
  • sustkover_timeout = [ INTEGER ] β€” optional. default is 30 seconds. ⏱️

the [trace] section

the API also accepts this one parameter for the trace section:

  • ha_dr_sustkover = [ info | debug ] β€” optional. default is info. it'll be added automatically if you don't set it. so nice of it.

the cluster attributes the SAPHanaController RA watches πŸ‘€

the SAPHanaController RA recognizes the pending takeover request via these cluster attributes:

  • sra = [ T | R | F | - ] β€” the HANA system replication takeover action, indicated by preTakeover().

the node attribute system replication action gets checked by the HA/DR provider API method preTakeover(). it's set by the resource agent SAPHanaController. it tells you whether a takeover or a registration is going down:

  • T = takeover on new primary (sr_takeover) ongoing.
  • R = registration on new secondary (sr_register) ongoing.
  • F = takeover failed. πŸ’€
  • - = no action pending.
  • srah = [ T | R | F | - ] β€” the HANA system replication action history.

this node attribute stores actions in CIB attributes for later use β€” for root cause analysis. so when things get messy, the receipts are right there. πŸ”


πŸ’œ RETURN CODES πŸ’œ

  • 0 β€” successful program execution. slay.
  • >0 β€” usage, syntax or execution errors. 😭

🌈 EXAMPLES 🌈

okay this is the fun part, let's go 🧚

  • simple example for the sudo permissions in /etc/sudoers.d/SAPHanaSR. this file is needed on all Linux cluster nodes. SID here is HA1. see also the manual page SAPHanaSR-hookHelper(8).
# SAPHanaSR needs for susTkOver
ha1adm ALL=(ALL) NOPASSWD: /usr/bin/SAPHanaSR-hookHelper *
  • example for looking up the sudo permission for the hook script. all the related files (/etc/sudoers and /etc/sudoers.d/*) get scanned. example SID is HA1.
# sudo -U ha1adm -l | grep "NOPASSWD.*/usr/bin/SAPHanaSR-hookHelper"
  • example entry in the SAP HANA global configuration at /hana/shared/$SID/global/hdb/custom/config/global.ini. this file is needed at both sites. the entry shown works for scale-up and for scale-out. (and yes β€” the HANA has to be stopped before the files can be changed. do with that what you will.)
[ha_dr_provider_sustkover]
provider = susTkOver
path = /usr/share/SAPHanaSR-angi
sustkover_timeout = 30
execution_order = 1
[trace]
ha_dr_sustkover = info
  • example for checking the system log for susTkOver setting the HANA system replication status in the CIB properties section. run this on the respective HANA primary site's master nameserver.
# grep "sudo.*SAPHanaSR-hookHelper" /var/log/messages
  • example for checking the HANA tracefiles for preTakeover() events. run this on the respective HANA secondary site's master nameserver.
# su - sleadm
~> cdtrace
~> grep susTk.*preTakeover.*called nameserver_*.trc
  • example for showing intentionally blocked manual takeover attempts. run it on the respective HANA secondary site's master nameserver.
# su - sleadm
~> cdtrace
~> grep susTkOver.preTakeover.*failed.*50277 nameserver_*.trc
bestie, if you see such messages, you may want to go read SAPHanaSR_maintenance_examples(7). 🫢
  • example for checking the HANA tracefiles for when the hook script has been loaded. run it on both sites' master nameservers.
# su - sleadm
~> cdtrace
~> grep HADR.*load.*susTkOver nameserver_*.trc
~> grep susTkOver.init nameserver_*.trc

πŸŽ€ FILES πŸŽ€

  • /usr/share/SAPHanaSR-angi/susTkOver.py β€” the hook provider, delivered with the RPM.
  • /usr/bin/SAPHanaSR-hookHelper β€” the external script to check and update the CIB attribute.
  • /hana/shared/$SID/global/hdb/custom/config/global.ini β€” the on-disk representation of the HANA global system configuration.
  • /etc/sudoers , /etc/sudoers.d/* β€” the sudo permissions configuration.
  • /usr/sap/$sid/HDB$nr/$HOST/trace/nameserver_$vhost.3????.???.trc β€” the HANA master nameserver tracefile.

πŸ‘‘ REQUIREMENTS πŸ‘‘

  1. SAP HANA 2.0 SPS06 or later provides the HA/DR provider hook method preTakeover() with multi-target aware parameters and a separate return code for Linux HA clusters. non-negotiable, that's the baseline.
  2. no other HADR provider hook script should be configured for the preTakeover() method. hook scripts for other methods, provided in SAPHanaSR and SAPHanaSR-ScaleOut, can totally be used in parallel to susTkOver.py β€” unless something documents a contradiction.
  3. the user ${sid}adm needs execution permission as user root for the command SAPHanaSR-hookHelper.
  4. the hook provider needs to be added to the HANA global configuration β€” in memory and on disk (in persistence). both, bestie. πŸ’…
  5. if the hook provider should be pre-compiled, you have to use the particular Python version that comes with SAP HANA. no mixing and matching.

πŸ’€ BUGS πŸ’€

in case of any problem, please use your favourite SAP support process to open a request for the component BC-OP-LNX-SUSE. and please report any other feedback and suggestions to feedback@suse.com. we're listening 🫢


⭐ SEE ALSO ⭐

SAPHanaSR(7) , SAPHanaSR-ScaleOut(7) , susHanaSR.py(7) , susHanaSrMultiTarget.py(7) , ocf_suse_SAPHanaTopology(7) , ocf_suse_SAPHanaController(7) , SAPHanaSR-showAttr(8) , SAPHanaSR-hookHelper(8) , SAPHanaSR_maintenance_examples(7) , SAPHanaSR-manageProvider(8) , crm_attribute(8) , sudo(8) , sudoers(5), python3(8) , https://help.sap.com/docs/SAP_HANA_PLATFORM?locale=en-US https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/5df2e766549a405e95de4c5d7f2efc2d.html?locale=en-US


🌸 AUTHORS 🌸

A.Briel, F.Herschel, L.Pinne.

(c) 2022-2026 SUSE LLC

susTkOver.py comes with ABSOLUTELY NO WARRANTY. for details see the GNU General Public License at http://www.gnu.org/licenses/gpl.html.


and that's the whole page, bestie β€” written 25 Jul 2025, living in the susTkOver.py(7) era of the SAPHanaSR manual set. go configure all your HANA nodes and text me when it works πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from