Skip to content

Commit

Permalink
Merge pull request #194 from fmherschel/main
Browse files Browse the repository at this point in the history
SAPHanaSR-angi 1.2.0
  • Loading branch information
angelabriel authored Aug 14, 2023
2 parents c42b371 + 0945742 commit 5a6d56c
Show file tree
Hide file tree
Showing 63 changed files with 2,814 additions and 872 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ChecksAndLinters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ jobs:
run: |
echo "Running flake8..."
find . -type f -name '*.py' ! -path './test/*' | xargs flake8 --ignore=E501,E722,E126 && echo "Everything is OK!"
continue-on-error: false
continue-on-error: true

# Runs pylint
- name: Running pylint
shell: bash
run: |
echo "Running pylint..."
find . -type f -name '*.py' ! -path './test/*' | xargs pylint --disable=duplicate-code && echo "Everything is OK!"
continue-on-error: false
continue-on-error: true

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.tgz
*.tar.gz
osc
10 changes: 10 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[BASIC]
module-rgx=([a-zA-Z0-9_-]+)$

[FORMAT]
max-line-length=240

[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=8
max-branches=20
3 changes: 3 additions & 0 deletions 00_files_to_osc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
make copy REL=15 OBSPROJ=./osc/SAPHanaSR-angi
make -f Makefile-tester copy REL=15 OBSPROJ=./osc/SAPHanaSR-tester

64 changes: 64 additions & 0 deletions Makefile-tester
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Makefile for SAPHanaSR package
# Author: Ilya Manyugin
# License: GPL v 2.0+
# make tarball

FILE_LIST = LICENSE \
README.md \
test \

PKG = SAPHanaSR-tester
SPECFILE = ${PKG}.spec
VERSION = $(strip $(patsubst Version:,,$(shell grep '^Version:' $(SPECFILE))))

# OBS local project path: set it as a command line argument or as an ENV variable
OBSPROJ ?= "placeholder"
# OBS target platform
OBSTARG ?= "SLE_12_SP2"

tarball:
@echo -e "\e[33mMaking ${PKG}-${VERSION}.tgz\e[0m"
tar zcf ${PKG}-${VERSION}.tgz ${TAR_EXTRAS} ${FILE_LIST}
@echo -e "\e[32mDone\e[0m"

.ONESHELL:
copy: tarball

@if [ $(OBSPROJ) = "placeholder" ]; then
echo -e "\e[31mProject directory is missing. Set it via 'OBSPROJ=/path/to/project'\e[0m";
exit 1;
fi
@echo -e "\e[33mCopying the SPEC file, CHANGES file and the tarball to ${OBSPROJ}\e[0m"
@cp ${PKG}.changes ${OBSPROJ}
@cp ${PKG}.spec ${OBSPROJ}
@cp ${PKG}-${VERSION}.tgz ${OBSPROJ}
@echo -e "\e[32mDone\e[0m"

.ONESHELL:
build: copy
@echo -e "\e[33mInitiating the build\e[0m"
@cd ${OBSPROJ}
osc -A https://api.suse.de build ${OBSTARG}
@echo -e "\e[32mDone\e[0m"


.ONESHELL:
commit: copy
@echo -e "\e[33mCommiting the code\e[0m"
@cd ${OBSPROJ}
osc -A https://api.suse.de addremove
osc -A https://api.suse.de commit
@echo -e "\e[32mDone\e[0m"

.phony: tarball

.PHONY: checkstyle
checkstyle:
ifneq ($(CHECKSTYLE),0)
find . -type f -exec awk ' /^#!.*bash/{print FILENAME} {nextfile}' {} + | xargs shellcheck -s bash || :
find . -type f -exec awk ' /^#!.*perl/{print FILENAME} {nextfile}' {} + | grep -v .git | xargs perlcritic --gentle || :
find . -name '*.py' | xargs flake8 --ignore=E501 || :
endif

PHONY: test
test: checkstyle
6 changes: 6 additions & 0 deletions SAPHanaSR-angi.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Tue Aug 8 13:33:00 UTC 2023 - [email protected]
-------------------------------------------------------------------

- Version bump to 1.2.0
* SAPHanaFilesystem RA added (poc status)

-------------------------------------------------------------------
Wed Jul 5 15:36:16 UTC 2023 - [email protected]

Expand Down
2 changes: 1 addition & 1 deletion SAPHanaSR-angi.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ License: GPL-2.0
Group: Productivity/Clustering/HA
AutoReqProv: on
Summary: Resource agents to control the HANA database in system replication setup
Version: 1.001.5
Version: 1.2.0
Release: 0
Url: https://www.suse.com/c/fail-safe-operation-of-sap-hana-suse-extends-its-high-availability-solution/

Expand Down
Empty file added SAPHanaSR-tester.changes
Empty file.
95 changes: 95 additions & 0 deletions SAPHanaSR-tester.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#
# spec file for package SAPHanaSR
#
# Copyright (c) 2023 SUSE LLC.
#
# 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.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/

Name: SAPHanaSR-tester
License: GPL-2.0
Group: Productivity/Clustering/HA
AutoReqProv: on
Summary: Test suite for SAPHanaSR clusters
Version: 1.1.0
Release: 0
Url: https://www.suse.com/c/fail-safe-operation-of-sap-hana-suse-extends-its-high-availability-solution/

BuildArch: noarch

Source0: %{name}-%{version}.tgz

BuildRoot: %{_tmppath}/%{name}-%{version}-build

Requires: python3

%description
SAPHanaSR-tester is a suite for semi-automated tests of SAPHanaSR clusters. First focussed test-scenarios are angi-ScaleUp and angi-ScaleOut (e.g. for ERP systems).

The test cases are described in JSON files. Each tests is separated into one ore multiple steps. For each step there is an expection about the SAPHanaSR attributes, which needs to match.
Additionally each step defines the 'next' step and an optional action to be triggered if the step status has been reached (all expectations match).

The following SUSE blog series gives a good overview about running SAP HANA in System Replication in the SUSE cluster:
https://www.suse.com/c/tag/towardszerodowntime/

Authors:
--------
Fabian Herschel

%prep
tar xf %{S:0}
#%define crmscr_path /usr/share/crmsh/scripts/

%build
#gzip man/*

%install
mkdir -p %{buildroot}/usr/bin
#mkdir -p %{buildroot}%{_docdir}/%{name}
mkdir -p %{buildroot}/usr/share/%{name}
mkdir -p %{buildroot}/usr/lib/%{name}
#mkdir -p %{buildroot}%{_mandir}/man7
#mkdir -p %{buildroot}%{_mandir}/man8

# test engine itself
mkdir -p %{buildroot}/usr/lib/%{name}
install -m 0755 test/SAPHanaSR-* %{buildroot}/usr/bin
install -m 0644 test/saphana_sr_test.py %{buildroot}/usr/lib/%{name}

# test help programs, test loops and test calls
install -m 0755 test/cs_* %{buildroot}/usr/bin
install -m 0755 test/test_* %{buildroot}/usr/bin
install -m 0755 test/callTest* %{buildroot}/usr/bin
install -m 0755 test/loopTests* %{buildroot}/usr/bin

# test definitions
pwd
ls test/json
cp -va test/json %{buildroot}/usr/share/%{name}

# manual pages
#install -m 0444 man/*.7.gz %{buildroot}%{_mandir}/man7
#install -m 0444 man/*.8.gz %{buildroot}%{_mandir}/man8

%files
%defattr(-,root,root)
/usr/share/%{name}
%dir /usr/lib/%{name}
/usr/lib/%{name}/saphana_sr_*.py
/usr/bin/*

%license LICENSE
#%dir %{_docdir}/%{name}
%doc README.md
#%doc %{_mandir}/man7/*
#%doc %{_mandir}/man8/*

%changelog
16 changes: 10 additions & 6 deletions man/SAPHanaSR-ScaleOut_basic_cluster.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Version: 0.182.0
.\" Version: 1.001
.\"
.TH SAPHanaSR-ScaleOut_basic_cluster 7 "26 Jan 2023" "" "SAPHanaSR"
.TH SAPHanaSR-ScaleOut_basic_cluster 7 "07 Aug 2023" "" "SAPHanaSR"
.\"
.SH NAME
SAPHanaSR-ScaleOut_basic_cluster \- SAP HANA System Replication scale-out basic cluster configuration.
Expand Down Expand Up @@ -292,10 +292,13 @@ colocation col_ip_with_SLE_HDB00 \\

\fB* crm NFS check resource configuration\fR

In case of NFS failure, HANA might stop working but the Linux cluster
might not take action. To solve this, a dummy filesystem resource could
be added. If this filesystem reports monitor failures, the node gets fenced
and a takeover is initiated.
In case of NFS failure, HANA might stop working but the Linux cluster might not
take action. To solve this, a dummy filesystem resource could be added. If this
filesystem reports monitor failures, the node gets fenced and a takeover is
initiated. The takeover will fail, if the HANA system replication is not in
sanc (srHook shows SFAIL).
.br
Note: See manual page ocf_suse_SAPHanaFilesystem(7) for a better solution.
.br
Note: Understand the impact before implementing.
.PP
Expand Down Expand Up @@ -424,6 +427,7 @@ Please report any other feedback and suggestions to [email protected].
.\"
.SH SEE ALSO
\fBocf_suse_SAPHanaTopology\fP(7) , \fBocf_suse_SAPHanaController\fP(7) ,
\fBocf_suse_SAPHanaFilesystem\fP(7) ,
\fBocf_heartbeat_IPAddr2\fP(7) , \fBocf_heartbeat_Filesystem\fP(7) ,
\fBsbd\fP(8) , \fBstonith_sbd\fP(7) , \fBstonith_admin\fP(8) ,
\fBcrm_no_quorum_policy\fP(7) , \fBcrm\fP(8) , \fBcrm_simulate\fP(8) ,
Expand Down
12 changes: 6 additions & 6 deletions man/SAPHanaSR-monitor.8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Version: 0.180.0
.\" Version: 1.001
.\"
.TH SAPHanaSR-monitor 8 "27 May 2022" "" "SAPHanaSR"
.TH SAPHanaSR-monitor 8 "07 Aug 2023" "" "SAPHanaSR"
.\"
.SH NAME
SAPHanaSR-monitor \- Display status of SAP HANA system replication automation (SAPHanaSR).
Expand Down Expand Up @@ -66,7 +66,7 @@ show status of SAP HANA system replication one time.
/usr/bin/SAPHanaSR-monitor
the program itself.
.TP
/usr/lib/SAPHanaSR or /usr/lib/SAPHanaSR-ScaleOut
/usr/lib/SAPHanaSR-angi/
directory with function libraries.
.TP
/srv/www/hawk/public/SAPHanaSR/index.html
Expand All @@ -81,10 +81,10 @@ script is under development.
Feedback is welcome, please mail to [email protected].
.\"
.SH SEE ALSO
\fBocf_suse_SAPHana\fP(7) or \fBocf_suse_SAPHanaController\fP(7) , \fBocf_suse_SAPHanaTopology\fP(7) ,
\fBocf_suse_SAPHanaController\fP(7) , \fBocf_suse_SAPHanaTopology\fP(7) ,
\fBSAPHanaSR-showAttr\fP(8) , \fBSAPHanaSR-filter\fP(8) , \fBcibadmin\fP(8) ,
.br
https://documentation.suse.com/sbp/sap ,
https://documentation.suse.com/sbp/sap/ ,
.br
https://documentation.suse.com/sles-sap/ ,
.br
Expand All @@ -104,7 +104,7 @@ F.Herschel, L.Pinne.
.br
(c) 2015-2017 SUSE Linux GmbH, Germany.
.br
(c) 2018-2022 SUSE LLC.
(c) 2018-2023 SUSE LLC.
.br
SAPHanaSR-monitor comes with ABSOLUTELY NO WARRANTY.
.br
Expand Down
4 changes: 2 additions & 2 deletions man/SAPHanaSR_basic_cluster.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Version: 1.001
.\"
.TH SAPHanaSR 7 "13 Apr 2023" "" "SAPHanaSR_basic_cluster"
.TH SAPHanaSR 7 "08 Aug 2023" "" "SAPHanaSR_basic_cluster"
.\"
.SH NAME
SAPHanaSR_basic_cluster \- SAP HANA System Replication scale-up basic cluster configuration.
Expand Down Expand Up @@ -272,7 +272,7 @@ A healthy HANA master looks like "4:P:master1:master:worker:master".
First field is the HANA landscape status. If that status goes to 3 or 2,
something has happened to HANA, but the cluster will not perform a takeover.
Status 1 will trigger a takeover, status 0 indicates an undefined fatal failure.
See man page ocf_suse_SAPHanaController(7) and ocf_heartbeat_MailTo(7).
See manual pages ocf_suse_SAPHanaController(7) and ocf_heartbeat_MailTo(7).

You could define a MailTo resource that informs you as soon as attribute
hana_<sid>_roles deviates from above ideal:
Expand Down
28 changes: 18 additions & 10 deletions man/ocf_suse_SAPHanaController.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Version: 1.001
.\"
.TH ocf_suse_SAPHanaController 7 "08 May 2022" "" "OCF resource agents"
.TH ocf_suse_SAPHanaController 7 "09 Aug 2022" "" "OCF resource agents"
.\"
.SH NAME
SAPHanaController \- Manages takeover between two SAP HANA databases with system replication.
Expand Down Expand Up @@ -249,7 +249,9 @@ Suggested minimum timeout: 5\&.
.PP
.\"
.SH RETURN CODES
The return codes are defined by the OCF cluster framework. Please refer to the OCF definition on the website mentioned below.
The return codes are defined by the OCF cluster framework. Please refer to the
OCF definition on the website mentioned below.
In addition return code 124 will be logged if HANA_CALL_TIMEOUT has been exceeded.
.br
In addition, log entries are written, which can be scanned by using a pattern like "SAPHanaController.*RA.*rc=[1-7,9]" for errors. Regular operations might be found with "SAPHanaController.*RA.*rc=0".
.PP
Expand All @@ -273,7 +275,7 @@ op demote interval="0" timeout="320" \\
.br
op monitor interval="60" role="Promoted" timeout="700" \\
.br
op monitor interval="61" role="Started" timeout="700" \\
op monitor interval="61" role="Unpromoted" timeout="700" \\
.br
params SID="SLE" InstanceNumber="00" PREFER_SITE_TAKEOVER="true" \\
.br
Expand All @@ -283,7 +285,7 @@ HANA_CALL_TIMEOUT="120"
.PP
clone mst_SAPHanaCon_SLE_HDB00 rsc_SAPHanaCon_SLE_HDB00 \\
.br
clone-node-max="1" promotable="true" interleave="true"
meta clone-node-max="1" promotable="true" interleave="true"
.PP
location SAPHanaCon_not_on_majority_maker mst_SAPHanaCon_HAE_HDB00 -inf: vm-majority
.RE
Expand Down Expand Up @@ -445,16 +447,22 @@ nodeB: 1479202132
.SH FILES
.TP
/usr/lib/ocf/resource.d/suse/SAPHanaController
the resource agent
the resource agent
.TP
/usr/lib/ocf/resource.d/suse/SAPHanaTopology
the also needed topology resource agent
the also needed topology resource agent
.TP
/usr/lib/ocf/resource.d/suse/SAPHanaFilesystem
the filesystem monitoring resource agent
.TP
/usr/lib/SAPHanaSR-angi/
directory with function libraries
.TP
/usr/sap/$SID/$InstanceName/exe
default path for DIR_EXECUTABLE
default path for DIR_EXECUTABLE
.TP
/usr/sap/$SID/SYS/profile
default path for DIR_PROFILE
default path for DIR_PROFILE
.\"
.\" TODO: INSTANCE_PROFILE
.PP
Expand All @@ -471,9 +479,9 @@ Please report any other feedback and suggestions to [email protected].
.PP
.\"
.SH SEE ALSO
\fBocf_suse_SAPHanaTopology\fP(7) , \fBocf_heartbeat_IPaddr2\fP(8) , \fBSAPHanaSR-monitor\fP(8) , \fBSAPHanaSR-showAttr\fP(8) , \fBSAPHanaSR\fP(7) , \fBSAPHanaSR-ScaleOut\fP(7) , \fBSAPHanaSR_maintenance_examples\fP(7) , \fBSAPHanaSR_basic_cluster\fP(7) , \fBSAPHanaSR-ScaleOut_basic_cluster\fP(7) , \fBSAPHanaSR-manageAttr\fP(8) , \fBchrony.conf\fP(5) , \fBstonith\fP(8) , \fBcrm\fP(8)
\fBocf_suse_SAPHanaTopology\fP(7) , \fBocf_suse_SAPHanaFilesystem\fP(7) , \fBocf_heartbeat_IPaddr2\fP(8) , \fBSAPHanaSR-monitor\fP(8) , \fBSAPHanaSR-showAttr\fP(8) , \fBSAPHanaSR\fP(7) , \fBSAPHanaSR-ScaleOut\fP(7) , \fBSAPHanaSR_maintenance_examples\fP(7) , \fBSAPHanaSR_basic_cluster\fP(7) , \fBSAPHanaSR-ScaleOut_basic_cluster\fP(7) , \fBSAPHanaSR-manageAttr\fP(8) , \fBchrony.conf\fP(5) , \fBstonith\fP(8) , \fBcrm\fP(8)
.br
https://documentation.suse.com/sbp/all/?context=sles-sap ,
https://documentation.suse.com/sbp/sap/ ,
.br
https://www.suse.com/support/kb/doc/?id=000019138 ,
.br
Expand Down
Loading

0 comments on commit 5a6d56c

Please sign in to comment.