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/corosync.changes b/corosync.changes index e113e6a..f9a6c67 100644 --- a/corosync.changes +++ b/corosync.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +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 + +------------------------------------------------------------------- +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 diff --git a/corosync.spec b/corosync.spec index 7650fba..027c96a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,23 +16,22 @@ # -#%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 0 -%define with_dbus 0 -%define with_rdma 0 -%define with_systemd 1 -%define with_xmlconf 0 -%define with_runautogen 1 -%define with_qdevices 1 -%define with_qnetd 1 -%define with_upstart 0 +%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 0%{?sles_version} == 12 %ifnarch s390 s390x %define buildib 1 @@ -70,6 +69,7 @@ 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 BuildRoot: %{_tmppath}/%{name}-%{version}-build # openais is indeed gone and should be uninstalled. Yes, we do not @@ -91,37 +91,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} +%if %{with monitoring} BuildRequires: libstatgrab-devel %endif -%if %{with_rdma} +%if %{with rdma} BuildRequires: libibverbs-devel BuildRequires: librdmacm-devel %endif -%if %{with_snmp} +%if %{with snmp} BuildRequires: net-snmp-devel %endif -%if %{with_dbus} +%if %{with dbus} BuildRequires: dbus-1-devel %endif -%if %{with_systemd} +%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 +148,51 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %patch17 -p1 %patch18 -p1 %patch19 -p1 +%patch20 -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,11 +207,11 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} -%if %{with_dbus} +%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 systemd} ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rccorosync %endif @@ -229,17 +239,17 @@ 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} +%if %{with qdevices} install -m 644 init/corosync-qdevice.sysconfig.example \ %{buildroot}/var/adm/fillup-templates/sysconfig.corosync-qdevice install -m 770 -d %{buildroot}/run/corosync-qdevice %endif -%if %{with_qnetd} +%if %{with qnetd} install -m 644 init/corosync-qnetd.sysconfig.example \ %{buildroot}/var/adm/fillup-templates/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' \ @@ -258,39 +268,24 @@ This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. %pre -%if %{with_systemd} -#we do not use corosync-notifyd.service -%service_add_pre corosync.service -%endif +%service_add_pre corosync.service corosync-notifyd.service %post %{fillup_and_insserv -n corosync} -%if %{with_systemd} -#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,-) @@ -303,11 +298,11 @@ fi %{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-notifyd %{_sysconfdir}/init.d/corosync -%if %{with_systemd} +%if %{with systemd} %{_sbindir}/rccorosync %endif %{_bindir}/corosync-blackbox -%if %{with_xmlconf} +%if %{with xmlconf} %{_bindir}/corosync-xmlproc %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example %dir %{_datadir}/corosync @@ -323,13 +318,13 @@ fi %config(noreplace) /usr/lib/tmpfiles.d/corosync-notifyd %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync -%if %{with_dbus} +%if %{with dbus} %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif -%if %{with_snmp} +%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 @@ -339,7 +334,7 @@ fi %{_initrddir}/corosync %{_initrddir}/corosync-notifyd %endif -%if %{with_upstart} +%if %{with upstart} %{_sysconfdir}/init/corosync.conf %{_sysconfdir}/init/corosync-notifyd.conf %endif @@ -360,12 +355,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} +Requires: %{name} = %{version} %description -n corosync-testagents This package contains corosync test agents. @@ -393,7 +388,7 @@ Summary: The Corosync Cluster Engine Libraries Group: Productivity/Clustering/HA Obsoletes: libopenais3 < 1.2 Conflicts: libopenais3 < 1.2 -#Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{version} %description -n libcorosync4 This package contains corosync libraries. @@ -468,7 +463,7 @@ The Corosync Cluster Engine APIs. # optional qdevices # -%if %{with_qdevices} +%if %{with qdevices} %package -n corosync-qdevice Summary: The Corosync Cluster Engine Qdevice @@ -476,7 +471,7 @@ Group: System Environment/Base Requires: corosync Requires: mozilla-nss-tools -%if %{with_systemd} +%if %{with systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -487,25 +482,19 @@ Requires(post): %insserv_prereq %fillup_prereq 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 + %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 @@ -514,9 +503,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,-) @@ -529,7 +516,7 @@ fi %{_sbindir}/corosync-qdevice-tool %{_sysconfdir}/init.d/corosync-qdevice %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qdevice -%if %{with_systemd} +%if %{with systemd} %{_unitdir}/corosync-qdevice.service %dir %{_datadir}/corosync %{_datadir}/corosync/corosync-qdevice @@ -543,7 +530,7 @@ fi # optional qnetd # -%if %{with_qnetd} +%if %{with qnetd} %package -n corosync-qnetd Summary: The Corosync Cluster Engine Qdevice Network Daemon @@ -551,7 +538,7 @@ Group: System Environment/Base Requires: mozilla-nss-tools Requires(pre): shadow -%if %{with_systemd} +%if %{with systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -567,25 +554,19 @@ 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 +%service_add_pre corosync-qnetd.service %post -n corosync-qnetd %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 @@ -594,9 +575,7 @@ 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,-) @@ -608,7 +587,7 @@ fi %{_bindir}/corosync-qnetd-tool %{_sysconfdir}/init.d/corosync-qnetd %config(noreplace) /var/adm/fillup-templates/sysconfig.corosync-qnetd -%if %{with_systemd} +%if %{with systemd} %{_unitdir}/corosync-qnetd.service %dir %{_datadir}/corosync %{_datadir}/corosync/corosync-qnetd