diff --git a/0010-fix-ifdown-udp.patch b/0010-fix-ifdown-udp.patch new file mode 100644 index 0000000..f23bb4d --- /dev/null +++ b/0010-fix-ifdown-udp.patch @@ -0,0 +1,370 @@ +From 790794bc1f654fd1b4c8c2904c8d5c60374b99c1 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +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 work. Also big thanks +to Bin Liu for testing and bringing some ideas. + +Signed-off-by: Jan Friesse +--- + 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 + diff --git a/0011-fix-tmpfiles-create.patch b/0011-fix-tmpfiles-create.patch new file mode 100644 index 0000000..db8b2d9 --- /dev/null +++ b/0011-fix-tmpfiles-create.patch @@ -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" diff --git a/corosync.changes b/corosync.changes index 3f95f07..8e75b22 100644 --- a/corosync.changes +++ b/corosync.changes @@ -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 diff --git a/corosync.spec b/corosync.spec index 189a4bb..33dffc0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,22 +16,26 @@ # -#%global dirty dirty - # Conditionals # Invoke "rpmbuild --without " or "rpmbuild --with " # to disable or enable specific features -%define with_testagents 1 -%define with_watchdog 1 -#%define with_monitoring 0 -%define with_snmp 1 -#%define with_dbus 1 -%define with_rdma 1 -%define with_systemd 1 -%define with_xmlconf 1 -%define with_runautogen 1 -%define with_qdevices 1 -%define with_qnetd 1 +%bcond_without testagents +%bcond_with watchdog +%bcond_with monitoring +%bcond_with snmp +%bcond_with rdma +%bcond_with dbus +%bcond_with upstart +%bcond_with xmlconf +%bcond_without runautogen +%bcond_without systemd +%bcond_without qdevices +%bcond_without qnetd + +%if !%{defined tmpfiles_create} +%define tmpfiles_create systemd-tmpfiles --create ||: +%endif + %if 0%{?sles_version} == 12 %ifnarch s390 s390x %define buildib 1 @@ -47,7 +51,6 @@ License: BSD-3-Clause Group: Productivity/Clustering/HA Version: 2.4.2 Release: 0 -#Release: 1%{?gitver}%{?dist} Url: http://corosync.github.io/corosync/ Source0: %{name}-%{version}.tar.gz 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 Patch18: 0008-main.c-add-option-to-set-priority.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 # 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(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig -Requires(post): %insserv_prereq %fillup_prereq Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 @@ -91,37 +95,37 @@ BuildRequires: groff BuildRequires: libqb-devel BuildRequires: mozilla-nss-devel BuildRequires: zlib-devel -%if %{with_runautogen} +%if %{with runautogen} BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool %endif -#%if %{with monitoring} -#BuildRequires: libstatgrab-devel -#%endif -%if %{with_rdma} +%if %{with monitoring} +BuildRequires: libstatgrab-devel +%endif +%if %{with rdma} BuildRequires: libibverbs-devel BuildRequires: librdmacm-devel %endif -%if %{with_snmp} +%if %{with snmp} BuildRequires: net-snmp-devel %endif -#%if %{with dbus} -#BuildRequires: dbus-1-devel -#%endif -%if %{with_systemd} +%if %{with dbus} +BuildRequires: dbus-1-devel +%endif +%if %{with systemd} BuildRequires: pkgconfig(systemd) Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %endif -%if %{with_xmlconf} +%if %{with xmlconf} Requires: libxslt %endif -%if %{with_qdevices} || %{with_qnetd} +%if %{with qdevices} || %{with qnetd} Requires: mozilla-nss-tools %endif -%if %{with_qnetd} +%if %{with qnetd} BuildRequires: sed %endif @@ -148,41 +152,52 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %patch17 -p1 %patch18 -p1 %patch19 -p1 +%patch20 -p1 +%patch21 -p1 %build -%if %{with_runautogen} +%if %{with runautogen} ./autogen.sh %endif -%if %{with_rdma} +%if %{with rdma} export ibverbs_CFLAGS=-I/usr/include/infiniband \ export ibverbs_LIBS=-libverbs \ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ %endif %{configure} \ -%if %{with_testagents} +%if %{with testagents} --enable-testagents \ %endif -%if %{with_watchdog} +%if %{with watchdog} --enable-watchdog \ %endif -%if %{with_snmp} +%if %{with monitoring} + --enable-monitoring \ +%endif +%if %{with snmp} --enable-snmp \ %endif -%if %{with_rdma} +%if %{with dbus} + --enable-dbus \ +%endif +%if %{with rdma} --enable-rdma \ %endif -%if %{with_systemd} +%if %{with systemd} --enable-systemd \ %endif -%if %{with_xmlconf} +%if %{with upstart} + --enable-upstart \ +%endif +%if %{with xmlconf} --enable-xmlconf \ %endif -%if %{with_qdevices} +%if %{with qdevices} --enable-qdevices \ %endif -%if %{with_qnetd} +%if %{with qnetd} --enable-qnetd \ %endif --with-initddir=%{_initrddir} \ @@ -197,12 +212,15 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} -#%if %{with dbus} -#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 -#%endif -%if %{with_systemd} +%if %{with dbus} +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 +%endif +%if %{with systemd} 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 ## tree fixup @@ -211,6 +229,8 @@ rm -f %{buildroot}%{_libdir}/*.a rm -f %{buildroot}%{_libdir}/*.la # drop docs and html docs for now 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/share/doc/packages/corosync/ 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/ rm -rf %{buildroot}/etc/corosync/corosync.conf.example* rm -rf %{buildroot}/etc/logrotate.d/ -# /etc/sysconfig/corosync-notifyd 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 \ %{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/ -%if %{with_qdevices} -# /etc/sysconfig/corosync-qdevice +%if %{with qdevices} install -m 644 init/corosync-qdevice.sysconfig.example \ %{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qdevice -# %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice install -m 770 -d %{buildroot}/run/corosync-qdevice %endif -%if %{with_qnetd} -# /etc/sysconfig/corosync-qnetd +%if %{with qnetd} install -m 644 init/corosync-qnetd.sysconfig.example \ %{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qnetd -# %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd install -m 770 -d %{buildroot}/run/corosync-qnetd -%if %{with_systemd} +%if %{with systemd} sed -i -e 's/^#User=/User=/' \ %{buildroot}%{_unitdir}/corosync-qnetd.service 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. %pre -%if %{with_systemd} -#%service_add_pre corosync.service corosync-notifyd.service -#we do not use corosync-notifyd.service -%service_add_pre corosync.service -%endif +%service_add_pre corosync.service corosync-notifyd.service %post +%tmpfiles_create /usr/lib/tmpfiles.d/corosync-notifyd %{fillup_and_insserv -n corosync} -%if %{with_systemd} -#%service_add_post corosync.service corosync-notifyd.service -#we do not use corosync-notifyd.service -%service_add_post corosync.service -%endif +%service_add_post corosync.service corosync-notifyd.service + 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.udpu %{_sysconfdir}/corosync/corosync.conf.example.unicast %preun - -%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 +%service_del_preun corosync.service corosync-notifyd.service %postun if [ -f /etc/sysconfig/corosync ]; then rm /etc/sysconfig/corosync fi -%if %{with_systemd} && 0%{?systemd_postun:1} -%systemd_postun -%endif +%service_del_postun corosync.service corosync-notifyd.service %files %defattr(-,root,root,-) @@ -312,12 +302,12 @@ fi %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-notifyd -%{_sysconfdir}/init.d/corosync -%if %{with_systemd} +%if %{with systemd} %{_sbindir}/rccorosync +%{_sbindir}/rccorosync-notifyd %endif %{_bindir}/corosync-blackbox -%if %{with_xmlconf} +%if %{with xmlconf} %{_bindir}/corosync-xmlproc %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example %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.udpu %config(noreplace) /usr/lib/tmpfiles.d/corosync-notifyd -#%config(noreplace) %{_sysconfdir}/sysconfig/corosync %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync -#%config(noreplace) %{_sysconfdir}/logrotate.d/corosync -#%if %{with dbus} -#%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf -#%endif -%if %{with_snmp} +%if %{with dbus} +%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +%endif +%if %{with snmp} %{_datadir}/snmp/mibs/COROSYNC-MIB.txt %endif -%if %{with_systemd} +%if %{with systemd} %{_unitdir}/corosync.service %{_unitdir}/corosync-notifyd.service %dir %{_datadir}/corosync %{_datadir}/corosync/corosync %{_datadir}/corosync/corosync-notifyd -%else -%{_initrddir}/corosync -%{_initrddir}/corosync-notifyd %endif -#%if %{with_upstart} -#%{_sysconfdir}/init/corosync.conf -#%{_sysconfdir}/init/corosync-notifyd.conf -#%endif +%if %{with upstart} +%{_sysconfdir}/init/corosync.conf +%{_sysconfdir}/init/corosync-notifyd.conf +%endif %dir %{_localstatedir}/lib/corosync %dir %{_localstatedir}/log/cluster %{_mandir}/man8/corosync_overview.8* @@ -372,12 +357,12 @@ fi %{_datadir}/doc/corosync/* # optional testagent rpm # -%if %{with_testagents} +%if %{with testagents} %package -n corosync-testagents Summary: The Corosync Cluster Engine Test Agents -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} +Group: Development/Tools/Other +Requires: %{name} = %{version} %description -n corosync-testagents This package contains corosync test agents. @@ -402,10 +387,9 @@ This package contains corosync test agents. Summary: The Corosync Cluster Engine Libraries # openais is indeed gone and should be uninstalled. Yes, we do not # provide libopenais on purpose, the package has been deleted. -Group: Productivity/Clustering/HA +Group: System/Libraries Obsoletes: libopenais3 < 1.2 Conflicts: libopenais3 < 1.2 -#Requires: %{name} = %{version}-%{release} %description -n libcorosync4 This package contains corosync libraries. @@ -428,7 +412,7 @@ This package contains corosync libraries. %package -n libcorosync-devel Summary: The Corosync Cluster Engine Development Kit -Group: Productivity/Clustering/HA +Group: Development/Libraries/C and C++ Requires: libcorosync4 = %{version}-%{release} Requires: libqb-devel Requires: pkgconfig @@ -478,46 +462,37 @@ The Corosync Cluster Engine APIs. %post -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 Summary: The Corosync Cluster Engine Qdevice -Group: System Environment/Base +Group: System/Base Requires: corosync Requires: mozilla-nss-tools -%if %{with_systemd} +%if %{with systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -Requires(post): %insserv_prereq %fillup_prereq %endif %description -n corosync-qdevice This package contains the Corosync Cluster Engine Qdevice, script for creating NSS certificates and an init script. +%pre -n corosync-qdevice +%service_add_pre corosync-qdevice.service + %post -n corosync-qdevice %{fillup_and_insserv -n corosync-qdevice} -#mkdir /run/corosync-qdevice %if %{sles_version} > 0 ln -s /run/corosync-qdevice /var/run/ %endif -%if %{with_systemd} %service_add_post corosync-qdevice.service -%endif %preun -n corosync-qdevice -%if %{with_systemd} %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} unlink /var/run/corosync-qdevice %endif @@ -526,9 +501,7 @@ unlink /var/run/corosync-qdevice if [ -f /etc/sysconfig/corosync-qdevice ]; then rm /etc/sysconfig/corosync-qdevice fi -%if %{with_systemd} && 0%{?systemd_postun:1} -%systemd_postun -%endif +%service_del_postun corosync-qdevice.service %files -n corosync-qdevice %defattr(-,root,root,-) @@ -536,40 +509,33 @@ fi %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net #change corosync-qdevice to /run as /var/run is symlink nowdays %ghost /run/corosync-qdevice -#%dir %{_localstatedir}/run/corosync-qdevice %{_sbindir}/corosync-qdevice %{_sbindir}/corosync-qdevice-net-certutil %{_sbindir}/corosync-qdevice-tool -%{_sysconfdir}/init.d/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 +%{_sbindir}/rccorosync-qdevice %dir %{_datadir}/corosync %{_datadir}/corosync/corosync-qdevice -%else -%{_initrddir}/corosync-qdevice %endif %{_mandir}/man8/corosync-qdevice-tool.8* %{_mandir}/man8/corosync-qdevice-net-certutil.8* %{_mandir}/man8/corosync-qdevice.8* %endif -# optional qnetd -# -%if %{with_qnetd} +%if %{with qnetd} %package -n corosync-qnetd Summary: The Corosync Cluster Engine Qdevice Network Daemon -Group: System Environment/Base +Group: System/Base Requires: mozilla-nss-tools Requires(pre): shadow -%if %{with_systemd} +%if %{with systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -Requires(post): %insserv_prereq %fillup_prereq %endif %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. %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 +getent group coroqnetd >/dev/null || groupadd -r coroqnetd -g 701 +getent passwd coroqnetd >/dev/null || useradd -r -g coroqnetd -u 701 -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd + +%service_add_pre corosync-qnetd.service + exit 0 %post -n corosync-qnetd -#mkdir -m 770 /run/corosync-qnetd -#chown coroqnetd:coroqnetd /run/corosync-qnetd +%tmpfiles_create /usr/lib/tmpfiles.d/corosync-qnetd.conf %if %{sles_version} > 0 ln -s /run/corosync-qnetd /var/run/ %endif %{fillup_and_insserv -n corosync-qnetd} -%if %{with_systemd} + %service_add_post corosync-qnetd.service -%endif %preun -n corosync-qnetd -%if %{with_systemd} %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 unlink /var/run/corosync-qnetd %endif @@ -610,29 +570,23 @@ unlink /var/run/corosync-qnetd if [ -f /etc/sysconfig/corosync-qnetd ];then rm /etc/sysconfig/corosync-qnetd fi -%if %{with_systemd} && 0%{?systemd_postun:1} -%systemd_postun -%endif +%service_del_postun corosync-qnetd.service %files -n corosync-qnetd %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 -%ghost %attr(770, coroqnetd, coroqnetd) /run/corosync-qnetd -#%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd +%ghost %attr (750, coroqnetd, coroqnetd) /run/corosync-qnetd %{_bindir}/corosync-qnetd %{_bindir}/corosync-qnetd-certutil %{_bindir}/corosync-qnetd-tool -%{_sysconfdir}/init.d/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 +%{_sbindir}/rccorosync-qnetd %dir %{_datadir}/corosync %{_datadir}/corosync/corosync-qnetd %{_tmpfilesdir}/corosync-qnetd.conf -%else -%{_initrddir}/corosync-qnetd %endif %{_mandir}/man8/corosync-qnetd-tool.8* %{_mandir}/man8/corosync-qnetd-certutil.8*