Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/corosync-qdevice.git#7282512e9c41c4defcada2e1e95960fa3be1bf21
This commit is contained in:
DistroBaker 2020-11-02 16:48:36 +01:00
parent d8b3a08801
commit 0b4128d52b
8 changed files with 648 additions and 0 deletions

5
.gitignore vendored
View File

@ -0,0 +1,5 @@
/corosync-qdevice-2.90.0.tar.gz
/corosync-qdevice-2.91.0.tar.gz
/corosync-qdevice-2.92.0.tar.gz
/corosync-qdevice-2.93.0.tar.gz
/corosync-qdevice-3.0.0.tar.gz

View File

@ -0,0 +1,17 @@
# qdevice coroqnetd group directories
addFilter(r'corosync-qdevice\.[^:]+: (E|W): non-standard-dir-perm /etc/corosync/qdevice/net 770')
addFilter(r'corosync-qdevice\.[^:]+: (E|W): dir-or-file-in-var-run /var/run/corosync-qdevice')
addFilter(r'corosync-qdevice\.[^:]+: (E|W): non-standard-dir-perm /var/run/corosync-qdevice 770')
# qnetd coroqnetd group directories
addFilter(r'corosync-qnetd\.[^:]+: (E|W): non-standard-(u|g)id /etc/corosync/qnetd coroqnetd')
addFilter(r'corosync-qnetd\.[^:]+: (E|W): non-standard-(u|g)id /var/run/corosync-qnetd coroqnetd')
addFilter(r'corosync-qnetd\.[^:]+: (E|W): non-standard-dir-perm /etc/corosync/qnetd 770')
addFilter(r'corosync-qnetd\.[^:]+: (E|W): dir-or-file-in-var-run /var/run/corosync-qnetd')
addFilter(r'corosync-qnetd\.[^:]+: (E|W): non-standard-dir-perm /var/run/corosync-qnetd 770')
# Empty %postun
addFilter(r'W: empty-%postun')
# Spelling error init
addFilter(r'W: spelling-error %description -l en_US init')

248
corosync-qdevice.spec Normal file
View File

@ -0,0 +1,248 @@
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features
%bcond_with runautogen
%bcond_without systemd
%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
%global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
Name: corosync-qdevice
Summary: The Corosync Cluster Engine Qdevice
Version: 3.0.0
Release: 10%{?gitver}%{?dist}
License: BSD
URL: https://github.com/corosync/corosync-qdevice
Source0: https://github.com/corosync/corosync-qdevice/releases/download/v%{version}%{?gittarver}/%{name}-%{version}%{?gittarver}.tar.gz
# Runtime bits
Requires: corosync >= 2.4.0
Requires: corosynclib >= 2.4.0
Requires: nss-tools
%if %{with systemd}
%{?systemd_requires}
BuildRequires: systemd
BuildRequires: systemd-devel
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
%endif
# Build bits
BuildRequires: gcc
BuildRequires: corosynclib-devel
BuildRequires: libqb-devel
BuildRequires: sed
BuildRequires: groff
BuildRequires: nss-devel
%if %{with runautogen}
BuildRequires: autoconf automake libtool
%endif
%prep
%setup -q -n %{name}-%{version}%{?gittarver}
%build
%if %{with runautogen}
./autogen.sh
%endif
%{configure} \
%if %{with systemd}
--enable-systemd \
%endif
--enable-qdevices \
--enable-qnetd \
--with-initddir=%{_initrddir} \
--with-systemddir=%{_unitdir} \
--docdir=%{_docdir}
%make_build
%install
%make_install
## tree fixup
# drop docs and html docs for now
rm -rf %{buildroot}%{_docdir}/*
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
# /etc/sysconfig/corosync-qdevice
install -p -m 644 init/corosync-qdevice.sysconfig.example \
%{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
# /etc/sysconfig/corosync-qnetd
install -p -m 644 init/corosync-qnetd.sysconfig.example \
%{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
%if %{with systemd}
sed -i -e 's/^#User=/User=/' \
%{buildroot}%{_unitdir}/corosync-qnetd.service
%else
sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
%{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
%endif
%description
This package contains the Corosync Cluster Engine Qdevice, script for creating
NSS certificates and an init script.
%post
%if %{with systemd} && 0%{?systemd_post:1}
%systemd_post corosync-qdevice.service
%else
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add corosync-qdevice || :
fi
%endif
%preun
%if %{with systemd} && 0%{?systemd_preun:1}
%systemd_preun corosync-qdevice.service
%else
if [ $1 -eq 0 ]; then
/sbin/service corosync-qdevice stop &>/dev/null || :
/sbin/chkconfig --del corosync-qdevice || :
fi
%endif
%postun
%if %{with systemd} && 0%{?systemd_postun:1}
%systemd_postun corosync-qdevice.service
%endif
%files
%license LICENSE
%dir %{_sysconfdir}/corosync/qdevice
%dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
%dir %{_localstatedir}/run/corosync-qdevice
%{_sbindir}/corosync-qdevice
%{_sbindir}/corosync-qdevice-net-certutil
%{_sbindir}/corosync-qdevice-tool
%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
%if %{with systemd}
%{_unitdir}/corosync-qdevice.service
%else
%{_initrddir}/corosync-qdevice
%endif
%{_mandir}/man8/corosync-qdevice-tool.8*
%{_mandir}/man8/corosync-qdevice-net-certutil.8*
%{_mandir}/man8/corosync-qdevice.8*
%package -n corosync-qnetd
Summary: The Corosync Cluster Engine Qdevice Network Daemon
Requires: nss-tools
Requires(pre): shadow-utils
%if %{with systemd}
%{?systemd_requires}
%endif
%description -n corosync-qnetd
This package contains the Corosync Cluster Engine Qdevice Network Daemon,
script for creating NSS certificates and an init script.
%pre -n corosync-qnetd
getent group coroqnetd >/dev/null || groupadd -r coroqnetd
getent passwd coroqnetd >/dev/null || \
useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
exit 0
%post -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_post:1}
%systemd_post corosync-qnetd.service
%else
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add corosync-qnetd || :
fi
%endif
%preun -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_preun:1}
%systemd_preun corosync-qnetd.service
%else
if [ $1 -eq 0 ]; then
/sbin/service corosync-qnetd stop &>/dev/null || :
/sbin/chkconfig --del corosync-qnetd || :
fi
%endif
%postun -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_postun:1}
%systemd_postun corosync-qnetd.service
%endif
%files -n corosync-qnetd
%license LICENSE
%dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
%{_bindir}/corosync-qnetd
%{_bindir}/corosync-qnetd-certutil
%{_bindir}/corosync-qnetd-tool
%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
%if %{with systemd}
%{_unitdir}/corosync-qnetd.service
%else
%{_initrddir}/corosync-qnetd
%endif
%{_mandir}/man8/corosync-qnetd-tool.8*
%{_mandir}/man8/corosync-qnetd-certutil.8*
%{_mandir}/man8/corosync-qnetd.8*
%changelog
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 22 2020 Jan Friesse <jfriesse@redhat.com> - 3.0.0-9
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Wed May 13 2020 Jan Friesse <jfriesse@redhat.com> - 3.0.0-8
- Really rebuild for the new libqb
* Wed May 13 2020 Jan Friesse <jfriesse@redhat.com> - 3.0.0-7
- Rebuild for new libqb
* Thu Mar 26 2020 Jan Friesse <jfriesse@redhat.com> - 3.0.0-6
- Add CI tests
- Enable gating
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Mar 20 2019 Jan Friesse <jfriesse@redhat.com> - 3.0.0-3
- Add license and use install -p
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Dec 12 2018 Jan Friesse <jfriesse@redhat.com> - 3.0.0-1
- New upstream release
* Fri Nov 23 2018 Jan Friesse <jfriesse@redhat.com> - 2.93.0-1
- New upstream release
* Thu Aug 09 2018 Jan Friesse <jfriesse@redhat.com> - 2.92.0-1
- New upstream release
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.91.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Apr 27 2018 Jan Friesse <jfriesse@redhat.com> - 2.91.0-1
- New upstream release
* Thu Mar 22 2018 Jan Friesse <jfriesse@redhat.com> - 2.90.0-4
- Rebuild for new Corosync
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.90.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jan 24 2018 Jan Friesse <jfriesse@redhat.com> - 2.90.0-2
- Fix spec file according to advices given in review by
Robert-André Mauchin <zebob.m@gmail.com>
* Tue Jan 23 2018 Jan Friesse <jfriesse@redhat.com> - 2.90.0-1
- First upstream packaged version of corosync for rawhide review.

15
gating.yaml Normal file
View File

@ -0,0 +1,15 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (corosync-qdevice-3.0.0.tar.gz) = fca0e9be41cd7d938c7003e62b585cd67ac082dd546ea86a77d48747aeb89caca5fb87a4753bcb968c2b9de584361d0dc44b35a88c1465fc041c2fdf0bf61cd4

3
tests/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Ignore tests runs/artefacts.
artifacts/**
**/*.retry

348
tests/smoke/runtest.sh Normal file
View File

@ -0,0 +1,348 @@
#!/bin/bash
# This file was autogenerated at 2019-05-13T13:43:38+02:00 from 90bd97ada89befa1a63133335a419ad7311c3d75
# Copyright (c) 2019, Red Hat, Inc.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RED HAT, INC. DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RED HAT, INC. BE LIABLE
# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Author: Jan Friesse <jfriesse@redhat.com>
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Script overwrites corosync.conf, authkey and qdevice/qnetd certificates !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Home https://github.com/jfriesse/csts/tree/master/smoke
# -e is really important
set -xe
set -o pipefail
# Variables changing test behavior
PREFIX="/"
COROSYNC_SYSCONFD="${PREFIX}etc/corosync"
COROSYNC_CONF="${COROSYNC_SYSCONFD}/corosync.conf"
COROSYNC_AUTHKEY="${COROSYNC_SYSCONFD}/authkey"
COROSYNC_CLUSTER_NAME="smoketestcluster"
TOKEN_TIMEOUT=1000
MAX_REPEATS=60
####################
# Helper functions #
####################
get_ip() {
ip_res=$(ip route get 8.8.8.8)
# Format is "8.8.8.8 via ROUTE_IPADDR dev DEV src IPADDR uid NUMBER"
# Remove everything up to "src " and then everything after " "
addr=${ip_res##*src }
addr=${addr%% *}
echo "$addr"
}
# generate_corosync_conf crypto [token] [qdevice]
# crypto can be on or off
# when token is defined it is used for token timeout
# when qdevice is set to on qdevice section is created and second node is added
generate_corosync_conf() {
case "$1" in
"on")
cipher="aes256"
hash="sha256"
;;
"off")
cipher="none"
hash="none"
;;
*)
# Unknown crypto
exit 1
esac
token=$TOKEN_TIMEOUT
if [ ! -z "$2" ];then
token="$2"
fi
qdevice="$3"
true_command=`which true`
cat << _EOF_
totem {
version: 2
cluster_name: $COROSYNC_CLUSTER_NAME
transport: knet
crypto_cipher: $cipher
crypto_hash: $hash
token: $token
}
logging {
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
}
quorum {
provider: corosync_votequorum
_EOF_
if [ "$qdevice" == "on" ];then
cat << _EOF_
device {
votes: 1
model: net
net {
host: $LOCAL_IP
algorithm: ffsplit
}
heuristics {
mode: sync
exec_true: $true_command
}
}
_EOF_
fi
cat << _EOF_
}
nodelist {
node {
nodeid: 1
ring0_addr: $LOCAL_IP
}
_EOF_
if [ "$qdevice" == "on" ];then
cat << _EOF_
node {
nodeid: 2
ring0_addr: 192.0.2.2
}
_EOF_
fi
cat << _EOF_
}
_EOF_
}
# service_start service
service_start() {
# service service must be inactive
systemctl is-active "$1" && exit 1 || true
systemctl start "$1"
systemctl is-active "$1"
}
# service_stop service
service_stop() {
systemctl is-active "$1" || exit 1
systemctl stop "$1"
systemctl is-active "$1" && exit 1 || true
}
######################
# Computed variables #
######################
LOCAL_IP=$(get_ip)
##################
# C test sources #
##################
# Test sources are encoded as a base64 string and piped to base64 to store them in /tmp
##################
# Test functions #
##################
test_corosync_qdevice_h() {
# Check that corosync-qdevice(-tool) binary exists and -h returns help text
res=`corosync-qdevice -h || true`
[ "$res" != "${res/usage/}" ]
res=`corosync-qdevice-tool -h || true`
[ "$res" != "${res/usage/}" ]
}
test_corosync_qnetd_h() {
# Check that corosync-qnetd(-tool) binary exists and -h returns help text
res=`corosync-qnetd -h || true`
[ "$res" != "${res/usage/}" ]
res=`corosync-qnetd-tool -h || true`
[ "$res" != "${res/usage/}" ]
}
test_crt_creation() {
# Erase old certificates
rm -rf "$COROSYNC_SYSCONFD/qdevice/net/nssdb"
rm -rf "$COROSYNC_SYSCONFD/qnetd/nssdb"
corosync-qnetd-certutil -i
corosync-qdevice-net-certutil -i -c "$COROSYNC_SYSCONFD/qnetd/nssdb/qnetd-cacert.crt"
corosync-qdevice-net-certutil -r -n "$COROSYNC_CLUSTER_NAME"
corosync-qnetd-certutil -s -c "$COROSYNC_SYSCONFD/qdevice/net/nssdb/qdevice-net-node.crq" -n "$COROSYNC_CLUSTER_NAME"
corosync-qdevice-net-certutil -M -c "$COROSYNC_SYSCONFD/qnetd/nssdb/cluster-$COROSYNC_CLUSTER_NAME.crt"
}
test_qnetd_start() {
service_start "corosync-qnetd"
}
test_qdevice_start() {
service_start "corosync-qdevice"
}
test_corosync_start() {
generate_corosync_conf "off" "" "on" > "$COROSYNC_CONF"
cat "$COROSYNC_CONF"
service_start "corosync"
}
test_qdevice_stop() {
service_stop "corosync-qdevice"
}
test_qnetd_stop() {
service_stop "corosync-qnetd"
}
test_corosync_stop() {
service_stop "corosync"
}
# test_corosync_quorumtool quorate
# quorate can be yes or no
test_corosync_quorumtool() {
quorumtool_res_file=`mktemp`
# This is already fixed in upstream db38e3958c4f88d5d06e8f7c83d6d90334d9fbd2
(corosync-quorumtool -ips || true) | tee "$quorumtool_res_file"
# Ensure this is single node cluster
grep -qi '^Nodes:.*1$' "$quorumtool_res_file"
# Current node id is 1
grep -qi '^Node ID:.*1$' "$quorumtool_res_file"
# Is quorate (libquorum)
if [ "$1" == "yes" ];then
grep -qi '^Quorate:.*Yes$' "$quorumtool_res_file"
else
grep -qi '^Quorate:.*No$' "$quorumtool_res_file"
fi
# Quorum is 2
grep -qi '^Quorum:.*2' "$quorumtool_res_file"
# Is quorate (libvotequorum)
if [ "$1" == "yes" ];then
grep -qi '^Flags:.*Quorate' "$quorumtool_res_file"
fi
rm -f "$quorumtool_res_file"
}
# Test corosync-qdevice-tool by waiting for connected state and
# checking heuristics results
test_qdevice_tool() {
qdevice_tool_res_file=`mktemp`
cont=true
repeats=0
while $cont;do
corosync-qdevice-tool -s | tee "$qdevice_tool_res_file"
if grep -qi '^State:.*Connected' "$qdevice_tool_res_file";then
cont=false
else
repeats=$((repeats+1))
[ "$repeats" -le "$MAX_REPEATS" ]
sleep 1
fi
done
corosync-qdevice-tool -sv | tee "$qdevice_tool_res_file"
grep -qi '^Heuristics result:.*Pass ' "$qdevice_tool_res_file"
rm -f "$qdevice_tool_res_file"
}
# Test qnetd tool -s (check connected clients/clusters) and -l
# (check node id, membership and heuristics)
test_qnetd_tool() {
qnetd_tool_res_file=`mktemp`
corosync-qnetd-tool -s | tee "$qnetd_tool_res_file"
grep -qi '^Connected clients:.*1$' "$qnetd_tool_res_file"
grep -qi '^Connected clusters:.*1$' "$qnetd_tool_res_file"
corosync-qnetd-tool -sv | tee "$qnetd_tool_res_file"
corosync-qnetd-tool -l | tee "$qnetd_tool_res_file"
grep -qi "^Cluster \"$COROSYNC_CLUSTER_NAME\":\$" "$qnetd_tool_res_file"
grep -qi 'Node ID 1:$' "$qnetd_tool_res_file"
grep -qi 'Membership node list:.*1$' "$qnetd_tool_res_file"
grep -qi 'Heuristics:.*Pass$' "$qnetd_tool_res_file"
corosync-qnetd-tool -lv | tee "$qnetd_tool_res_file"
rm -f "$qnetd_tool_res_file" "$qnetd_tool_res_file"
}
test_qdevice_qnetd_man_pages() {
# At least these man pages should be installed
expected_mp="corosync-qnetd corosync-qnetd-certutil corosync-qnetd-tool
corosync-qdevice corosync-qdevice-net-certutil corosync-qdevice-tool"
for mp in $expected_mp;do
man -w "$mp"
done
}
########
# main #
########
if [ -z "$PREFIX" ];then
echo "PREFIX not defined. Do not run *.inc.sh directly"
exit 1
fi
test_corosync_qdevice_h
test_corosync_qnetd_h
test_qdevice_qnetd_man_pages
test_crt_creation
test_qnetd_start
test_corosync_start
test_corosync_quorumtool "no"
test_qdevice_start
test_qdevice_tool
test_qnetd_tool
test_corosync_quorumtool "yes"
test_qdevice_stop
test_corosync_stop
test_qnetd_stop

11
tests/tests.yml Normal file
View File

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
tests:
- smoke
required_packages:
- iproute
- corosync-qdevice
- corosync-qnetd