Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

7 changed files with 200 additions and 530 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz SOURCES/ClusterLabs-resource-agents-e76b7d3a.tar.gz
SOURCES/SAPHanaSR-ScaleOut-c2af06c.tar.gz SOURCES/SAPHanaSR-ScaleOut-f716fd8.tar.gz

View File

@ -1,2 +1,2 @@
0358e1cb7fe86b2105bd2646cbe86f3c0273844a SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz b1c1e65d690d94e080319217486f8dcd248b2a2a SOURCES/ClusterLabs-resource-agents-e76b7d3a.tar.gz
b41ef7b3fbee84079804580c0159967fe5ca03ca SOURCES/SAPHanaSR-ScaleOut-c2af06c.tar.gz e85c6e55cb01e60b67b510d5db4014cb70e6c1c7 SOURCES/SAPHanaSR-ScaleOut-f716fd8.tar.gz

View File

@ -1,328 +0,0 @@
From 1450ab47f5645c46e5a1f2fe9096c7db30961ab3 Mon Sep 17 00:00:00 2001
From: AngelaBriel <abriel@suse.com>
Date: Wed, 24 Nov 2021 14:51:30 +0100
Subject: [PATCH] add support for the new systemd unit file handling for
sapstartsrv and saphostagent (bsc#1189532, bsc#1189533)
---
heartbeat/SAPHanaController | 153 ++++++++++++++++++-----------
heartbeat/SAPHanaTopology | 72 ++++++++++++--
4 files changed, 172 insertions(+), 67 deletions(-)
diff --git a/heartbeat/SAPHanaController b/heartbeat/SAPHanaController
index fa47ec5..a98293c 100755
--- a/heartbeat/SAPHanaController
+++ b/heartbeat/SAPHanaController
@@ -34,7 +34,7 @@
# systemReplicationStatus.py (>= SPS090)
#
#######################################################################
-SAPHanaControllerVersion="0.180.0.0628.1823"
+SAPHanaControllerVersion="0.181.0.1123.1923"
# Resource Agent Generation
RAG="2.0"
@@ -765,6 +765,7 @@ function saphana_init() {
super_ocf_log info "FLOW $FUNCNAME ($*)"
local rc=$OCF_SUCCESS
local clN
+ SYSTEMCTL="/usr/bin/systemctl"
# local site
# two parameter models (for transition only)
# OLD: InstanceName
@@ -1125,6 +1126,25 @@ function saphana_init() {
return $OCF_SUCCESS
}
+# chk4systemdsupport - check, if SAP systemd support is available
+# check for the existence of the SAP SID+Instance related unit file
+# rc=0 - sap instance unit file exists
+# rc=1 - sap instance unit file does NOT exist
+function chk4systemdsupport() {
+ super_ocf_log info "FLOW ${FUNCNAME[0]}"
+ local systemd_unit_name="SAP${SID}_${InstanceNr}.service"
+ local rc=1
+ if [ -x "$SYSTEMCTL" ]; then
+ if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
+ rc=0
+ elif $SYSTEMCTL list-unit-files "$systemd_unit_name"; then
+ rc=0
+ else
+ rc=1
+ fi
+ fi
+ return $rc
+}
#
# function: check_sapstartsrv - check for sapstartsrv - optional start
@@ -1138,69 +1158,88 @@ function check_sapstartsrv() {
local runninginst=""
local rc=$OCF_SUCCESS
local output=""
- if [ ! -S /tmp/.sapstream5${InstanceNr}13 ]; then
- super_ocf_log warn "ACT: sapstartsrv is not running for instance $SID-$InstanceName (no UDS), it will be started now"
- restart=1
+ if chk4systemdsupport; then
+ # use systemd to control sapstartsrv
+ local systemd_unit_name="SAP${SID}_${InstanceNr}.service"
+
+ if $SYSTEMCTL is-active --quiet "$systemd_unit_name"; then
+ super_ocf_log info "ACT: systemd service $systemd_unit_name is active"
+ else
+ super_ocf_log warn "ACT: systemd service $systemd_unit_name is not active, it will be started using systemd"
+ # use start, because restart does also stop sap instance
+ $SYSTEMCTL start "$systemd_unit_name" >/dev/null 2>&1; src=$?
+ if [ $src -ne 0 ]; then
+ super_ocf_log error "ACT: error during start of systemd unit ${systemd_unit_name}!"
+ rc=$OCF_ERR_GENERIC
+ ocf_is_probe && rc=$OCF_NOT_RUNNING
+ fi
+ fi
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" ]
+ # no SAP systemd unit available, continue with old code...
+ if [ ! -S /tmp/.sapstream5${InstanceNr}13 ]; then
+ super_ocf_log warn "ACT: 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
- super_ocf_log warn "ACT: 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
- super_ocf_log warn "ACT: FAILED - sapcontrol -nr $InstanceNr -function AccessCheck Start ($(ls -ld1 /tmp/.sapstream5${InstanceNr}13))"
- super_ocf_log warn "ACT: sapstartsrv will be restarted to try to solve this situation, otherwise please check sapstsartsrv setup (SAP Note 927637)"
+ runninginst=$(echo "$output" | grep '^0 : ' | cut -d' ' -f3)
+ if [ "$runninginst" != "$InstanceName" ]
+ then
+ super_ocf_log warn "ACT: 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
+ super_ocf_log warn "ACT: FAILED - sapcontrol -nr $InstanceNr -function AccessCheck Start ($(ls -ld1 /tmp/.sapstream5${InstanceNr}13))"
+ super_ocf_log warn "ACT: sapstartsrv will be restarted to try to solve this situation, otherwise please check sapstsartsrv setup (SAP Note 927637)"
+ restart=1
+ fi
fi
+ else
+ super_ocf_log warn "ACT: sapstartsrv is not running for instance $SID-$InstanceName, it will be started now"
+ restart=1
fi
- else
- super_ocf_log warn "ACT: 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 [ $restart -eq 1 ]
- then
- if [ -d /usr/sap/$SID/SYS/profile/ ]
+ if [ -z "$runninginst" ]; then runninginst=$InstanceName; fi
+ if [ $restart -eq 1 ]
then
- DIR_PROFILE="/usr/sap/$SID/SYS/profile"
- else
- assert "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!"
- fi
- [ ! -r $SAPSTARTPROFILE ] && assert "Expected $SAPSTARTPROFILE to be the instance START profile, please set INSTANCE_PROFILE parameter!"
- 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
- # TODO: PRIO2: Check, if we need to delete the socket files
- rm -f /tmp/.sapstream5${InstanceNr}13
- rm -f /tmp/.sapstream5${InstanceNr}14
- # DONE: PRI0: WE NEED LD_LIBRARY_PATH HERE!!
- (
- export PATH="$DIR_EXECUTABLE${PATH:+:}$PATH"
- export LD_LIBRARY_PATH="$DIR_EXECUTABLE${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
- $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
- if [ $srvrc -ne 1 ]
- then
- super_ocf_log info "ACT: sapstartsrv for instance $SID-$InstanceName was restarted!"
- rc=$OCF_SUCCESS
- else
- super_ocf_log error "ACT: sapstartsrv for instance $SID-$InstanceName could not be started!"
- rc=$OCF_ERR_GENERIC
- ocf_is_probe && rc=$OCF_NOT_RUNNING
+ if [ -d /usr/sap/$SID/SYS/profile/ ]
+ then
+ DIR_PROFILE="/usr/sap/$SID/SYS/profile"
+ else
+ assert "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!"
+ fi
+ [ ! -r $SAPSTARTPROFILE ] && assert "Expected $SAPSTARTPROFILE to be the instance START profile, please set INSTANCE_PROFILE parameter!"
+ 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
+ # TODO: PRIO2: Check, if we need to delete the socket files
+ rm -f /tmp/.sapstream5${InstanceNr}13
+ rm -f /tmp/.sapstream5${InstanceNr}14
+ # DONE: PRI0: WE NEED LD_LIBRARY_PATH HERE!!
+ (
+ export PATH="$DIR_EXECUTABLE${PATH:+:}$PATH"
+ export LD_LIBRARY_PATH="$DIR_EXECUTABLE${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+ $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
+ if [ $srvrc -ne 1 ]
+ then
+ super_ocf_log info "ACT: sapstartsrv for instance $SID-$InstanceName was restarted!"
+ rc=$OCF_SUCCESS
+ else
+ super_ocf_log error "ACT: sapstartsrv for instance $SID-$InstanceName could not be started!"
+ rc=$OCF_ERR_GENERIC
+ ocf_is_probe && rc=$OCF_NOT_RUNNING
+ fi
fi
fi
return $rc
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
index a9cbbf5..b025b5b 100755
--- a/heartbeat/SAPHanaTopology
+++ b/heartbeat/SAPHanaTopology
@@ -14,7 +14,7 @@
# License: GNU General Public License (GPL)
# Copyright: (c) 2014 SUSE Linux Products GmbH
# (c) 2015-2016 SUSE Linux GmbH
-# (c) 2017-2019 SUSE LLC
+# (c) 2017-2021 SUSE LLC
#
# An example usage:
# See usage() function below for more details...
@@ -26,7 +26,7 @@
#
#######################################################################
# DONE PRIO 1: AFTER(!) SAP HANA SPS12 is available we could use hdbnsutil --sr_stateConfiguration
-SAPHanaTopologyVersion="0.180.0.0628.1824"
+SAPHanaTopologyVersion="0.181.0.1123.2015"
#
# Initialization:
timeB=$(date '+%s')
@@ -409,6 +409,8 @@ function sht_init() {
local hdbANSWER=""
local siteID
local siteNAME
+ SYSTEMCTL="/usr/bin/systemctl"
+ systemd_unit_name="saphostagent.service"
HOSTEXECNAME=saphostexec
USRSAP=/usr/sap
SAPSERVICE_PATH=${USRSAP}/sapservices
@@ -562,6 +564,25 @@ function check_for_primary() {
}
+# chk4systemdsupport - check, if SAP systemd support is available
+# check for the existence of the SAP Host Agent related unit file
+# rc=0 - SAP Host Agent unit file exists
+# rc=1 - SAP Host Agent unit file does NOT exist
+function chk4systemdsupport() {
+ super_ocf_log info "FLOW ${FUNCNAME[0]}"
+ local rc=1
+ if [ -x "$SYSTEMCTL" ]; then
+ if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
+ rc=0
+ elif $SYSTEMCTL list-unit-files "$systemd_unit_name"; then
+ rc=0
+ else
+ rc=1
+ fi
+ fi
+ return $rc
+}
+
#
# function: start_saphostagent
# params: -
@@ -570,8 +591,19 @@ function check_for_primary() {
function start_saphostagent()
{
### SAP-CALL
- if [ -x "${HOSTEXEC_PATH}" ]; then
- ${HOSTEXEC_PATH} pf=${HOSTEXEC_PROFILE_PATH}
+ if chk4systemdsupport; then
+ # use systemd to control saphostagent
+ if $SYSTEMCTL is-active --quiet "$systemd_unit_name"; then
+ super_ocf_log info "ACT: systemd service $systemd_unit_name is active"
+ else
+ super_ocf_log warn "ACT: systemd service $systemd_unit_name is not active, it will be started using systemd"
+ $SYSTEMCTL start "$systemd_unit_name" >/dev/null 2>&1
+ fi
+ else
+ # no SAP systemd unit available, continue with old code...
+ if [ -x "${HOSTEXEC_PATH}" ]; then
+ ${HOSTEXEC_PATH} pf=${HOSTEXEC_PROFILE_PATH}
+ fi
fi
return 0
}
@@ -584,8 +616,19 @@ function start_saphostagent()
function stop_saphostagent()
{
### SAP-CALL
- if [ -x "${HOSTEXEC_PATH}" ]; then
- ${HOSTEXEC_PATH} -stop
+ if chk4systemdsupport; then
+ # use systemd to control saphostagent
+ if $SYSTEMCTL is-active --quiet "$systemd_unit_name"; then
+ super_ocf_log warn "ACT: systemd service $systemd_unit_name is active, now stopping using systemd"
+ $SYSTEMCTL stop "$systemd_unit_name" >/dev/null 2>&1
+ else
+ super_ocf_log info "ACT: systemd service $systemd_unit_name is not active"
+ fi
+ else
+ # no SAP systemd unit available, continue with old code...
+ if [ -x "${HOSTEXEC_PATH}" ]; then
+ ${HOSTEXEC_PATH} -stop
+ fi
fi
}
@@ -597,9 +640,20 @@ function stop_saphostagent()
function check_saphostagent()
{
local rc=1
- # TODO: PRIO3: should the path been removed like "saphostexec" instead of "/usr/sap/hostctrl/exe/saphostexec"
- # or should we use ${HOSTEXEC_PATH} instead?
- pgrep -f /usr/sap/hostctrl/exe/saphostexec; rc=$?
+ if chk4systemdsupport; then
+ # use systemd to control saphostagent
+ if $SYSTEMCTL is-active --quiet "$systemd_unit_name"; then
+ super_ocf_log warn "ACT: systemd service $systemd_unit_name is active"
+ rc=0
+ else
+ super_ocf_log info "ACT: systemd service $systemd_unit_name is not active"
+ fi
+ else
+ # no SAP systemd unit available, continue with old code...
+ # TODO: PRIO3: should the path been removed like "saphostexec" instead of "/usr/sap/hostctrl/exe/saphostexec"
+ # or should we use ${HOSTEXEC_PATH} instead?
+ pgrep -f /usr/sap/hostctrl/exe/saphostexec; rc=$?
+ fi
return $rc
}

View File

@ -1,36 +0,0 @@
From c41efcaa658ea7987e03f9f864e9c13bce74bb20 Mon Sep 17 00:00:00 2001
From: AngelaBriel <abriel@suse.com>
Date: Thu, 25 Nov 2021 15:15:23 +0100
Subject: [PATCH] supress output of comman 'systemctl list-unit-files'
---
heartbeat/SAPHanaController | 2 +-
heartbeat/SAPHanaTopology | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/heartbeat/SAPHanaController b/heartbeat/SAPHanaController
index a98293c..9b1c401 100755
--- a/heartbeat/SAPHanaController
+++ b/heartbeat/SAPHanaController
@@ -1137,7 +1137,7 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name"; then
+ elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
rc=0
else
rc=1
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
index b025b5b..304cea8 100755
--- a/heartbeat/SAPHanaTopology
+++ b/heartbeat/SAPHanaTopology
@@ -574,7 +574,7 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name"; then
+ elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
rc=0
else
rc=1

View File

@ -1,42 +0,0 @@
From c005e8260b736df63985e303558e13aaa4d579f6 Mon Sep 17 00:00:00 2001
From: AngelaBriel <abriel@suse.com>
Date: Mon, 20 Dec 2021 10:53:07 +0100
Subject: [PATCH] The return value of 'systemctl list-unit-files <service>' is
not reliable on all SLE15 codestreams, so it is not usable for our resource
agents. We need to go back to parsing the command output instead and hoping,
that the output format will not change in the future, because that will
breake the solution again as well.
---
heartbeat/SAPHanaController | 3 ++-
heartbeat/SAPHanaTopology | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/heartbeat/SAPHanaController b/heartbeat/SAPHanaController
index 9b1c401..33ae6d6 100755
--- a/heartbeat/SAPHanaController
+++ b/heartbeat/SAPHanaController
@@ -1137,7 +1137,8 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
+ elif $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
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
index 304cea8..b9d5a03 100755
--- a/heartbeat/SAPHanaTopology
+++ b/heartbeat/SAPHanaTopology
@@ -574,7 +574,8 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
+ elif $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

View File

@ -1,41 +0,0 @@
From 5206e517e190b3c8dfc4b075cb31b5070e9670d4 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 20 Jan 2022 10:54:54 +0100
Subject: [PATCH] SAPHana*: follow OCF standard for version and OCF version in
metadata
---
heartbeat/SAPHanaController | 4 ++--
heartbeat/SAPHanaTopology | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/heartbeat/SAPHanaController b/heartbeat/SAPHanaController
index 767af44..c365f4a 100755
--- a/heartbeat/SAPHanaController
+++ b/heartbeat/SAPHanaController
@@ -166,8 +166,8 @@ function saphana_meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPHanaController">
-<version>$SAPHanaControllerVersion</version>
+<resource-agent name="SAPHanaController" version="$SAPHanaControllerVersion">
+<version>1.0</version>
<shortdesc lang="en">Manages two SAP HANA database systems in system replication (SR).</shortdesc>
<longdesc lang="en">
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
index 05014af..7f6f4d9 100755
--- a/heartbeat/SAPHanaTopology
+++ b/heartbeat/SAPHanaTopology
@@ -132,8 +132,8 @@ function sht_meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPHanaTopology">
- <version>$SAPHanaTopologyVersion</version>
+<resource-agent name="SAPHanaTopology" version="$SAPHanaTopologyVersion">
+ <version>1.0</version>
<shortdesc lang="en">Analyzes SAP HANA System Replication Topology.</shortdesc>
<longdesc lang="en">This RA analyzes the SAP HANA topology and "sends" all findings via the node status attributes to
all nodes in the cluster. These attributes are taken by the SAPHana RA to control the SAP Hana Databases.

View File

@ -20,45 +20,75 @@
# #
%global upstream_prefix ClusterLabs-resource-agents %global upstream_prefix ClusterLabs-resource-agents
%global upstream_version e711383f %global upstream_version e76b7d3a
%global saphana_scaleout_prefix SAPHanaSR-ScaleOut %global saphana_prefix SAPHanaSR-ScaleOut
%global saphana_scaleout_hash c2af06c %global saphana_hash f716fd8
# Whether this platform defaults to using systemd as an init system
# (needs to be evaluated prior to BuildRequires being enumerated and
# installed as it's intended to conditionally select some of these, and
# for that there are only few indicators with varying reliability:
# - presence of systemd-defined macros (when building in a full-fledged
# environment, which is not the case with ordinary mock-based builds)
# - systemd-aware rpm as manifested with the presence of particular
# macro (rpm itself will trivially always be present when building)
# - existence of /usr/lib/os-release file, which is something heavily
# propagated by systemd project
# - when not good enough, there's always a possibility to check
# particular distro-specific macros (incl. version comparison)
%define systemd_native (%{?_unitdir:1}%{!?_unitdir:0}%{nil \
} || %{?__transaction_systemd_inhibit:1}%{!?__transaction_systemd_inhibit:0}%{nil \
} || %(test -f /usr/lib/os-release; test $? -ne 0; echo $?))
# determine the ras-set to process based on configure invokation
%bcond_with rgmanager
%bcond_without linuxha
Name: resource-agents-sap-hana-scaleout Name: resource-agents-sap-hana-scaleout
Summary: SAP HANA Scale-Out cluster resource agents Summary: SAP HANA Scale-Out cluster resource agents
Epoch: 1 Epoch: 1
Version: 0.180.0 Version: 0.185.3
Release: 4%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} Release: 0%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.1
License: GPLv2+ License: GPLv2+
URL: https://github.com/SUSE/SAPHanaSR-ScaleOut URL: https://github.com/SUSE/SAPHanaSR-ScaleOut
%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 Source0: %{upstream_prefix}-%{upstream_version}.tar.gz
Source1: %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}.tar.gz Source1: %{saphana_prefix}-%{saphana_hash}.tar.gz
Patch0: bz2026278-1-SAPHanaController-SAPHanaTopology-add-systemd-support.patch
Patch1: bz2026278-2-SAPHanaController-SAPHanaTopology-suppress-systemctl-output.patch
Patch2: bz2026278-3-SAPHanaController-SAPHanaTopology-fix-list-unit-files-issue.patch
Patch3: bz2050196-SAPHanaController-SAPHanaTopology-fix-metadata-version.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: automake autoconf gcc # Build dependencies
BuildRequires: perl-interpreter python3-devel BuildRequires: make
BuildRequires: libxslt glib2-devel BuildRequires: automake autoconf pkgconfig gcc
BuildRequires: perl-interpreter perl-generators
BuildRequires: libxslt glib2-devel libqb-devel
BuildRequires: systemd
BuildRequires: which
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} %if 0%{?fedora} || 0%{?centos} > 7 || 0%{?rhel} > 7 || 0%{?suse_version}
BuildRequires: docbook-style-xsl docbook-dtds BuildRequires: python3-devel
%else
BuildRequires: python-devel
%endif %endif
Requires: resource-agents >= 4.1.1 %if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds
%if 0%{?rhel} == 0
BuildRequires: libnet-devel
%endif
%endif
%if 0%{?suse_version}
BuildRequires: libnet-devel
BuildRequires: libglue-devel
BuildRequires: libxslt docbook_4 docbook-xsl-stylesheets
%endif
Requires: resource-agents >= 4.8.0
Conflicts: resource-agents-sap-hana Conflicts: resource-agents-sap-hana
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
Requires: perl Requires: perl-interpreter
%description %description
The SAP HANA Scale-Out resource agents interface with Pacemaker The SAP HANA Scale-Out resource agents interface with Pacemaker
@ -70,26 +100,64 @@ environment.
%setup -q -T -D -a 1 -n %{upstream_prefix}-%{upstream_version} %setup -q -T -D -a 1 -n %{upstream_prefix}-%{upstream_version}
# add SAPHana agents to Makefile.am # add SAPHana agents to Makefile.am
mv %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/ra/SAPHana* heartbeat mv %{saphana_prefix}-%{saphana_hash}/SAPHana/ra/SAPHana* heartbeat
sed -i -e '/ SAPInstance \\/a\ SAPHanaController \\\n SAPHanaTopology \\' heartbeat/Makefile.am
sed -i -e '/ ocf_heartbeat_SAPInstance.7 \\/a\ ocf_heartbeat_SAPHanaController.7 \\\n ocf_heartbeat_SAPHanaTopology.7 \\' doc/man/Makefile.am
cp %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/doc/LICENSE . # Find the existing SAPInstance entry in the list and add 2 new after in corresponding formatting.
# heartbeat/Makefile.am indents by 3 tabs in the target list
sed -i -e 's/\(\t\tSAPInstance\t\t\\\)/\1\n\t\t\tSAPHanaController\t\t\t\\\n\t\t\tSAPHanaTopology\t\\/' heartbeat/Makefile.am
# Find the existing SAPInstance entry in the list and add 2 new after in corresponding formatting.
# doc/man/Makefile.am indents by 26 spaces in the target list
sed -i -e 's/\( \{26\}ocf_heartbeat_SAPInstance.7 \\\)/\1\n'\
' ocf_heartbeat_SAPHanaController.7 \\\n'\
' ocf_heartbeat_SAPHanaTopology.7 \\/' doc/man/Makefile.am
# change provider company in hook scripts
sed -i -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/SAPHanaSR.py
sed -i -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/SAPHanaSrMultiTarget.py
sed -i -e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/susChkSrv.py
# rename patterns explicitly to remove "sus" prefix in files
sed -i -e 's/susChkSrv/ChkSrv/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/susChkSrv.py
sed -i -e 's/suschksrv/chksrv/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/susChkSrv.py
sed -i -e 's/sustkover_timeout/tkover_timeout/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/susChkSrv.py
sed -i -e 's/susChkSrv/ChkSrv/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/global.ini_ChkSrv
sed -i -e 's/suschksrv/chksrv/g' %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/global.ini_ChkSrv
# copy the license
cp %{saphana_prefix}-%{saphana_hash}/SAPHana/doc/LICENSE .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build %build
if [ ! -f configure ]; then if [ ! -f configure ]; then
./autogen.sh ./autogen.sh
fi fi
%global rasset linux-ha %if 0%{?fedora} >= 11 || 0%{?centos} > 5 || 0%{?rhel} > 5
CFLAGS="$(echo '%{optflags}')"
%global conf_opt_fatal "--enable-fatal-warnings=no"
%else
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
%global conf_opt_fatal "--enable-fatal-warnings=yes"
%endif
%configure BASH_SHELL="/bin/bash" \ %if %{with rgmanager}
%global rasset rgmanager
%endif
%if %{with linuxha}
%global rasset linux-ha
%endif
%if %{with rgmanager} && %{with linuxha}
%global rasset all
%endif
export CFLAGS
%configure \
%if 0%{?fedora} || 0%{?centos} > 7 || 0%{?rhel} > 7 || 0%{?suse_version}
PYTHON="%{__python3}" \ PYTHON="%{__python3}" \
%endif
%{conf_opt_fatal} \ %{conf_opt_fatal} \
%if %{defined _unitdir} %if %{defined _unitdir}
--with-systemdsystemunitdir=%{_unitdir} \ --with-systemdsystemunitdir=%{_unitdir} \
@ -98,51 +166,80 @@ fi
--with-systemdtmpfilesdir=%{_tmpfilesdir} \ --with-systemdtmpfilesdir=%{_tmpfilesdir} \
--with-rsctmpdir=/run/resource-agents \ --with-rsctmpdir=/run/resource-agents \
%endif %endif
--with-pkg-name=%{name} \ --with-pkg-name=resource-agents \
--with-ras-set=%{rasset} --with-ras-set=%{rasset}
%if %{defined jobs} make %{_smp_mflags}
JFLAGS="$(echo '-j%{jobs}')"
%else
JFLAGS="$(echo '%{_smp_mflags}')"
%endif
make $JFLAGS
%install %install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
# remove other agents # Remove other agents
find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAPHana*" -exec rm {} \; find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAPHana*" -exec rm {} \;
find %{buildroot}/%{_mandir} -type f ! -iname "*SAPHana*" -exec rm {} \; find %{buildroot}/%{_mandir} -type f ! -iname "*SAPHana*" -exec rm {} \;
install -m 0755 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/bin/{SAPHanaSR-monitor,SAPHanaSR-showAttr} %{buildroot}/%{_sbindir} # Dir structure
mkdir %{buildroot}/%{_usr}/lib/SAPHanaSR-ScaleOut mkdir -p %{buildroot}/%{_datadir}/%{saphana_prefix}/samples
install -m 0444 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/test/SAPHanaSRTools.pm %{buildroot}/%{_usr}/lib/SAPHanaSR-ScaleOut/SAPHanaSRTools.pm mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut/samples mkdir -p %{buildroot}/%{_usr}/lib/%{saphana_prefix}
install -m 0644 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/srHook/SAPHanaSR.py %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut
install -m 0444 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/crmconfig/* %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut/samples # Perl scripts for some add-on functionality.
install -m 0444 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/srHook/global.ini %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut/samples # SAPHanaSRTools is a lib imported by SAPHanaSR-* perl scripts.
gzip %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.? install -m 0444 %{saphana_prefix}-%{saphana_hash}/SAPHana/test/SAPHanaSRTools.pm \
cp %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.7.gz %{buildroot}/%{_mandir}/man7 %{buildroot}/%{_usr}/lib/%{saphana_prefix}/SAPHanaSRTools.pm
cp %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.8.gz %{buildroot}/%{_mandir}/man8 # Use 0755 instead of 0555 because it was shipped like this before.
install -m 0755 %{saphana_prefix}-%{saphana_hash}/SAPHana/bin/SAPHanaSR-showAttr \
%{buildroot}/%{_sbindir}
# Keeping because it was shipped before.
install -m 0755 %{saphana_prefix}-%{saphana_hash}/SAPHana/bin/SAPHanaSR-monitor \
%{buildroot}/%{_sbindir}
# Hook scripts - sanitize upstream names where needed
install -m 0644 %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/SAPHanaSR.py \
%{buildroot}/%{_datadir}/%{saphana_prefix}
install -m 0644 %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/SAPHanaSrMultiTarget.py \
%{buildroot}/%{_datadir}/%{saphana_prefix}
install -m 0644 %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/susChkSrv.py \
%{buildroot}/%{_datadir}/%{saphana_prefix}/ChkSrv.py
# Sample config files
install -m 0444 %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/global.ini \
%{buildroot}/%{_datadir}/%{saphana_prefix}/samples
install -m 0444 %{saphana_prefix}-%{saphana_hash}/SAPHana/srHook/global.ini_ChkSrv \
%{buildroot}/%{_datadir}/%{saphana_prefix}/samples
# Keeping because it was shipped before.
install -m 0444 %{saphana_prefix}-%{saphana_hash}/SAPHana/crmconfig/* \
%{buildroot}/%{_datadir}/%{saphana_prefix}/samples
# Keeping the man pages because they were already shipped before.
# Removed in RHEL 10 for a cleaner solution.
gzip %{saphana_prefix}-%{saphana_hash}/SAPHana/man/SAPHanaSR*.?
cp %{saphana_prefix}-%{saphana_hash}/SAPHana/man/SAPHanaSR*.7.gz %{buildroot}/%{_mandir}/man7
cp %{saphana_prefix}-%{saphana_hash}/SAPHana/man/SAPHanaSR*.8.gz %{buildroot}/%{_mandir}/man8
## tree fixup ## tree fixup
# remove docs (there is only one and they should come from doc sections in files) # remove docs (there is only one and they should come from doc sections in files)
rm -rf %{buildroot}/usr/share/doc/resource-agents rm -rf %{buildroot}/usr/share/doc/resource-agents
%clean
rm -rf %{buildroot}
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%license LICENSE %license LICENSE
%{_usr}/lib/ocf/resource.d/heartbeat/SAPHana* %{_usr}/lib/ocf/resource.d/heartbeat/SAPHana*
%{_mandir}/man7/*SAPHana*
%{_mandir}/man8/*SAPHana*
%{_sbindir}/SAPHanaSR* %{_sbindir}/SAPHanaSR*
%{_usr}/lib/SAPHanaSR-ScaleOut %{_usr}/lib/%{saphana_prefix}
%{_datadir}/SAPHanaSR-ScaleOut %{_datadir}/%{saphana_prefix}
%{_mandir}/man7/ocf_heartbeat_SAPHanaController.7.gz
%{_mandir}/man7/ocf_heartbeat_SAPHanaTopology.7.gz
# Explicitly include these upstream man pages due to their previous presence.
%{_mandir}/man7/SAPHanaSR-ScaleOut.7.gz
%{_mandir}/man7/SAPHanaSR-ScaleOut_basic_cluster.7.gz
%{_mandir}/man7/SAPHanaSR.py.7.gz
%{_mandir}/man7/SAPHanaSR_maintenance_examples.7.gz
%{_mandir}/man8/SAPHanaSR-filter.8.gz
%{_mandir}/man8/SAPHanaSR-monitor.8.gz
%{_mandir}/man8/SAPHanaSR-replay-archive.8.gz
%{_mandir}/man8/SAPHanaSR-showAttr.8.gz
%exclude /etc %exclude /etc
%exclude /usr/include %exclude /usr/include
@ -152,26 +249,44 @@ rm -rf %{buildroot}
%exclude /usr/libexec %exclude /usr/libexec
%exclude /usr/sbin/ldirectord %exclude /usr/sbin/ldirectord
%exclude /usr/sbin/ocf* %exclude /usr/sbin/ocf*
%exclude /usr/share/%{name} %exclude /usr/share/resource-agents
%exclude /usr/share/pkgconfig/resource-agents.pc
%exclude /usr/src %exclude /usr/src
# Exclude new man pages that were not part of previous packages.
%exclude %{_mandir}/man7/SAPHanaSR_upgrade_to_angi.7.gz
%exclude %{_mandir}/man8/SAPHanaSR-hookHelper.8.gz
%exclude %{_mandir}/man8/SAPHanaSR-manageAttr.8.gz %exclude %{_mandir}/man8/SAPHanaSR-manageAttr.8.gz
%exclude %{_mandir}/man8/SAPHanaSR-manageProvider.8.gz
%exclude %{_mandir}/man8/SAPHanaSR-show-hadr-runtimes.8.gz
%changelog %changelog
* Thu Feb 3 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-4 * Thu Aug 29 2024 Janine Fuchs <jfuchs@redhat.com> - 0.185.3-0.1
- Rebase to SAPHanaSR-ScaleOut 0.185.3 upstream and include the
optional hook scripts for hanging HDBindexserver services and
improved multi-target functionality.
Resolves: RHEL-2287
- Change perl dependency to perl-interpreter.
Resolves: RHEL-53822
* Thu Jan 20 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.2-3
- SAPHanaController/SAPHanaTopology: follow OCF standard for version - SAPHanaController/SAPHanaTopology: follow OCF standard for version
and OCF version in metadata and OCF version in metadata
Resolves: rhbz#2050196 Resolves: rhbz#2042921
* Tue Feb 1 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-3 * Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1:0.164.2-2.1
- SAPHanaController/SAPHanaTopology: add systemd support - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
Resolves: rhbz#2026278 * Mon Jun 14 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.2-2
- Add CI gating tests
* Mon Aug 2 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-1 Resolves: rhbz#1958970
- Add HANA MTR multi-site cluster support
Resolves: rhbz#1987634 * Mon Jun 7 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.2-1
- Rebase to SAPHanaSR-ScaleOut 0.164.2 upstream release.
* Thu Apr 30 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.0-1 * Thu Apr 30 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.0-1
- Set default timeouts based on recommendations and a couple of bugfixes - Set default timeouts based on recommendations and a couple of bugfixes
@ -187,3 +302,5 @@ rm -rf %{buildroot}
- Initial build as separate package - Initial build as separate package
Resolves: rhbz#1705765 Resolves: rhbz#1705765
# vim:set ai ts=2 sw=2 sts=2 et: