Accepting request 517168 from network:ha-clustering:Factory

OBS-URL: https://build.opensuse.org/request/show/517168
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/corosync?expand=0&rev=41
This commit is contained in:
Dominique Leuenberger 2017-08-24 16:26:45 +00:00 committed by Git OBS Bridge
commit 5c4257f128
4 changed files with 525 additions and 161 deletions

370
0010-fix-ifdown-udp.patch Normal file
View File

@ -0,0 +1,370 @@
From 790794bc1f654fd1b4c8c2904c8d5c60374b99c1 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Mon, 31 Jul 2017 18:05:18 +0200
Subject: [PATCH] totemudp: Add local loop support for unicast msgs
This patch intends to solve long time ifdown corosync problem. Idea is
to use multicast local socket also for sending unicast messages.
Together with testing what is current bind state it's possible to keep
pretending existence of old IP address instead of rebinding to localhost
what breaks a lot things badly.
Heavilly based on Yu, Zou <zouyu@shiqichuban.com> work. Also big thanks
to Bin Liu <bliu@suse.com> for testing and bringing some ideas.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
---
exec/totemudp.c | 215 +++++++++++++++++++++++++++++++++-----------------------
1 file changed, 128 insertions(+), 87 deletions(-)
diff --git a/exec/totemudp.c b/exec/totemudp.c
index 31d05704..47830e4b 100644
--- a/exec/totemudp.c
+++ b/exec/totemudp.c
@@ -207,8 +207,6 @@ static int totemudp_build_sockets (
struct totemudp_socket *sockets,
struct totem_ip_address *bound_to);
-static struct totem_ip_address localhost;
-
static void totemudp_instance_initialize (struct totemudp_instance *instance)
{
memset (instance, 0, sizeof (struct totemudp_instance));
@@ -269,6 +267,7 @@ static inline void ucast_sendmsg (
struct sockaddr_storage sockaddr;
struct iovec iovec;
int addrlen;
+ int send_sock;
/*
* Encrypt and digest the message
@@ -313,11 +312,19 @@ static inline void ucast_sendmsg (
#endif
+ if (instance->netif_bind_state == BIND_STATE_REGULAR) {
+ send_sock = instance->totemudp_sockets.mcast_send;
+ } else {
+ send_sock = instance->totemudp_sockets.local_mcast_loop[1];
+ msg_ucast.msg_name = NULL;
+ msg_ucast.msg_namelen = 0;
+ }
+
/*
* Transmit unicast message
* An error here is recovered by totemsrp
*/
- res = sendmsg (instance->totemudp_sockets.mcast_send, &msg_ucast,
+ res = sendmsg (send_sock, &msg_ucast,
MSG_NOSIGNAL);
if (res < 0) {
LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
@@ -380,18 +387,20 @@ static inline void mcast_sendmsg (
msg_mcast.msg_accrightslen = 0;
#endif
- /*
- * Transmit multicast message
- * An error here is recovered by totemsrp
- */
- res = sendmsg (instance->totemudp_sockets.mcast_send, &msg_mcast,
- MSG_NOSIGNAL);
- if (res < 0) {
- LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
- "sendmsg(mcast) failed (non-critical)");
- instance->stats->continuous_sendmsg_failures++;
- } else {
- instance->stats->continuous_sendmsg_failures = 0;
+ if (instance->netif_bind_state == BIND_STATE_REGULAR) {
+ /*
+ * Transmit multicast message
+ * An error here is recovered by totemsrp
+ */
+ res = sendmsg (instance->totemudp_sockets.mcast_send, &msg_mcast,
+ MSG_NOSIGNAL);
+ if (res < 0) {
+ LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
+ "sendmsg(mcast) failed (non-critical)");
+ instance->stats->continuous_sendmsg_failures++;
+ } else {
+ instance->stats->continuous_sendmsg_failures = 0;
+ }
}
/*
@@ -556,7 +565,6 @@ static void timer_function_netif_check_timeout (
struct totemudp_instance *instance = (struct totemudp_instance *)data;
int interface_up;
int interface_num;
- struct totem_ip_address *bind_address;
/*
* Build sockets for every interface
@@ -593,28 +601,31 @@ static void timer_function_netif_check_timeout (
qb_loop_poll_del (instance->totemudp_poll_handle,
instance->totemudp_sockets.mcast_recv);
close (instance->totemudp_sockets.mcast_recv);
+ instance->totemudp_sockets.mcast_recv = -1;
}
if (instance->totemudp_sockets.mcast_send > 0) {
close (instance->totemudp_sockets.mcast_send);
- }
- if (instance->totemudp_sockets.local_mcast_loop[0] > 0) {
- qb_loop_poll_del (instance->totemudp_poll_handle,
- instance->totemudp_sockets.local_mcast_loop[0]);
- close (instance->totemudp_sockets.local_mcast_loop[0]);
- close (instance->totemudp_sockets.local_mcast_loop[1]);
+ instance->totemudp_sockets.mcast_send = -1;
}
if (instance->totemudp_sockets.token > 0) {
qb_loop_poll_del (instance->totemudp_poll_handle,
instance->totemudp_sockets.token);
close (instance->totemudp_sockets.token);
+ instance->totemudp_sockets.token = -1;
}
if (interface_up == 0) {
+ if (instance->netif_bind_state == BIND_STATE_UNBOUND) {
+ log_printf (instance->totemudp_log_level_error,
+ "One of your ip addresses are now bound to localhost. "
+ "Corosync would not work correctly.");
+ exit(COROSYNC_DONE_FATAL_ERR);
+ }
+
/*
* Interface is not up
*/
instance->netif_bind_state = BIND_STATE_LOOPBACK;
- bind_address = &localhost;
/*
* Add a timer to retry building interfaces and request memb_gather_enter
@@ -630,34 +641,29 @@ static void timer_function_netif_check_timeout (
* Interface is up
*/
instance->netif_bind_state = BIND_STATE_REGULAR;
- bind_address = &instance->totem_interface->bindnet;
}
/*
* Create and bind the multicast and unicast sockets
*/
(void)totemudp_build_sockets (instance,
&instance->mcast_address,
- bind_address,
+ &instance->totem_interface->bindnet,
&instance->totemudp_sockets,
&instance->totem_interface->boundto);
- qb_loop_poll_add (
- instance->totemudp_poll_handle,
- QB_LOOP_MED,
- instance->totemudp_sockets.mcast_recv,
- POLLIN, instance, net_deliver_fn);
-
- qb_loop_poll_add (
- instance->totemudp_poll_handle,
- QB_LOOP_MED,
- instance->totemudp_sockets.local_mcast_loop[0],
- POLLIN, instance, net_deliver_fn);
+ if (instance->netif_bind_state == BIND_STATE_REGULAR) {
+ qb_loop_poll_add (
+ instance->totemudp_poll_handle,
+ QB_LOOP_MED,
+ instance->totemudp_sockets.mcast_recv,
+ POLLIN, instance, net_deliver_fn);
- qb_loop_poll_add (
- instance->totemudp_poll_handle,
- QB_LOOP_MED,
- instance->totemudp_sockets.token,
- POLLIN, instance, net_deliver_fn);
+ qb_loop_poll_add (
+ instance->totemudp_poll_handle,
+ QB_LOOP_MED,
+ instance->totemudp_sockets.token,
+ POLLIN, instance, net_deliver_fn);
+ }
totemip_copy (&instance->my_id, &instance->totem_interface->boundto);
@@ -708,6 +714,66 @@ static void totemudp_traffic_control_set(struct totemudp_instance *instance, int
#endif
}
+static int totemudp_build_local_sockets(
+ struct totemudp_instance *instance,
+ struct totemudp_socket *sockets)
+{
+ int i;
+ unsigned int sendbuf_size;
+ unsigned int recvbuf_size;
+ unsigned int optlen = sizeof (sendbuf_size);
+ int res;
+
+ /*
+ * Create local multicast loop socket
+ */
+ if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets->local_mcast_loop) == -1) {
+ LOGSYS_PERROR (errno, instance->totemudp_log_level_warning,
+ "socket() failed");
+ return (-1);
+ }
+
+ for (i = 0; i < 2; i++) {
+ totemip_nosigpipe (sockets->local_mcast_loop[i]);
+ res = fcntl (sockets->local_mcast_loop[i], F_SETFL, O_NONBLOCK);
+ if (res == -1) {
+ LOGSYS_PERROR (errno, instance->totemudp_log_level_warning,
+ "Could not set non-blocking operation on multicast socket");
+ return (-1);
+ }
+ }
+
+ recvbuf_size = MCAST_SOCKET_BUFFER_SIZE;
+ sendbuf_size = MCAST_SOCKET_BUFFER_SIZE;
+
+ res = setsockopt (sockets->local_mcast_loop[0], SOL_SOCKET, SO_RCVBUF, &recvbuf_size, optlen);
+ if (res == -1) {
+ LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
+ "Unable to set SO_RCVBUF size on UDP local mcast loop socket");
+ return (-1);
+ }
+ res = setsockopt (sockets->local_mcast_loop[1], SOL_SOCKET, SO_SNDBUF, &sendbuf_size, optlen);
+ if (res == -1) {
+ LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
+ "Unable to set SO_SNDBUF size on UDP local mcast loop socket");
+ return (-1);
+ }
+
+ res = getsockopt (sockets->local_mcast_loop[0], SOL_SOCKET, SO_RCVBUF, &recvbuf_size, &optlen);
+ if (res == 0) {
+ log_printf (instance->totemudp_log_level_debug,
+ "Local receive multicast loop socket recv buffer size (%d bytes).", recvbuf_size);
+ }
+
+ res = getsockopt (sockets->local_mcast_loop[1], SOL_SOCKET, SO_SNDBUF, &sendbuf_size, &optlen);
+ if (res == 0) {
+ log_printf (instance->totemudp_log_level_debug,
+ "Local transmit multicast loop socket send buffer size (%d bytes).", sendbuf_size);
+ }
+
+ return (0);
+}
+
static int totemudp_build_sockets_ip (
struct totemudp_instance *instance,
struct totem_ip_address *mcast_address,
@@ -730,7 +796,8 @@ static int totemudp_build_sockets_ip (
int res;
int flag;
uint8_t sflag;
- int i;
+
+
/*
* Create multicast recv socket
@@ -760,24 +827,6 @@ static int totemudp_build_sockets_ip (
return (-1);
}
- /*
- * Create local multicast loop socket
- */
- if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets->local_mcast_loop) == -1) {
- LOGSYS_PERROR (errno, instance->totemudp_log_level_warning,
- "socket() failed");
- return (-1);
- }
-
- for (i = 0; i < 2; i++) {
- totemip_nosigpipe (sockets->local_mcast_loop[i]);
- res = fcntl (sockets->local_mcast_loop[i], F_SETFL, O_NONBLOCK);
- if (res == -1) {
- LOGSYS_PERROR (errno, instance->totemudp_log_level_warning,
- "Could not set non-blocking operation on multicast socket");
- return (-1);
- }
- }
@@ -875,18 +924,6 @@ static int totemudp_build_sockets_ip (
"Unable to set SO_SNDBUF size on UDP mcast socket");
return (-1);
}
- res = setsockopt (sockets->local_mcast_loop[0], SOL_SOCKET, SO_RCVBUF, &recvbuf_size, optlen);
- if (res == -1) {
- LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
- "Unable to set SO_RCVBUF size on UDP local mcast loop socket");
- return (-1);
- }
- res = setsockopt (sockets->local_mcast_loop[1], SOL_SOCKET, SO_SNDBUF, &sendbuf_size, optlen);
- if (res == -1) {
- LOGSYS_PERROR (errno, instance->totemudp_log_level_debug,
- "Unable to set SO_SNDBUF size on UDP local mcast loop socket");
- return (-1);
- }
res = getsockopt (sockets->mcast_recv, SOL_SOCKET, SO_RCVBUF, &recvbuf_size, &optlen);
if (res == 0) {
@@ -900,17 +937,6 @@ static int totemudp_build_sockets_ip (
"Transmit multicast socket send buffer size (%d bytes).", sendbuf_size);
}
- res = getsockopt (sockets->local_mcast_loop[0], SOL_SOCKET, SO_RCVBUF, &recvbuf_size, &optlen);
- if (res == 0) {
- log_printf (instance->totemudp_log_level_debug,
- "Local receive multicast loop socket recv buffer size (%d bytes).", recvbuf_size);
- }
-
- res = getsockopt (sockets->local_mcast_loop[1], SOL_SOCKET, SO_SNDBUF, &sendbuf_size, &optlen);
- if (res == 0) {
- log_printf (instance->totemudp_log_level_debug,
- "Local transmit multicast loop socket send buffer size (%d bytes).", sendbuf_size);
- }
/*
@@ -1178,8 +1204,19 @@ int totemudp_initialize (
instance->totemudp_target_set_completed = target_set_completed;
- totemip_localhost (instance->mcast_address.family, &localhost);
- localhost.nodeid = instance->totem_config->node_id;
+ /*
+ * Create static local mcast sockets
+ */
+ if (totemudp_build_local_sockets(instance, &instance->totemudp_sockets) == -1) {
+ free(instance);
+ return (-1);
+ }
+
+ qb_loop_poll_add (
+ instance->totemudp_poll_handle,
+ QB_LOOP_MED,
+ instance->totemudp_sockets.local_mcast_loop[0],
+ POLLIN, instance, net_deliver_fn);
/*
* RRP layer isn't ready to receive message because it hasn't
@@ -1242,10 +1279,14 @@ int totemudp_recv_flush (void *udp_context)
for (i = 0; i < 2; i++) {
sock = -1;
if (i == 0) {
- sock = instance->totemudp_sockets.mcast_recv;
+ if (instance->netif_bind_state == BIND_STATE_REGULAR) {
+ sock = instance->totemudp_sockets.mcast_recv;
+ } else {
+ continue ;
+ }
}
if (i == 1) {
- sock = instance->totemudp_sockets.local_mcast_loop[0];
+ sock = instance->totemudp_sockets.local_mcast_loop[0];
}
assert(sock != -1);
--
2.12.3

View File

@ -0,0 +1,9 @@
--- corosync-2.4.2.orig/tools/corosync-notifyd.sysconfig.example 2016-11-08 00:39:12.000000000 +0800
+++ corosync-2.4.2/tools/corosync-notifyd.sysconfig.example 2017-08-16 11:41:00.485913615 +0800
@@ -6,5 +6,4 @@
#
# Send DBUS signals on all events (for SNMP traps, use -s)
-OPTIONS="-d"
-
+# OPTIONS="-d"

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Tue Aug 8 08:17:27 UTC 2017 - jengelh@inai.de
- Fix RPM groups.
-------------------------------------------------------------------
Thu Aug 3 02:50:00 UTC 2017 - bliu@suse.com
- L3: corosync: assert(sender_node != NULL) fails after tearing down a network interface(bsc#1032634)
Added: 0010-fix-ifdown-udp.patch
- Fix rpmlint warnings
Added: 0011-fix-tmpfiles-create.patch
-------------------------------------------------------------------
Thu Aug 3 02:49:21 UTC 2017 - bliu@suse.com
- some errors in spec file(bsc#1047862)
Modified:corosync.spec
1) as in openSUSE:factory, there are %define, but bcond_with coudld be toggled by osc command , change %define to %bcond_with and %bcond_without
2) change service_del_postun to service_del_preun, since service_del_postun is not a right macro
-------------------------------------------------------------------
Mon Jul 31 02:54:49 UTC 2017 - bliu@suse.com
- make corosync.spec uniform (bsc#1051385)
Modified: corosync.spec
1. there are some lines are commented in corosync.spec, will define new macro to make these lines uncommented
2. in former, xmlconf, rdma and snmp were disabled, these features are wrongly enabled, will disable them
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jul 12 05:25:45 UTC 2017 - bliu@suse.com Wed Jul 12 05:25:45 UTC 2017 - bliu@suse.com

View File

@ -16,22 +16,26 @@
# #
#%global dirty dirty
# Conditionals # Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>" # Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features # to disable or enable specific features
%define with_testagents 1 %bcond_without testagents
%define with_watchdog 1 %bcond_with watchdog
#%define with_monitoring 0 %bcond_with monitoring
%define with_snmp 1 %bcond_with snmp
#%define with_dbus 1 %bcond_with rdma
%define with_rdma 1 %bcond_with dbus
%define with_systemd 1 %bcond_with upstart
%define with_xmlconf 1 %bcond_with xmlconf
%define with_runautogen 1 %bcond_without runautogen
%define with_qdevices 1 %bcond_without systemd
%define with_qnetd 1 %bcond_without qdevices
%bcond_without qnetd
%if !%{defined tmpfiles_create}
%define tmpfiles_create systemd-tmpfiles --create ||:
%endif
%if 0%{?sles_version} == 12 %if 0%{?sles_version} == 12
%ifnarch s390 s390x %ifnarch s390 s390x
%define buildib 1 %define buildib 1
@ -47,7 +51,6 @@ License: BSD-3-Clause
Group: Productivity/Clustering/HA Group: Productivity/Clustering/HA
Version: 2.4.2 Version: 2.4.2
Release: 0 Release: 0
#Release: 1%{?gitver}%{?dist}
Url: http://corosync.github.io/corosync/ Url: http://corosync.github.io/corosync/
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Source2: baselibs.conf Source2: baselibs.conf
@ -70,6 +73,8 @@ Patch16: 0006-coroapi-Use-size_t-for-private_data_size.patch
Patch17: 0007-Make-corosync-work-when-FIPS-mode-is-enabled.patch Patch17: 0007-Make-corosync-work-when-FIPS-mode-is-enabled.patch
Patch18: 0008-main.c-add-option-to-set-priority.patch Patch18: 0008-main.c-add-option-to-set-priority.patch
Patch19: 0009-totem-Propagate-totem-initialization-failure.patch Patch19: 0009-totem-Propagate-totem-initialization-failure.patch
Patch20: 0010-fix-ifdown-udp.patch
Patch21: 0011-fix-tmpfiles-create.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# openais is indeed gone and should be uninstalled. Yes, we do not # openais is indeed gone and should be uninstalled. Yes, we do not
@ -81,7 +86,6 @@ Conflicts: openais < 1.2
Requires: libcorosync4 = %{version}-%{release} Requires: libcorosync4 = %{version}-%{release}
Requires(pre): /usr/sbin/useradd Requires(pre): /usr/sbin/useradd
Requires(post): /sbin/chkconfig Requires(post): /sbin/chkconfig
Requires(post): %insserv_prereq %fillup_prereq
Requires(preun): /sbin/chkconfig Requires(preun): /sbin/chkconfig
Conflicts: openais <= 0.89, openais-devel <= 0.89 Conflicts: openais <= 0.89, openais-devel <= 0.89
@ -91,37 +95,37 @@ BuildRequires: groff
BuildRequires: libqb-devel BuildRequires: libqb-devel
BuildRequires: mozilla-nss-devel BuildRequires: mozilla-nss-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
%if %{with_runautogen} %if %{with runautogen}
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: libtool BuildRequires: libtool
%endif %endif
#%if %{with monitoring} %if %{with monitoring}
#BuildRequires: libstatgrab-devel BuildRequires: libstatgrab-devel
#%endif %endif
%if %{with_rdma} %if %{with rdma}
BuildRequires: libibverbs-devel BuildRequires: libibverbs-devel
BuildRequires: librdmacm-devel BuildRequires: librdmacm-devel
%endif %endif
%if %{with_snmp} %if %{with snmp}
BuildRequires: net-snmp-devel BuildRequires: net-snmp-devel
%endif %endif
#%if %{with dbus} %if %{with dbus}
#BuildRequires: dbus-1-devel BuildRequires: dbus-1-devel
#%endif %endif
%if %{with_systemd} %if %{with systemd}
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
%endif %endif
%if %{with_xmlconf} %if %{with xmlconf}
Requires: libxslt Requires: libxslt
%endif %endif
%if %{with_qdevices} || %{with_qnetd} %if %{with qdevices} || %{with qnetd}
Requires: mozilla-nss-tools Requires: mozilla-nss-tools
%endif %endif
%if %{with_qnetd} %if %{with qnetd}
BuildRequires: sed BuildRequires: sed
%endif %endif
@ -148,41 +152,52 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
%patch17 -p1 %patch17 -p1
%patch18 -p1 %patch18 -p1
%patch19 -p1 %patch19 -p1
%patch20 -p1
%patch21 -p1
%build %build
%if %{with_runautogen} %if %{with runautogen}
./autogen.sh ./autogen.sh
%endif %endif
%if %{with_rdma} %if %{with rdma}
export ibverbs_CFLAGS=-I/usr/include/infiniband \ export ibverbs_CFLAGS=-I/usr/include/infiniband \
export ibverbs_LIBS=-libverbs \ export ibverbs_LIBS=-libverbs \
export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_CFLAGS=-I/usr/include/rdma \
export rdmacm_LIBS=-lrdmacm \ export rdmacm_LIBS=-lrdmacm \
%endif %endif
%{configure} \ %{configure} \
%if %{with_testagents} %if %{with testagents}
--enable-testagents \ --enable-testagents \
%endif %endif
%if %{with_watchdog} %if %{with watchdog}
--enable-watchdog \ --enable-watchdog \
%endif %endif
%if %{with_snmp} %if %{with monitoring}
--enable-monitoring \
%endif
%if %{with snmp}
--enable-snmp \ --enable-snmp \
%endif %endif
%if %{with_rdma} %if %{with dbus}
--enable-dbus \
%endif
%if %{with rdma}
--enable-rdma \ --enable-rdma \
%endif %endif
%if %{with_systemd} %if %{with systemd}
--enable-systemd \ --enable-systemd \
%endif %endif
%if %{with_xmlconf} %if %{with upstart}
--enable-upstart \
%endif
%if %{with xmlconf}
--enable-xmlconf \ --enable-xmlconf \
%endif %endif
%if %{with_qdevices} %if %{with qdevices}
--enable-qdevices \ --enable-qdevices \
%endif %endif
%if %{with_qnetd} %if %{with qnetd}
--enable-qnetd \ --enable-qnetd \
%endif %endif
--with-initddir=%{_initrddir} \ --with-initddir=%{_initrddir} \
@ -197,12 +212,15 @@ rm -rf %{buildroot}
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
#%if %{with dbus} %if %{with dbus}
#mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d
#install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
#%endif %endif
%if %{with_systemd} %if %{with systemd}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync-qnetd
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync-qdevice
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync-notifyd
%endif %endif
## tree fixup ## tree fixup
@ -211,6 +229,8 @@ rm -f %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{_libdir}/*.la rm -f %{buildroot}%{_libdir}/*.la
# drop docs and html docs for now # drop docs and html docs for now
rm -rf %{buildroot}%{_docdir}/* rm -rf %{buildroot}%{_docdir}/*
#remove init scripts for corosync, corosync-qdevice, corosync-qnetd
rm -rf init/corosync init/corosync-qnetd init/corosync-qdevice
mkdir -p %{buildroot}/usr/lib/tmpfiles.d/ mkdir -p %{buildroot}/usr/lib/tmpfiles.d/
mkdir -p %{buildroot}/usr/share/doc/packages/corosync/ mkdir -p %{buildroot}/usr/share/doc/packages/corosync/
mkdir -p %{buildroot}/var/adm/fillup-templates/ mkdir -p %{buildroot}/var/adm/fillup-templates/
@ -219,35 +239,21 @@ install -m 0644 tools/corosync-notifyd.sysconfig.example %{buildroot}/usr/lib/t
install -m 0644 conf/corosync.conf.example* %{buildroot}/usr/share/doc/packages/corosync/ install -m 0644 conf/corosync.conf.example* %{buildroot}/usr/share/doc/packages/corosync/
rm -rf %{buildroot}/etc/corosync/corosync.conf.example* rm -rf %{buildroot}/etc/corosync/corosync.conf.example*
rm -rf %{buildroot}/etc/logrotate.d/ rm -rf %{buildroot}/etc/logrotate.d/
# /etc/sysconfig/corosync-notifyd
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 tools/corosync-notifyd.sysconfig.example \
%{buildroot}/usr/lib/tmpfiles.d/corosync-notifyd
# %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd
# /etc/sysconfig/corosync
install -m 644 init/corosync.sysconfig.example \ install -m 644 init/corosync.sysconfig.example \
%{buildroot}/var/adm/fillup-templates/sysconfig.corosync %{buildroot}/var/adm/fillup-templates/sysconfig.corosync
# %{buildroot}%{_sysconfdir}/sysconfig/corosync
#add init scripts for corosync, corosync-qdevice, corosync-qnetd
install -m 755 init/corosync %{buildroot}%{_sysconfdir}/init.d/corosync
install -m 755 init/corosync-qdevice %{buildroot}%{_sysconfdir}/init.d/corosync-qdevice
install -m 755 init/corosync-qnetd %{buildroot}%{_sysconfdir}/init.d/corosync-qnetd
rm -rf %{buildroot}%{localstatedir}/run/ rm -rf %{buildroot}%{localstatedir}/run/
%if %{with_qdevices} %if %{with qdevices}
# /etc/sysconfig/corosync-qdevice
install -m 644 init/corosync-qdevice.sysconfig.example \ install -m 644 init/corosync-qdevice.sysconfig.example \
%{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qdevice %{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qdevice
# %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
install -m 770 -d %{buildroot}/run/corosync-qdevice install -m 770 -d %{buildroot}/run/corosync-qdevice
%endif %endif
%if %{with_qnetd} %if %{with qnetd}
# /etc/sysconfig/corosync-qnetd
install -m 644 init/corosync-qnetd.sysconfig.example \ install -m 644 init/corosync-qnetd.sysconfig.example \
%{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qnetd %{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qnetd
# %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
install -m 770 -d %{buildroot}/run/corosync-qnetd install -m 770 -d %{buildroot}/run/corosync-qnetd
%if %{with_systemd} %if %{with systemd}
sed -i -e 's/^#User=/User=/' \ sed -i -e 's/^#User=/User=/' \
%{buildroot}%{_unitdir}/corosync-qnetd.service %{buildroot}%{_unitdir}/corosync-qnetd.service
sed -i -e 's/root/coroqnetd/g' \ sed -i -e 's/root/coroqnetd/g' \
@ -266,41 +272,25 @@ This package contains the Corosync Cluster Engine Executive, several default
APIs and libraries, default configuration files, and an init script. APIs and libraries, default configuration files, and an init script.
%pre %pre
%if %{with_systemd} %service_add_pre corosync.service corosync-notifyd.service
#%service_add_pre corosync.service corosync-notifyd.service
#we do not use corosync-notifyd.service
%service_add_pre corosync.service
%endif
%post %post
%tmpfiles_create /usr/lib/tmpfiles.d/corosync-notifyd
%{fillup_and_insserv -n corosync} %{fillup_and_insserv -n corosync}
%if %{with_systemd} %service_add_post corosync.service corosync-notifyd.service
#%service_add_post corosync.service corosync-notifyd.service
#we do not use corosync-notifyd.service
%service_add_post corosync.service
%endif
rm -rf %{_sysconfdir}/corosync/corosync.conf.example %{_sysconfdir}/corosync/corosync.conf.example.unicast rm -rf %{_sysconfdir}/corosync/corosync.conf.example %{_sysconfdir}/corosync/corosync.conf.example.unicast
ln -s /usr/share/doc/packages/corosync/corosync.conf.example %{_sysconfdir}/corosync/ ln -s /usr/share/doc/packages/corosync/corosync.conf.example %{_sysconfdir}/corosync/
ln -s /usr/share/doc/packages/corosync/corosync.conf.example.udpu %{_sysconfdir}/corosync/corosync.conf.example.unicast ln -s /usr/share/doc/packages/corosync/corosync.conf.example.udpu %{_sysconfdir}/corosync/corosync.conf.example.unicast
%preun %preun
%service_del_preun corosync.service corosync-notifyd.service
%if %{with_systemd}
%service_del_preun corosync.service
%else
if [ $1 -eq 0 ]; then
/sbin/service corosync stop &>/dev/null || :
/sbin/chkconfig --del corosync || :
fi
%endif
%postun %postun
if [ -f /etc/sysconfig/corosync ]; then if [ -f /etc/sysconfig/corosync ]; then
rm /etc/sysconfig/corosync rm /etc/sysconfig/corosync
fi fi
%if %{with_systemd} && 0%{?systemd_postun:1} %service_del_postun corosync.service corosync-notifyd.service
%systemd_postun
%endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -312,12 +302,12 @@ fi
%{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-cpgtool
%{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-quorumtool
%{_sbindir}/corosync-notifyd %{_sbindir}/corosync-notifyd
%{_sysconfdir}/init.d/corosync %if %{with systemd}
%if %{with_systemd}
%{_sbindir}/rccorosync %{_sbindir}/rccorosync
%{_sbindir}/rccorosync-notifyd
%endif %endif
%{_bindir}/corosync-blackbox %{_bindir}/corosync-blackbox
%if %{with_xmlconf} %if %{with xmlconf}
%{_bindir}/corosync-xmlproc %{_bindir}/corosync-xmlproc
%config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example
%dir %{_datadir}/corosync %dir %{_datadir}/corosync
@ -331,30 +321,25 @@ fi
%config(noreplace) /usr/share/doc/packages/corosync/corosync.conf.example %config(noreplace) /usr/share/doc/packages/corosync/corosync.conf.example
%config(noreplace) /usr/share/doc/packages/corosync/corosync.conf.example.udpu %config(noreplace) /usr/share/doc/packages/corosync/corosync.conf.example.udpu
%config(noreplace) /usr/lib/tmpfiles.d/corosync-notifyd %config(noreplace) /usr/lib/tmpfiles.d/corosync-notifyd
#%config(noreplace) %{_sysconfdir}/sysconfig/corosync
%config(noreplace) /var/adm/fillup-templates/sysconfig.corosync %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync
#%config(noreplace) %{_sysconfdir}/logrotate.d/corosync
#%if %{with dbus} %if %{with dbus}
#%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
#%endif %endif
%if %{with_snmp} %if %{with snmp}
%{_datadir}/snmp/mibs/COROSYNC-MIB.txt %{_datadir}/snmp/mibs/COROSYNC-MIB.txt
%endif %endif
%if %{with_systemd} %if %{with systemd}
%{_unitdir}/corosync.service %{_unitdir}/corosync.service
%{_unitdir}/corosync-notifyd.service %{_unitdir}/corosync-notifyd.service
%dir %{_datadir}/corosync %dir %{_datadir}/corosync
%{_datadir}/corosync/corosync %{_datadir}/corosync/corosync
%{_datadir}/corosync/corosync-notifyd %{_datadir}/corosync/corosync-notifyd
%else
%{_initrddir}/corosync
%{_initrddir}/corosync-notifyd
%endif %endif
#%if %{with_upstart} %if %{with upstart}
#%{_sysconfdir}/init/corosync.conf %{_sysconfdir}/init/corosync.conf
#%{_sysconfdir}/init/corosync-notifyd.conf %{_sysconfdir}/init/corosync-notifyd.conf
#%endif %endif
%dir %{_localstatedir}/lib/corosync %dir %{_localstatedir}/lib/corosync
%dir %{_localstatedir}/log/cluster %dir %{_localstatedir}/log/cluster
%{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync_overview.8*
@ -372,12 +357,12 @@ fi
%{_datadir}/doc/corosync/* %{_datadir}/doc/corosync/*
# optional testagent rpm # optional testagent rpm
# #
%if %{with_testagents} %if %{with testagents}
%package -n corosync-testagents %package -n corosync-testagents
Summary: The Corosync Cluster Engine Test Agents Summary: The Corosync Cluster Engine Test Agents
Group: Development/Libraries Group: Development/Tools/Other
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}
%description -n corosync-testagents %description -n corosync-testagents
This package contains corosync test agents. This package contains corosync test agents.
@ -402,10 +387,9 @@ This package contains corosync test agents.
Summary: The Corosync Cluster Engine Libraries Summary: The Corosync Cluster Engine Libraries
# openais is indeed gone and should be uninstalled. Yes, we do not # openais is indeed gone and should be uninstalled. Yes, we do not
# provide libopenais on purpose, the package has been deleted. # provide libopenais on purpose, the package has been deleted.
Group: Productivity/Clustering/HA Group: System/Libraries
Obsoletes: libopenais3 < 1.2 Obsoletes: libopenais3 < 1.2
Conflicts: libopenais3 < 1.2 Conflicts: libopenais3 < 1.2
#Requires: %{name} = %{version}-%{release}
%description -n libcorosync4 %description -n libcorosync4
This package contains corosync libraries. This package contains corosync libraries.
@ -428,7 +412,7 @@ This package contains corosync libraries.
%package -n libcorosync-devel %package -n libcorosync-devel
Summary: The Corosync Cluster Engine Development Kit Summary: The Corosync Cluster Engine Development Kit
Group: Productivity/Clustering/HA Group: Development/Libraries/C and C++
Requires: libcorosync4 = %{version}-%{release} Requires: libcorosync4 = %{version}-%{release}
Requires: libqb-devel Requires: libqb-devel
Requires: pkgconfig Requires: pkgconfig
@ -478,46 +462,37 @@ The Corosync Cluster Engine APIs.
%post -n libcorosync-devel -p /sbin/ldconfig %post -n libcorosync-devel -p /sbin/ldconfig
%postun -n libcorosync-devel -p /sbin/ldconfig %postun -n libcorosync-devel -p /sbin/ldconfig
# optional qdevices %if %{with qdevices}
#
%if %{with_qdevices}
%package -n corosync-qdevice %package -n corosync-qdevice
Summary: The Corosync Cluster Engine Qdevice Summary: The Corosync Cluster Engine Qdevice
Group: System Environment/Base Group: System/Base
Requires: corosync Requires: corosync
Requires: mozilla-nss-tools Requires: mozilla-nss-tools
%if %{with_systemd} %if %{with systemd}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
Requires(post): %insserv_prereq %fillup_prereq
%endif %endif
%description -n corosync-qdevice %description -n corosync-qdevice
This package contains the Corosync Cluster Engine Qdevice, script for creating This package contains the Corosync Cluster Engine Qdevice, script for creating
NSS certificates and an init script. NSS certificates and an init script.
%pre -n corosync-qdevice
%service_add_pre corosync-qdevice.service
%post -n corosync-qdevice %post -n corosync-qdevice
%{fillup_and_insserv -n corosync-qdevice} %{fillup_and_insserv -n corosync-qdevice}
#mkdir /run/corosync-qdevice
%if %{sles_version} > 0 %if %{sles_version} > 0
ln -s /run/corosync-qdevice /var/run/ ln -s /run/corosync-qdevice /var/run/
%endif %endif
%if %{with_systemd}
%service_add_post corosync-qdevice.service %service_add_post corosync-qdevice.service
%endif
%preun -n corosync-qdevice %preun -n corosync-qdevice
%if %{with_systemd}
%service_del_preun corosync-qdevice.service %service_del_preun corosync-qdevice.service
%else
if [ $1 -eq 0 ]; then
/sbin/service corosync-qdevice stop &>/dev/null || :
/sbin/chkconfig --del corosync-qdevice || :
fi
%endif
%if %{sles_version} %if %{sles_version}
unlink /var/run/corosync-qdevice unlink /var/run/corosync-qdevice
%endif %endif
@ -526,9 +501,7 @@ unlink /var/run/corosync-qdevice
if [ -f /etc/sysconfig/corosync-qdevice ]; then if [ -f /etc/sysconfig/corosync-qdevice ]; then
rm /etc/sysconfig/corosync-qdevice rm /etc/sysconfig/corosync-qdevice
fi fi
%if %{with_systemd} && 0%{?systemd_postun:1} %service_del_postun corosync-qdevice.service
%systemd_postun
%endif
%files -n corosync-qdevice %files -n corosync-qdevice
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -536,40 +509,33 @@ fi
%dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
#change corosync-qdevice to /run as /var/run is symlink nowdays #change corosync-qdevice to /run as /var/run is symlink nowdays
%ghost /run/corosync-qdevice %ghost /run/corosync-qdevice
#%dir %{_localstatedir}/run/corosync-qdevice
%{_sbindir}/corosync-qdevice %{_sbindir}/corosync-qdevice
%{_sbindir}/corosync-qdevice-net-certutil %{_sbindir}/corosync-qdevice-net-certutil
%{_sbindir}/corosync-qdevice-tool %{_sbindir}/corosync-qdevice-tool
%{_sysconfdir}/init.d/corosync-qdevice
%config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qdevice %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qdevice
#%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice %if %{with systemd}
%if %{with_systemd}
%{_unitdir}/corosync-qdevice.service %{_unitdir}/corosync-qdevice.service
%{_sbindir}/rccorosync-qdevice
%dir %{_datadir}/corosync %dir %{_datadir}/corosync
%{_datadir}/corosync/corosync-qdevice %{_datadir}/corosync/corosync-qdevice
%else
%{_initrddir}/corosync-qdevice
%endif %endif
%{_mandir}/man8/corosync-qdevice-tool.8* %{_mandir}/man8/corosync-qdevice-tool.8*
%{_mandir}/man8/corosync-qdevice-net-certutil.8* %{_mandir}/man8/corosync-qdevice-net-certutil.8*
%{_mandir}/man8/corosync-qdevice.8* %{_mandir}/man8/corosync-qdevice.8*
%endif %endif
# optional qnetd %if %{with qnetd}
#
%if %{with_qnetd}
%package -n corosync-qnetd %package -n corosync-qnetd
Summary: The Corosync Cluster Engine Qdevice Network Daemon Summary: The Corosync Cluster Engine Qdevice Network Daemon
Group: System Environment/Base Group: System/Base
Requires: mozilla-nss-tools Requires: mozilla-nss-tools
Requires(pre): shadow Requires(pre): shadow
%if %{with_systemd} %if %{with systemd}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
Requires(post): %insserv_prereq %fillup_prereq
%endif %endif
%description -n corosync-qnetd %description -n corosync-qnetd
@ -577,31 +543,25 @@ This package contains the Corosync Cluster Engine Qdevice Network Daemon, script
NSS certificates and an init script. NSS certificates and an init script.
%pre -n corosync-qnetd %pre -n corosync-qnetd
getent group coroqnetd >/dev/null || groupadd -r coroqnetd getent group coroqnetd >/dev/null || groupadd -r coroqnetd -g 701
getent passwd coroqnetd >/dev/null || \ getent passwd coroqnetd >/dev/null || useradd -r -g coroqnetd -u 701 -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
%service_add_pre corosync-qnetd.service
exit 0 exit 0
%post -n corosync-qnetd %post -n corosync-qnetd
#mkdir -m 770 /run/corosync-qnetd %tmpfiles_create /usr/lib/tmpfiles.d/corosync-qnetd.conf
#chown coroqnetd:coroqnetd /run/corosync-qnetd
%if %{sles_version} > 0 %if %{sles_version} > 0
ln -s /run/corosync-qnetd /var/run/ ln -s /run/corosync-qnetd /var/run/
%endif %endif
%{fillup_and_insserv -n corosync-qnetd} %{fillup_and_insserv -n corosync-qnetd}
%if %{with_systemd}
%service_add_post corosync-qnetd.service %service_add_post corosync-qnetd.service
%endif
%preun -n corosync-qnetd %preun -n corosync-qnetd
%if %{with_systemd}
%service_del_preun corosync-qnetd.service %service_del_preun corosync-qnetd.service
%else
if [ $1 -eq 0 ]; then
/sbin/service corosync-qnetd stop &>/dev/null || :
/sbin/chkconfig --del corosync-qnetd || :
fi
%endif
%if %{sles_version} > 0 %if %{sles_version} > 0
unlink /var/run/corosync-qnetd unlink /var/run/corosync-qnetd
%endif %endif
@ -610,29 +570,23 @@ unlink /var/run/corosync-qnetd
if [ -f /etc/sysconfig/corosync-qnetd ];then if [ -f /etc/sysconfig/corosync-qnetd ];then
rm /etc/sysconfig/corosync-qnetd rm /etc/sysconfig/corosync-qnetd
fi fi
%if %{with_systemd} && 0%{?systemd_postun:1} %service_del_postun corosync-qnetd.service
%systemd_postun
%endif
%files -n corosync-qnetd %files -n corosync-qnetd
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd %dir %config(noreplace) %attr(750, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
#change corosync-qnetd to /run as /var/run is just symlink nowadays #change corosync-qnetd to /run as /var/run is just symlink nowadays
%ghost %attr(770, coroqnetd, coroqnetd) /run/corosync-qnetd %ghost %attr (750, coroqnetd, coroqnetd) /run/corosync-qnetd
#%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
%{_bindir}/corosync-qnetd %{_bindir}/corosync-qnetd
%{_bindir}/corosync-qnetd-certutil %{_bindir}/corosync-qnetd-certutil
%{_bindir}/corosync-qnetd-tool %{_bindir}/corosync-qnetd-tool
%{_sysconfdir}/init.d/corosync-qnetd
%config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qnetd %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qnetd
#%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd %if %{with systemd}
%if %{with_systemd}
%{_unitdir}/corosync-qnetd.service %{_unitdir}/corosync-qnetd.service
%{_sbindir}/rccorosync-qnetd
%dir %{_datadir}/corosync %dir %{_datadir}/corosync
%{_datadir}/corosync/corosync-qnetd %{_datadir}/corosync/corosync-qnetd
%{_tmpfilesdir}/corosync-qnetd.conf %{_tmpfilesdir}/corosync-qnetd.conf
%else
%{_initrddir}/corosync-qnetd
%endif %endif
%{_mandir}/man8/corosync-qnetd-tool.8* %{_mandir}/man8/corosync-qnetd-tool.8*
%{_mandir}/man8/corosync-qnetd-certutil.8* %{_mandir}/man8/corosync-qnetd-certutil.8*