Compare commits

...

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

12 changed files with 356 additions and 640 deletions

8
.gitignore vendored
View File

@ -1,2 +1,6 @@
SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz
SOURCES/SAPHanaSR-ScaleOut-c2af06c.tar.gz
/*.tar.gz
/*.rpm
/.*
/*/
!/tests/
/tests/*.retry

View File

@ -1,2 +0,0 @@
0358e1cb7fe86b2105bd2646cbe86f3c0273844a SOURCES/ClusterLabs-resource-agents-e711383f.tar.gz
b41ef7b3fbee84079804580c0159967fe5ca03ca SOURCES/SAPHanaSR-ScaleOut-c2af06c.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

@ -1,189 +0,0 @@
#
# 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 SAPHanaSR-ScaleOut upstream git repo.
#
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="SAPHanaSR-ScaleOut-${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 saphana_scaleout_prefix SAPHanaSR-ScaleOut
%global saphana_scaleout_hash c2af06c
Name: resource-agents-sap-hana-scaleout
Summary: SAP HANA Scale-Out cluster resource agents
Epoch: 1
Version: 0.180.0
Release: 4%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
License: GPLv2+
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
Source1: %{saphana_scaleout_prefix}-%{saphana_scaleout_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
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
Conflicts: resource-agents-sap-hana
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
Requires: perl
%description
The SAP HANA Scale-Out resource agents interface with Pacemaker
to allow SAP HANA Scale-Out 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}
# add SAPHana agents to Makefile.am
mv %{saphana_scaleout_prefix}-%{saphana_scaleout_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 .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -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 "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}
mkdir %{buildroot}/%{_usr}/lib/SAPHanaSR-ScaleOut
install -m 0444 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/test/SAPHanaSRTools.pm %{buildroot}/%{_usr}/lib/SAPHanaSR-ScaleOut/SAPHanaSRTools.pm
mkdir -p %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut/samples
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
install -m 0444 %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/srHook/global.ini %{buildroot}/%{_datadir}/SAPHanaSR-ScaleOut/samples
gzip %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.?
cp %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.7.gz %{buildroot}/%{_mandir}/man7
cp %{saphana_scaleout_prefix}-%{saphana_scaleout_hash}/SAPHana/man/SAPHanaSR*.8.gz %{buildroot}/%{_mandir}/man8
## 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)
%license LICENSE
%{_usr}/lib/ocf/resource.d/heartbeat/SAPHana*
%{_mandir}/man7/*SAPHana*
%{_mandir}/man8/*SAPHana*
%{_sbindir}/SAPHanaSR*
%{_usr}/lib/SAPHanaSR-ScaleOut
%{_datadir}/SAPHanaSR-ScaleOut
%exclude /etc
%exclude /usr/include
%exclude /usr/lib/debug
%exclude /usr/lib/systemd
%exclude /usr/lib/tmpfiles.d
%exclude /usr/libexec
%exclude /usr/sbin/ldirectord
%exclude /usr/sbin/ocf*
%exclude /usr/share/%{name}
%exclude /usr/src
%exclude %{_mandir}/man8/SAPHanaSR-manageAttr.8.gz
%changelog
* Thu Feb 3 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-4
- SAPHanaController/SAPHanaTopology: follow OCF standard for version
and OCF version in metadata
Resolves: rhbz#2050196
* Tue Feb 1 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-3
- SAPHanaController/SAPHanaTopology: add systemd support
Resolves: rhbz#2026278
* Mon Aug 2 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-1
- Add HANA MTR multi-site cluster support
Resolves: rhbz#1987634
* Thu Apr 30 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.0-1
- Set default timeouts based on recommendations and a couple of bugfixes
Resolves: rhbz#1827107
* Tue Feb 18 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.163.2-6
- Add Conflicts: to avoid future CI gating errors
Resolves: rhbz#1802995
* Thu Jun 27 2019 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.163.2-5
- Initial build as separate package
Resolves: rhbz#1705765

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -0,0 +1,302 @@
#
# 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 SAPHanaSR-ScaleOut upstream git repo.
#
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="SAPHanaSR-ScaleOut-${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 saphana_prefix SAPHanaSR-ScaleOut
%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 invocation
%bcond_with rgmanager
%bcond_without linuxha
Name: resource-agents-sap-hana-scaleout
Summary: SAP HANA Scale-Out cluster resource agents
Epoch: 1
Version: 0.185.3
Release: 0%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.1
License: GPLv2+
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
Source1: %{saphana_prefix}-%{saphana_hash}.tar.gz
BuildArch: noarch
# Build dependencies
BuildRequires: make
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} > 7 || 0%{?rhel} > 7 || 0%{?suse_version}
BuildRequires: python3-devel
%else
BuildRequires: python-devel
%endif
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds
%endif
Requires: resource-agents >= 4.1.1
Conflicts: resource-agents-sap-hana
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
Requires: perl-interpreter
%description
The SAP HANA Scale-Out resource agents interface with Pacemaker
to allow SAP HANA Scale-Out 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}
# add SAPHana agents to Makefile.am
mv %{saphana_prefix}-%{saphana_hash}/SAPHana/ra/SAPHana* heartbeat
# 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 .
%build
if [ ! -f configure ]; then
./autogen.sh
fi
%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
%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}" \
%endif
%{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=resource-agents \
--with-ras-set=%{rasset}
make %{_smp_mflags}
%install
make install DESTDIR=%{buildroot}
# Remove other agents
find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAPHana*" -exec rm {} \;
find %{buildroot}/%{_mandir} -type f ! -iname "*SAPHana*" -exec rm {} \;
# Dir structure
mkdir -p %{buildroot}/%{_datadir}/%{saphana_prefix}/samples
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}/%{_usr}/lib/%{saphana_prefix}
# Perl scripts for some add-on functionality.
# SAPHanaSRTools is a lib imported by SAPHanaSR-* perl scripts.
install -m 0444 %{saphana_prefix}-%{saphana_hash}/SAPHana/test/SAPHanaSRTools.pm \
%{buildroot}/%{_usr}/lib/%{saphana_prefix}/SAPHanaSRTools.pm
# 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
# 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)
%license LICENSE
%{_usr}/lib/ocf/resource.d/heartbeat/SAPHana*
%{_sbindir}/SAPHanaSR*
%{_usr}/lib/%{saphana_prefix}
%{_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 /usr/include
%exclude /usr/lib/debug
%exclude /usr/lib/systemd
%exclude /usr/lib/tmpfiles.d
%exclude /usr/libexec
%exclude /usr/sbin/ldirectord
%exclude /usr/sbin/ocf*
%exclude /usr/share/resource-agents
%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-manageProvider.8.gz
%exclude %{_mandir}/man8/SAPHanaSR-show-hadr-runtimes.8.gz
%changelog
* Fri Aug 9 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-48224
- Change perl dependency to perl-interpreter.
Resolves: RHEL-53818
* Thu Feb 3 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-4
- SAPHanaController/SAPHanaTopology: follow OCF standard for version
and OCF version in metadata
Resolves: rhbz#2050196
* Tue Feb 1 2022 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-3
- SAPHanaController/SAPHanaTopology: add systemd support
Resolves: rhbz#2026278
* Mon Aug 2 2021 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.180.0-1
- Add HANA MTR multi-site cluster support
Resolves: rhbz#1987634
* Thu Apr 30 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.164.0-1
- Set default timeouts based on recommendations and a couple of bugfixes
Resolves: rhbz#1827107
* Tue Feb 18 2020 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.163.2-6
- Add Conflicts: to avoid future CI gating errors
Resolves: rhbz#1802995
* Thu Jun 27 2019 Oyvind Albrigtsen <oalbrigt@redhat.com> - 0.163.2-5
- Initial build as separate package
Resolves: rhbz#1705765
# vim:set ai ts=2 sw=2 sts=2 et:

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (ClusterLabs-resource-agents-e711383f.tar.gz) = 170ad41571fb0dc717b9f145cbc0cd73b11afa2f73fd4f0dd45f1acbc3d5c109117892e871278cd2d8af4639ceaf9f74ce581009eda864309a297f9018805c4c
SHA512 (SAPHanaSR-ScaleOut-f716fd8.tar.gz) = c75c4c71b5d52e095b4d3720b3e8d3a5c9449d41830a08d14e5bdb1d0f18459da8a6af991f087df7232794d7a8813bf12f671d0cf10ef54958d3b4a774285a4c

26
tests/run_tests.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
err=0
agents=$(pcs resource list ocf:heartbeat 2>&1)
if [ $(echo "$agents" | wc -l) -lt 2 ]; then
echo "ERROR: pcs: agents available:\n$agents"
err=$((err+1))
else
echo "INFO: pcs: agents available..."
fi
for bin in SAPHanaSR-showAttr; do
output="$($bin 2>&1)"
if [ $? -ne 0 ]; then
echo -e "ERROR: $bin failed:\n$output"
err=$((err+1))
else
echo "INFO: $bin works..."
fi
done
if [ $err -ge 1 ]; then
echo -e "\nERROR: $err tests FAILED..."
exit 1
fi

14
tests/tests.yml Normal file
View File

@ -0,0 +1,14 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
- container
required_packages:
- resource-agents-sap-hana-scaleout
- pcs
tests:
- subpackage_tests:
dir: .
run: ./run_tests.sh