[packages/sanlock] - updated to 3.2.4 - updated init-pld patch
qboosh
qboosh at pld-linux.org
Thu Sep 10 22:08:47 CEST 2015
commit 51fef094f72dd0b920d1ada8b9f23b909c9ba3a0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Thu Sep 10 22:10:23 2015 +0200
- updated to 3.2.4
- updated init-pld patch
sanlock-init-pld.patch | 279 +++++++++++++++++++++++++++++++++++++++++--------
sanlock.spec | 127 +++++++++++++++++++---
2 files changed, 350 insertions(+), 56 deletions(-)
---
diff --git a/sanlock.spec b/sanlock.spec
index 15f2173..f3acb90 100644
--- a/sanlock.spec
+++ b/sanlock.spec
@@ -1,13 +1,14 @@
-# TODO: systemd support (there are init.d/*.service, but they refer to unknown /lib/systemd/systemd-sanlock)
Summary: Shared storage lock manager
Summary(pl.UTF-8): Zarządca blokad dla współdzielonego składowania danych
Name: sanlock
-Version: 2.6
-Release: 3
+Version: 3.2.4
+Release: 1
License: LGPL v2+ (libsanlock_client, libwdmd), GPL v2 (libsanlock, utilities)
Group: Networking
-Source0: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
-# Source0-md5: c488b1914e0996246e3572a359093d7d
+# older releases: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
+#Source0Download: https://git.fedorahosted.org/cgit/sanlock.git/
+Source0: https://git.fedorahosted.org/cgit/sanlock.git/snapshot/%{name}-%{version}.tar.xz
+# Source0-md5: 567ab7aa5863ab56770c6f12ca4e41a3
Patch0: %{name}-link.patch
Patch1: %{name}-init-pld.patch
URL: https://fedorahosted.org/sanlock/
@@ -17,6 +18,8 @@ BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
BuildRequires: python-devel
BuildRequires: rpmbuild(macros) >= 1.228
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
Requires(post,preun): /sbin/chkconfig
Requires(postun): /usr/sbin/groupdel
Requires(postun): /usr/sbin/userdel
@@ -35,6 +38,39 @@ Shared storage lock manager.
%description -l pl.UTF-8
Zarządca blokad dla współdzielonego składowania danych.
+%package reset
+Summary: Host reset daemon and client using sanlock
+Summary(pl.UTF-8): Demon resetujący hosta oraz klient wykorzystujący sanlocka
+Group: Daemons
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name} = %{version}-%{release}
+
+%description reset
+This package contains the reset daemon and client. A cooperating host
+running the daemon can be reset by a host running the client, so long
+as both maintain access to a common sanlock lockspace.
+
+%description reset -l pl.UTF-8
+Ten pakiet zawiera demona oraz klienta resetującego. Współpracujący
+host z działającym demonem może być zresetowany przez host z
+działającym klientem tak długo, jak oba mają dostęp do wspólnej
+przestrzeni blokad sanlock.
+
+%package -n fence-sanlock
+Summary: Fence agent using sanlock and wdmd
+Summary(pl.UTF-8): Agent barier wykorzystujący sanlocka oraz wdmd
+Group: Daemons
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name} = %{version}-%{release}
+
+%description -n fence-sanlock
+This package contains the fence agent and daemon for using sanlock and
+wdmd as a cluster fence agent.
+
+%description -n fence-sanlock -l pl.UTF-8
+Ten pakiet zawiera agenta oraz demona barier do użytku z sanlockiem
+oraz wdmd jako agent barier w klastrze.
+
%package libs
Summary: Sanlock libraries
Summary(pl.UTF-8): Biblioteki sanlock
@@ -89,6 +125,17 @@ LIB_ENTIRE_LDFLAGS="%{rpmldflags}" \
%{__make} -C src \
CC="%{__cc}"
+CFLAGS= \
+%{__make} -C fence_sanlock \
+ CC="%{__cc}" \
+ OPTIMIZE_FLAG="%{rpmcflags}"
+
+CFLAGS= \
+%{__make} -C reset \
+ CC="%{__cc}" \
+ LDFLAGS="%{rpmldflags}" \
+ OPTIMIZE_FLAG="%{rpmcflags}"
+
%{__make} -C python
%install
@@ -102,19 +149,36 @@ rm -rf $RPM_BUILD_ROOT
DESTDIR=$RPM_BUILD_ROOT \
LIBDIR=%{_libdir}
+%{__make} -C fence_sanlock install \
+ DESTDIR=$RPM_BUILD_ROOT \
+ LIBDIR=%{_libdir}
+
+%{__make} -C reset install \
+ DESTDIR=$RPM_BUILD_ROOT
+
%{__make} -C python install \
DESTDIR=$RPM_BUILD_ROOT
/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/var/run/{sanlock,wdmd}}
+install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/rc.d/init.d}
+install init.d/fence_sanlockd $RPM_BUILD_ROOT/etc/rc.d/init.d
install init.d/sanlock $RPM_BUILD_ROOT/etc/rc.d/init.d
install init.d/wdmd $RPM_BUILD_ROOT/etc/rc.d/init.d
-
-install -d $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
-cat >$RPM_BUILD_ROOT/usr/lib/tmpfiles.d/sanlock.conf <<EOF
+for serv in sanlock wdmd fence_sanlockd ; do
+ sed -e "s,/lib/systemd/systemd-${serv},/etc/rc.d/init.d/${serv}," init.d/${serv}.service >$RPM_BUILD_ROOT%{systemdunitdir}/${serv}.service
+done
+cp -p init.d/sanlk-resetd.service $RPM_BUILD_ROOT%{systemdunitdir}
+
+install -d $RPM_BUILD_ROOT/var/run/{sanlock,wdmd,fence_sanlock,fence_sanlockd}
+install -d $RPM_BUILD_ROOT%{systemdtmpfilesdir}
+cat >$RPM_BUILD_ROOT%{systemdtmpfilesdir}/sanlock.conf <<EOF
d /var/run/sanlock 0775 sanlock sanlock -
-d /var/run/wdmd 0755 root root -
+d /var/run/wdmd 0775 root sanlock -
+EOF
+cat >$RPM_BUILD_ROOT%{systemdtmpfilesdir}/fence_sanlock.conf <<EOF
+d /var/run/fence_sanlock 0755 root root -
+d /var/run/fence_sanlockd 0755 root root -
EOF
%clean
@@ -144,6 +208,19 @@ if [ "$1" = "0" ]; then
%groupremove sanlock
fi
+%post -n fence-sanlock
+/sbin/chkconfig --add fence_sanlock
+%service fence_sanlock restart
+if [ "$1" = "1" ]; then
+ ccs_update_schema >/dev/null 2>&1 || :
+fi
+
+%preun -n fence-sanlock
+if [ "$1" = "0" ]; then
+ %service -q fence_sanlock stop
+ /sbin/chkconfig --del fence_sanlock
+fi
+
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
@@ -154,12 +231,34 @@ fi
%attr(755,root,root) %{_sbindir}/wdmd
%attr(754,root,root) /etc/rc.d/init.d/sanlock
%attr(754,root,root) /etc/rc.d/init.d/wdmd
-/usr/lib/tmpfiles.d/sanlock.conf
+%{systemdunitdir}/sanlock.service
+%{systemdunitdir}/wdmd.service
+%{systemdtmpfilesdir}/sanlock.conf
%attr(775,sanlock,sanlock) %dir /var/run/sanlock
-%dir /var/run/wdmd
+%attr(775,root,sanlock) %dir /var/run/wdmd
%{_mandir}/man8/sanlock.8*
%{_mandir}/man8/wdmd.8*
+%files reset
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_sbindir}/sanlk-reset
+%attr(755,root,root) %{_sbindir}/sanlk-resetd
+%{systemdunitdir}/sanlk-resetd.service
+%{_mandir}/man8/sanlk-reset.8*
+%{_mandir}/man8/sanlk-resetd.8*
+
+%files -n fence-sanlock
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_sbindir}/fence_sanlock
+%attr(755,root,root) %{_sbindir}/fence_sanlockd
+%attr(754,root,root) /etc/rc.d/init.d/fence_sanlockd
+%{systemdunitdir}/fence_sanlockd.service
+%{systemdtmpfilesdir}/fence_sanlock.conf
+%dir /var/run/fence_sanlock
+%dir /var/run/fence_sanlockd
+%{_mandir}/man8/fence_sanlock.8*
+%{_mandir}/man8/fence_sanlockd.8*
+
%files libs
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libsanlock.so.*.*
@@ -176,8 +275,10 @@ fi
%attr(755,root,root) %{_libdir}/libwdmd.so
%{_includedir}/sanlock*.h
%{_includedir}/wdmd.h
+%{_pkgconfigdir}/libsanlock.pc
+%{_pkgconfigdir}/libsanlock_client.pc
%files -n python-sanlock
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/sanlock.so
-%{py_sitedir}/Sanlock-1.0-py*.egg-info
+%{py_sitedir}/sanlock_python-%{version}_-py*.egg-info
diff --git a/sanlock-init-pld.patch b/sanlock-init-pld.patch
index 470850e..b8f2085 100644
--- a/sanlock-init-pld.patch
+++ b/sanlock-init-pld.patch
@@ -132,41 +132,39 @@
esac
-exit $?
+exit $retval
---- sanlock-2.5/init.d/wdmd.orig 2012-09-24 17:35:09.000000000 +0200
-+++ sanlock-2.5/init.d/wdmd 2012-09-30 10:51:00.684955942 +0200
-@@ -3,7 +3,7 @@
- # wdmd - watchdog multiplexing daemon
- #
- # chkconfig: 2345 97 03
--# description: starts and stops sanlock daemon
-+# description: starts and stops wdmd daemon
- #
-
-
-@@ -33,105 +33,92 @@
+--- sanlock-3.2.4/init.d/wdmd.orig 2015-09-10 17:23:16.258102320 +0200
++++ sanlock-3.2.4/init.d/wdmd 2015-09-10 17:31:02.341416003 +0200
+@@ -42,114 +42,105 @@
+ retval=$?
- watchdog_check() {
- if [ ! -c /dev/watchdog ]; then
+ if [ $retval -ne 0 ]; then
- echo -n $"Loading the softdog kernel module: "
+ show "Loading the softdog kernel module: "
modprobe softdog && udevadm settle
-- [ -c /dev/watchdog ] && success || failure
-- echo
-+ [ -c /dev/watchdog ] && ok || fail
+
+ watchdog_probe
+ retval=$?
+ if [ $retval -ne 0 ]; then
+- failure; echo
++ fail
+ return 1
+ fi
+- success; echo
++ ok
fi
}
start() {
+ # Check if the service is already running?
-+ if [ -f /var/lock/subsys/wdmd ]; then
++ if [ -f $lockfile ]; then
+ msg_already_running "wdmd"
+ return
+ fi
+
watchdog_check
-- [ -x $exec ] || exit 5
--
+ [ -x $exec ] || exit 5
+
- if [ ! -d /var/run/$prog ]; then
- install -d -g $WDMDGROUP -m 775 /var/run/$prog
- [ -x /sbin/restorecon ] && restorecon /var/run/$prog
@@ -182,7 +180,7 @@
}
stop() {
-+ if [ ! -f /var/lock/subsys/wdmd ]; then
++ if [ ! -f $lockfile ]; then
+ msg_not_running "wdmd"
+ return
+ fi
@@ -221,6 +219,201 @@
-restart() {
- rh_status_q && stop
++condrestart() {
++ if [ ! -f $lockfile ]; then
++ msg_not_running "wdmd"
++ retval=$1
++ return $retval
++ fi
++ stop
+ start
+ }
+
+-reload() {
+- restart
+-}
+-
+-rh_status() {
+- status $prog
+-}
+-
+-rh_status_q() {
+- rh_status >/dev/null 2>&1
+-}
+-
+ case "$1" in
+ start)
+- rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+- rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+- $1
+- ;;
+- reload)
+- rh_status_q || exit 7
+- $1
++ stop
++ start
+ ;;
+ watchdog-check)
+ watchdog_check
+ ;;
+ force-reload)
+- force_reload
++ condrestart 7
+ ;;
+ status)
+- rh_status
++ status --pidfile $runfile wdmd
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+- restart
++ condrestart 0
+ ;;
+ *)
+- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+- exit 2
++ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
++ exit 3
+ esac
+-exit $?
++exit $retval
+--- sanlock-3.2.4/init.d/fence_sanlockd.orig 2015-06-19 18:26:03.000000000 +0200
++++ sanlock-3.2.4/init.d/fence_sanlockd 2015-09-10 20:58:46.917559578 +0200
+@@ -33,42 +33,35 @@
+ [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+ start() {
+- [ -x $exec ] || exit 5
+-
++ # Check if the service is already running?
++ if [ -f /var/lock/subsys/sanlock ]; then
++ msg_already_running "sanlock"
++ return
++ fi
++
+ # start wdmd and sanlock daemons if they aren't running
++ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 || /etc/rc.d/init.d/wdmd start
++ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 || /etc/rc.d/init.d/sanlock start
+
+- service wdmd status > /dev/null 2>&1 || service wdmd start
+-
+- service sanlock status > /dev/null 2>&1 || service sanlock start
+-
+- [ ! -d /var/run/$prog ] && install -d -m 775 /var/run/$prog
+-
+- [ ! -d /var/run/$agent ] && install -d -m 775 /var/run/$agent
+-
+- [ -n "$(which restorecon)" ] && \
+- [ -x "$(which restorecon)" ] && \
+- restorecon /var/run/$prog
+-
+- [ -n "$(which restorecon)" ] && \
+- [ -x "$(which restorecon)" ] && \
+- restorecon /var/run/$agent
+-
+- echo -n $"Starting $prog: "
++ msg_starting "$prog"
+ daemon $prog $FENCESANLOCKDOPTS
+ retval=$?
+- echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+ }
+
+ stop() {
++ if [ ! -f /var/lock/subsys/$prog ]; then
++ msg_not_running "$prog"
++ return
++ fi
+ agent_ps="$(ps ax -o pid,args | grep fence_sanlock | grep -v grep | grep -v fence_sanlockd)"
+
+ [ -n "$agent_ps" ] && {
+ agent_pid="$(echo $agent_ps | awk '{print $1}')"
+- echo -n "cannot stop while $agent $agent_pid is running"
+- failure; echo
+- return 1
++ echo "Cannot stop while $agent $agent_pid is running" >&2
++ retval=1
++ return $retval
+ }
+
+ # Ideally, we'd like a general way to check if anything
+@@ -78,17 +71,17 @@
+ if [ -d /sys/kernel/dlm/ ]; then
+ count="$(ls -A /sys/kernel/dlm/ | wc -l)"
+ if [ $count -ne 0 ]; then
+- echo -n "cannot stop while dlm lockspaces exist"
+- failure; echo
+- return 1
++ echo "Cannot stop while dlm lockspaces exist" >&2
++ retval=1
++ return $retval
+ fi
+ fi
+
+ if [ -d /sys/kernel/config/dlm/cluster ]; then
+ # this dir exists while dlm_controld is running
+- echo -n "cannot stop while dlm is running"
+- failure; echo
+- return 1
++ echo "Cannot stop while dlm is running" >&2
++ retval=1
++ return $retval
+ fi
+
+ PID=$(pidofproc -p $runfile $prog)
+@@ -96,10 +89,8 @@
+ # We have to use SIGHUP to mean stop because sanlock
+ # uses SIGTERM to mean that the lockspace failed.
+
+- echo -n $"Sending stop signal $prog ($PID): "
+ killproc -p $runfile $prog -HUP
+ retval=$?
+- echo
+
+ if [ $retval -ne 0 ]; then
+ return $retval
+@@ -113,75 +104,65 @@
+ echo "" > $fifofile
+ fi
+
+- echo -n $"Waiting for $prog ($PID) to stop:"
++ show "Waiting for %s (%s) to stop:" "$prog" "$PID"
+
+ timeout=10
+ while checkpid $PID; do
+ sleep 1
+ timeout=$((timeout - 1))
+ if [ "$timeout" -le 0 ]; then
+- failure; echo
++ fail
+ return 1
+ fi
+ done
+
+- success; echo
++ ok
+ rm -f $lockfile
+
+ # stop wdmd and sanlock daemons if they are running
+-
+- service sanlock status > /dev/null 2>&1 && service sanlock stop
+-
+- service wdmd status > /dev/null 2>&1 && service wdmd stop
++ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 && /etc/rc.d/init.d/sanlock stop
++ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 && /etc/rc.d/init.d/wdmd stop
+
+ return $retval
+ }
+
+-restart() {
+- rh_status_q && stop
- start
-}
-
@@ -235,15 +428,17 @@
-rh_status_q() {
- rh_status >/dev/null 2>&1
+condrestart() {
-+ if [ ! -f /var/lock/subsys/wdmd ]; then
-+ msg_not_running "wdmd"
++ if [ ! -f /var/lock/subsys/$prog ]; then
++ msg_not_running "$prog"
+ retval=$1
-+ return
++ return $retval
+ fi
-+ stop
-+ start
++ stop && start
++ retval=$?
++ return $retval
}
-
+-
++
case "$1" in
start)
- rh_status_q && exit 0
@@ -257,32 +452,30 @@
;;
restart)
- $1
-- ;;
-- reload)
-- rh_status_q || exit 7
-- $1
-+ stop
-+ start
++ stop && start
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
;;
force-reload)
- force_reload
+ condrestart 7
;;
-- status)
+ status)
- rh_status
-+ try-restart)
-+ condrestart 0
++ status --pidfile $runfile $prog
++ retval=$?
;;
-- condrestart|try-restart)
+ condrestart|try-restart)
- rh_status_q || exit 0
- restart
-+ status)
-+ status --pidfile $runfile wdmd
++ condrestart 0
;;
*)
- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
-+ msg_usage "$0 {start|stop|status|restart|try-restart|force-reload}"
- exit 2
+- exit 2
++ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
++ exit 3
esac
--exit $?
-+exit $retval
+ exit $?
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/sanlock.git/commitdiff/51fef094f72dd0b920d1ada8b9f23b909c9ba3a0
More information about the pld-cvs-commit
mailing list