- Add resource agent SAPStartSrv.

Resolves: RHEL-55135
This commit is contained in:
Janine Fuchs 2024-08-22 11:29:43 +02:00
parent 5d357de658
commit b222f0c13f
4 changed files with 136 additions and 23 deletions

8
.gitignore vendored
View File

@ -1,2 +1,6 @@
/ClusterLabs-resource-agents-72b4771d.tar.gz
/ClusterLabs-resource-agents-204f1461.tar.gz
/*.tar.gz
/*.src.rpm
/.build-*.log
/*/
!/tests/
/tests/*.retry

View File

@ -14,6 +14,7 @@
#
# Use a specified version as HEAD if needed, e.g. "v4.14.0"
#
# # Source0:
# git checkout <version tag>
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="ClusterLabs-resource-agents-${TAG}"
@ -21,9 +22,20 @@
# rm -rf $TARFILE $distdir
# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE
#
# # Source1:
# git checkout <version tag>
# TAG=$(git log --pretty="format:%h" -n 1)
# distdir="SAPStartSrv-resourceAgent-${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 72b4771d
%global upstream_version a6ccb93a
%global sapstart_prefix SAPStartSrv-resourceAgent
%global sapstart_version 1758e33
# Whether this platform defaults to using systemd as an init system
# (needs to be evaluated prior to BuildRequires being enumerated and
@ -47,11 +59,12 @@
Name: resource-agents-sap
Summary: SAP cluster resource agents
Version: 4.14.0
Version: 4.15.1
Release: 0%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
License: GPLv2+
URL: https://github.com/ClusterLabs/resource-agents
Source0: %{upstream_prefix}-%{upstream_version}.tar.gz
Source1: %{sapstart_prefix}-%{sapstart_version}.tar.gz
BuildArch: noarch
@ -86,8 +99,12 @@ BuildRequires: libxslt docbook_4 docbook-xsl-stylesheets
%endif
Requires: resource-agents >= 4.8.0
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: /bin/bash /usr/bin/grep /bin/sed /bin/gawk
Requires: python3 python3-psutil
%description
The SAP resource agents interface with Pacemaker to allow
@ -95,12 +112,8 @@ SAP 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}
# Keep placeholder for adding another feature source later
# %%setup -q -T -D -a 1 -n %{upstream_prefix}-%{upstream_version}
# add patches
# %%patch0 -p1
%build
if [ ! -f configure ]; then
@ -150,23 +163,62 @@ make install DESTDIR=%{buildroot}
# Remove other agents
find %{buildroot}/usr/lib/ocf ! -type d ! -iname "SAP*" -exec rm {} \;
find %{buildroot}/%{_mandir} -type f ! -iname "*SAP*" -exec rm {} \;
find %{buildroot}%{_mandir} -type f ! -iname "*SAP*" -exec rm {} \;
find %{buildroot}%{_unitdir} -type f ! -iname "sap*" -exec rm {} \;
# Resource agent from Source1.
# Python script cannot be used for automatic man page creation during prep.
install -m 0755 %{sapstart_prefix}-%{sapstart_version}/ra/SAPStartSrv.in \
%{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat/SAPStartSrv
# Service units and script called by services.
install -D -m 0644 %{sapstart_prefix}-%{sapstart_version}/sbin/sapservices-move.in \
%{buildroot}%{_bindir}/sapservices-move
install -D -m 0644 %{sapstart_prefix}-%{sapstart_version}/service/* \
%{buildroot}%{_unitdir}
# Change hard-coded /usr/sbin to /usr/bin, where the sapservices-move script lives.
sed -i -e 's|%{_sbindir}|%{_bindir}|g' %{buildroot}%{_unitdir}/sap*
# Fix python shebang.
sed -i -e 's|@PYTHON@ -tt|%{__python3}|g' \
%{buildroot}%{_usr}/lib/ocf/resource.d/heartbeat/SAPStartSrv
sed -i -e 's|@PYTHON@ -tt|%{__python3}|g' %{buildroot}%{_bindir}/sapservices-move
# License
mkdir -p %{buildroot}%{_defaultlicensedir}/%{name}
cp %{sapstart_prefix}-%{sapstart_version}/LICENSE %{buildroot}%{_defaultlicensedir}/%{name}
## 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
%post
%systemd_post sapping.service
%systemd_post sappong.service
%preun
%systemd_preun sapping.service
%systemd_preun sappong.service
%postun
%systemd_postun sapping.service
%systemd_postun sappong.service
%files
%defattr(-,root,root)
%license LICENSE
%{_usr}/lib/ocf/resource.d/heartbeat/SAP*
%{_usr}/lib/ocf/lib/heartbeat/sap*
%{_mandir}/man7/*SAP*
%defattr(755,root,root,-)
%{_bindir}/sap*
%defattr(644,root,root,-)
%{_unitdir}/sap*
%exclude /etc
%exclude /usr/include
%exclude %{_usr}/lib/debug
%exclude %{_usr}/lib/systemd
%exclude %{_usr}/lib/tmpfiles.d
%exclude /usr/libexec/heartbeat
%exclude /usr/sbin/ldirectord
@ -176,9 +228,12 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents
%exclude /usr/src
%changelog
* Tue Aug 20 2024 Janine Fuchs <jfuchs@redhat.com> - 4.15.1
- Add resource agent SAPStartSrv.
Resolves: RHEL-55135
* Fri Jul 12 2024 Janine Fuchs <jfuchs@redhat.com> - 4.14.0
- Add package to RHEL 10.
Resolves: RHEL-40573

View File

@ -1 +1,2 @@
SHA512 (ClusterLabs-resource-agents-72b4771d.tar.gz) = 5fb3a102d66b9ba6da2df46bd33fcd7f6e6fabb16a97cd2084e428def21b52141c4ac6bbc1e65421ade2dc76b9bd279b436673a8b1b31a5f4786b765c69f80cb
SHA512 (ClusterLabs-resource-agents-a6ccb93a.tar.gz) = 3ea92f051f16efbd0845d193cc7d2e7d8e9f66ba8e2bbba3a7b8d093ceff3103f8077b93037067dee8962a7d5c1ad0a0b5642acbaf385b0619cef96f18928911
SHA512 (SAPStartSrv-resourceAgent-1758e33.tar.gz) = 3460cc57bae99c390e80e8b5b92be3a62fb635161901a1d1d1cc68c38d03810e6e4f9b15a5a57eb4416f25d5f939202e1830f5b0b165ceb902d1f8fb53bc4876

View File

@ -2,15 +2,68 @@
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
printf "\n" # readability
if [ $err -ge 1 ]; then
echo -e "\nERROR: $err tests FAILED..."
exit 1
list_resources() {
# Verify that 3 SAP* agents are present.
printf "Checking resource agents... "
num="3"
agents=$(pcs resource list ocf:heartbeat:SAP --nodesc)
if [ "$(echo "${agents}" | wc -l)" != "${num}" ]; then
printf "FAILED\n"
printf "ERROR: %s matching pcs agents expected, but found:\n%s\n" "${num}" "${agents}"
err=$((err+1))
else
printf "SUCCESS\n"
printf "%s matching pcs agents found:\n%s\n" "${num}" "${agents}"
fi
printf "\n" # readability
}
check_bins() {
# Verify that binaries are working.
for bin in \
"/usr/bin/sapservices-move -h"
do
printf "Testing '%s'... " "${bin}"
output=$(${bin} 2>&1)
rc=$?
if [ "${rc}" -gt 0 ]; then
printf "FAILED\n"
printf "ERROR: %s\n" "${output}"
err=$((err+1))
else
printf "SUCCESS\n"
fi
done
printf "\n" # readability
}
check_services() {
# Verify that the services exist. They are not loaded by design (rc=3).
for service in \
sapping.service \
sappong.service
do
printf "Testing '%s'... " "${service}"
output=$(systemctl status ${service} 2>&1)
rc=$?
if [ "${rc}" -gt 3 ]; then
printf "FAILED\n"
printf "ERROR: %s\n" "${output}"
err=$((err+1))
else
printf "SUCCESS\n"
fi
done
printf "\n" # readability
}
list_resources
check_bins
check_services
if [ "${err}" -gt 0 ]; then
printf "ERROR: %s tests FAILED...\n" "${err}"
exit 1
fi