- Update to sanlock 2.6

- Add fence_sanlock, a fence agent that uses /dev/watchdog to
    reset hosts (currently disabled)
  - Various bug fixes and improvements

OBS-URL: https://build.opensuse.org/package/show/Virtualization/sanlock?expand=0&rev=15
This commit is contained in:
James Fehlig 2012-12-03 22:15:47 +00:00 committed by Git OBS Bridge
parent 60c3e5e0b3
commit 1dfd85810b
14 changed files with 426 additions and 80 deletions

View File

@ -0,0 +1,57 @@
From 337c30353d650bd02bd1203b7859124926dfef71 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 5 Nov 2012 15:53:40 -0600
Subject: [PATCH] fix systemd service files
add [Unit] and disable the cgroup stuff to avoid
the set_scheduler failures
Signed-off-by: David Teigland <teigland@redhat.com>
---
init.d/fence_sanlockd.service | 1 +
init.d/sanlock.service | 2 ++
init.d/wdmd.service | 2 ++
3 files changed, 5 insertions(+)
diff --git a/init.d/fence_sanlockd.service b/init.d/fence_sanlockd.service
index 873da59..f2d655b 100644
--- a/init.d/fence_sanlockd.service
+++ b/init.d/fence_sanlockd.service
@@ -1,3 +1,4 @@
+[Unit]
Description=daemon for fence_sanlock agent
After=syslog.target wdmd.service sanlock.service
Before=corosync.service
diff --git a/init.d/sanlock.service b/init.d/sanlock.service
index ff4a3e7..f026fe0 100644
--- a/init.d/sanlock.service
+++ b/init.d/sanlock.service
@@ -1,8 +1,10 @@
+[Unit]
Description=Shared Storage Lease Manager
After=syslog.target wdmd.service
[Service]
Type=forking
+ControlGroup=cpu:/
ExecStart=/lib/systemd/systemd-sanlock start
ExecStop=/lib/systemd/systemd-sanlock stop
diff --git a/init.d/wdmd.service b/init.d/wdmd.service
index 88d00b6..efe46bf 100644
--- a/init.d/wdmd.service
+++ b/init.d/wdmd.service
@@ -1,8 +1,10 @@
+[Unit]
Description=Watchdog Multiplexing Daemon
After=syslog.target
[Service]
Type=forking
+ControlGroup=cpu:/
ExecStart=/lib/systemd/systemd-wdmd start
ExecStop=/lib/systemd/systemd-wdmd stop
--
1.7.10.1.362.g242cab3

160
fence_sanlockd.init Normal file
View File

@ -0,0 +1,160 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: fence_sanlockd
# Required-Start: $time $syslog $remote_fs
# Required-Stop: $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and stops fence_sanlockd
# Description: Starts and stops fence_sanlockd. See fence_sanlockd(8).
### END INIT INFO
PROG=fence_sanlockd
FENCE_SANLOCKD_BIN=/usr/sbin/$PROG
FENCE_SANLOCKD_RUNDIR=/var/run/$PROG
FENCE_SANLOCKD_PIDFILE=$FENCE_SANLOCKD_RUNDIR/$PROG.pid
FENCE_SANLOCKD_FIFOFILE=$FENCE_SANLOCKD_RUNDIR/$PROG.fifo
FENCESANLOCKDOPTS="-w"
FENCE_SANLOCK_AGENT_RUNDIR=/var/run/fence_sanlock
test -x $FENCE_SANLOCKD_BIN || { echo "$FENCE_SANLOCKD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
. /etc/rc.status
rc_reset
case "$1" in
start)
# start wdmd and sanlock daemons if they aren't running
service wdmd status > /dev/null 2>&1 || service wdmd start
service sanlock status > /dev/null 2>&1 || service sanlock start
[ ! -d $FENCE_SANLOCKD_RUNDIR ] && \
install -d -m 775 $FENCE_SANLOCKD_RUNDIR
[ ! -d $FENCE_SANLOCK_AGENT_RUNDIR ] && \
install -d -m 775 $FENCE_SANLOCK_AGENT_RUNDIR
[ -n "$(which restorecon)" ] && \
[ -x "$(which restorecon)" ] && \
restorecon $FENCE_SANLOCKD_RUNDIR
[ -n "$(which restorecon)" ] && \
[ -x "$(which restorecon)" ] && \
restorecon $FENCE_SANLOCK_AGENT_RUNDIR
if [ -e $FENCE_SANLOCKD_PIDFILE ]; then
if checkproc $FENCE_SANLOCKD_BIN ; then
echo -n "$PROG is already running."
rc_status -v
rc_exit
else
echo "Removing stale PID file $FENCE_SANLOCKD_PIDFILE."
rm -f $FENCE_SANLOCKD_PIDFILE
fi
fi
echo -n "Starting $PROG "
startproc $FENCE_SANLOCKD_BIN $FENCESANLOCKDOPTS
rc_status -v
;;
stop)
echo -n "Shutting down $PROG "
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 fence_sanlock $agent_pid is running"
rc_failed 1
rc_status -v
rc_exit
}
# Ideally, we'd like a general way to check if anything
# needs fencing to continue running, but without that,
# check what we know, which is that dlm requires it.
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"
rc_failed 1
rc_status -v
rc_exit
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"
rc_failed 1
rc_status -v
rc_exit
fi
PID=$(pidofproc -p $FENCE_SANLOCKD_PIDFILE $PROG)
# We have to use SIGHUP to mean stop because sanlock
# uses SIGTERM to mean that the lockspace failed.
killproc -p $FENCE_SANLOCKD_PIDFILE $PROG -HUP > /dev/null 2>&1
retval=$?
if [ $retval -ne 0 ]; then
rc_failed 1
rc_status -v
rc_exit
fi
# fence_sanlockd won't see the SIGHUP if it's
# still waiting for config from the fifo, so
# send invalid config to the fifo to make it fail.
if [ -p $FENCE_SANLOCKD_FIFOFILE ]; then
echo "" > $FENCE_SANLOCKD_FIFOFILE
fi
timeout=10
while checkpid $PID; do
sleep 1
timeout=$((timeout - 1))
if [ "$timeout" -le 0 ]; then
echo -n "failed waiting for $PROG ($PID) to stop"
rc_failed 1
rc_status -v
rc_exit
fi
done
# 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
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
killproc -HUP $FENCE_SANLOCKD_BIN
rc_status -v
;;
status)
echo -n "Checking status of $PROG "
checkproc $FENCE_SANLOCKD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
rc_failed 2
rc_exit
;;
esac
rc_exit

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66564cb6df008fff298940561c75ace172dcda55266a47049d766c7e7bd56521
size 97614

3
sanlock-2.6.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29272ccbf4f93f70afa08abd3036e449a75271115132745039dc74fe539ffef9
size 109332

View File

@ -2,9 +2,9 @@ Index: src/main.c
=================================================================== ===================================================================
--- src/main.c.orig --- src/main.c.orig
+++ src/main.c +++ src/main.c
@@ -52,6 +52,10 @@ @@ -56,6 +56,10 @@
#define RELEASE_VERSION "2.1" #define SIGRUNPATH 100 /* anything that's not SIGTERM/SIGKILL */
+#ifndef SCHED_RESET_ON_FORK +#ifndef SCHED_RESET_ON_FORK
+#define SCHED_RESET_ON_FORK 0 +#define SCHED_RESET_ON_FORK 0
@ -17,14 +17,14 @@ Index: wdmd/main.c
=================================================================== ===================================================================
--- wdmd/main.c.orig --- wdmd/main.c.orig
+++ wdmd/main.c +++ wdmd/main.c
@@ -43,6 +43,10 @@ @@ -41,6 +41,10 @@
#define GNUC_UNUSED __attribute__((__unused__))
#define RELEASE_VERSION "2.1" #endif
+#ifndef SCHED_RESET_ON_FORK +#ifndef SCHED_RESET_ON_FORK
+#define SCHED_RESET_ON_FORK 0 +#define SCHED_RESET_ON_FORK 0
+#endif +#endif
+ +
#define DEFAULT_TEST_INTERVAL 10 #define DEFAULT_TEST_INTERVAL 10
#define RECOVER_TEST_INTERVAL 1
#define DEFAULT_FIRE_TIMEOUT 60 #define DEFAULT_FIRE_TIMEOUT 60
#define DEFAULT_HIGH_PRIORITY 1

View File

@ -10,7 +10,7 @@ Index: src/diskio.c
blkid_probe probe; blkid_probe probe;
blkid_topology topo; blkid_topology topo;
uint32_t sector_size, ss_logical, ss_physical; uint32_t sector_size, ss_logical, ss_physical;
@@ -64,7 +65,10 @@ static int set_disk_properties(struct sy @@ -62,7 +63,10 @@ static int set_disk_properties(struct sy
ss_physical, disk->path); ss_physical, disk->path);
return -1; return -1;
} }

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Dec 3 15:09:22 MST 2012 - jfehlig@suse.com
- Update to sanlock 2.6
- Add fence_sanlock, a fence agent that uses /dev/watchdog to
reset hosts (currently disabled)
- Various bug fixes and improvements
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Mar 13 12:04:11 MDT 2012 - jfehlig@suse.com Tue Mar 13 12:04:11 MDT 2012 - jfehlig@suse.com

View File

@ -6,15 +6,19 @@
# Required-Stop: $syslog # Required-Stop: $syslog
# Should-Start: # Should-Start:
# Should-Stop: # Should-Stop:
# Default-Start: 3 5 # Default-Start: 2 3 5
# Default-Stop: 0 1 2 6 # Default-Stop: 0 1 6
# Short-Description: starts and stops sanlock daemon # Short-Description: starts and stops sanlock daemon
# Description: starts and stops sanlock daemon # Description: starts and stops sanlock daemon
### END INIT INFO ### END INIT INFO
SANLOCK_BIN=/usr/sbin/sanlock SANLOCKBIN=/usr/sbin/sanlock
SANLOCK_PIDFILE=/var/run/sanlock/sanlock.pid SANLOCKRUNDIR=/var/run/sanlock
test -x $SANLOCK_BIN || { echo "$SANLOCK_BIN not installed"; SANLOCKPIDFILE=$SANLOCKRUNDIR/sanlock.pid
SANLOCKUSER="sanlock"
SANLOCKOPTS="-U $SANLOCKUSER -G $SANLOCKUSER"
test -x $SANLOCKBIN || { echo "$SANLOCKBIN not installed";
if [ "$1" = "stop" ]; then exit 0; if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; } else exit 5; fi; }
@ -26,24 +30,28 @@ rc_reset
case "$1" in case "$1" in
start) start)
if [ -e $SANLOCK_PIDFILE ]; then if [ ! -d $SANLOCKRUNDIR ]; then
if checkproc $SANLOCK_BIN ; then install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 $SANLOCKRUNDIR
[ -x /sbin/restorecon ] && restorecon $SANLOCKRUNDIR
fi
if [ -e $SANLOCKPIDFILE ]; then
if checkproc $SANLOCKBIN ; then
echo -n "sanlock is already running." echo -n "sanlock is already running."
rc_status -v rc_status -v
exit exit
else else
echo "Removing stale PID file $SANLOCK_PIDFILE." echo "Removing stale PID file $SANLOCKPIDFILE."
rm -f $SANLOCK_PIDFILE rm -f $SANLOCKPIDFILE
fi fi
fi fi
echo -n "Starting sanlock " echo -n "Starting sanlock "
startproc $SANLOCK_BIN daemon $SANLOCK_OPTS startproc $SANLOCKBIN daemon $SANLOCKOPTS
rc_status -v rc_status -v
;; ;;
stop) stop)
echo -n "Shutting down sanlock " echo -n "Shutting down sanlock "
killproc -TERM $SANLOCK_BIN > /dev/null 2>&1 killproc -TERM $SANLOCKBIN > /dev/null 2>&1
rm -f $SANLOCK_PIDFILE rm -f $SANLOCKPIDFILE
rc_status -v rc_status -v
;; ;;
try-restart) try-restart)
@ -56,12 +64,12 @@ case "$1" in
rc_status rc_status
;; ;;
reload) reload)
killproc -HUP $SANLOCK_BIN killproc -HUP $SANLOCKBIN
rc_status -v rc_status -v
;; ;;
status) status)
echo -n "Checking status of sanlock " echo -n "Checking status of sanlock "
checkproc $SANLOCK_BIN checkproc $SANLOCKBIN
rc_status -v rc_status -v
;; ;;
*) *)

View File

@ -16,13 +16,15 @@
# #
%define with_systemd 0 %define with_systemd 0
%define with_fence_sanlockd 0
%if 0%{?suse_version} > 1140 %if 0%{?suse_version} > 1140
%define with_systemd 1 %define with_systemd 1
%endif %endif
Name: sanlock Name: sanlock
Version: 2.1 Version: 2.6
Release: 1%{?dist} Release: 1%{?dist}
Summary: A shared disk lock manager Summary: A shared disk lock manager
License: GPL-2.0 ; GPL-2.0+ ; LGPL-2.1+ License: GPL-2.0 ; GPL-2.0+ ; LGPL-2.1+
@ -40,17 +42,23 @@ BuildRequires: systemd
%endif %endif
Requires(pre): %insserv_prereq %fillup_prereq Requires(pre): %insserv_prereq %fillup_prereq
Requires: %{name}-lib = %{version}-%{release} Requires: %{name}-lib = %{version}-%{release}
Recommends: logrotate
# Latest version available at # Latest version available at
# https://fedorahosted.org/releases/s/a/sanlock/ # https://fedorahosted.org/releases/s/a/sanlock/
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Source1: sanlock.init Source1: sanlock.init
Source2: wdmd.init Source2: sysconfig.sanlock
Source3: sysconfig.sanlock Source3: wdmd.init
Patch0: sanlock-SCHED_RESET_ON_FORK-undefined.patch Source4: sysconfig.wdmd
Patch1: sanlock-python-prefix.patch Source5: fence_sanlockd.init
Patch2: sanlock-old_blkid.patch # Upstream patches
Patch3: suse-systemd.patch Patch0: 0001-fix-systemd-service-files.patch
Patch4: suse-no-date-time.patch # SUSE patches
Patch100: sanlock-SCHED_RESET_ON_FORK-undefined.patch
Patch101: sanlock-python-prefix.patch
Patch102: sanlock-old_blkid.patch
Patch103: suse-systemd.patch
Patch104: suse-no-date-time.patch
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
@ -61,11 +69,12 @@ access to the shared disks.
%prep %prep
%setup -q %setup -q
%patch0 %patch0 -p1
%patch1 %patch100
%patch2 %patch101
%patch3 -p1 %patch102
%patch4 -p1 %patch103 -p1
%patch104 -p1
%build %build
# upstream does not require configure # upstream does not require configure
@ -73,6 +82,9 @@ access to the shared disks.
CFLAGS=$RPM_OPT_FLAGS make -C wdmd CFLAGS=$RPM_OPT_FLAGS make -C wdmd
CFLAGS=$RPM_OPT_FLAGS make -C src CFLAGS=$RPM_OPT_FLAGS make -C src
CFLAGS=$RPM_OPT_FLAGS make -C python CFLAGS=$RPM_OPT_FLAGS make -C python
%if %{with_fence_sanlockd}
CFLAGS=$RPM_OPT_FLAGS make -C fence_sanlock
%endif
%install %install
make -C src \ make -C src \
@ -84,20 +96,42 @@ make -C wdmd \
make -C python \ make -C python \
install LIBDIR=%{_libdir} \ install LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT PREFIX=%_prefix DESTDIR=$RPM_BUILD_ROOT PREFIX=%_prefix
%if %{with_fence_sanlockd}
make -C fence_sanlock \
install LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT
%endif
install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/sanlock install -D -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/sanlock
ln -s /etc/init.d/sanlock $RPM_BUILD_ROOT%{_sbindir}/rcsanlock ln -s /etc/init.d/sanlock $RPM_BUILD_ROOT%{_sbindir}/rcsanlock
install -D -m 755 %SOURCE3 $RPM_BUILD_ROOT/%{_localstatedir}/adm/fillup-templates/sysconfig.sanlock install -D -m 755 %SOURCE2 $RPM_BUILD_ROOT/%{_localstatedir}/adm/fillup-templates/sysconfig.sanlock
install -D -m 755 %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/wdmd install -D -m 755 %SOURCE3 $RPM_BUILD_ROOT/etc/init.d/wdmd
ln -s /etc/init.d/wdmd $RPM_BUILD_ROOT%{_sbindir}/rcwdmd ln -s /etc/init.d/wdmd $RPM_BUILD_ROOT%{_sbindir}/rcwdmd
install -D -m 755 %SOURCE4 $RPM_BUILD_ROOT/%{_localstatedir}/adm/fillup-templates/sysconfig.wdmd
%if %{with_fence_sanlockd}
install -D -m 755 %SOURCE5 $RPM_BUILD_ROOT/%{_initddir}/fence_sanlockd
ln -s /etc/init.d/fence_sanlockd $RPM_BUILD_ROOT%{_sbindir}/rcfence_sanlockd
%endif
%if %{with_systemd} %if %{with_systemd}
install -D -m 755 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service install -D -m 755 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
install -D -m 755 init.d/wdmd.service $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service install -D -m 755 init.d/wdmd.service $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service
%if %{with_fence_sanlockd}
install -D -m 0755 init.d/fence_sanlockd $RPM_BUILD_ROOT/lib/systemd/systemd-fence_sanlockd
install -D -m 0644 init.d/fence_sanlockd.service $RPM_BUILD_ROOT/%{_unitdir}/fence_sanlockd.service
%endif %endif
%endif
install -Dm 0644 src/logrotate.sanlock \
$RPM_BUILD_ROOT/etc/logrotate.d/sanlock
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%pre %pre
%{_bindir}/getent group sanlock > /dev/null || %{_sbindir}/groupadd \
-g 179 sanlock
%{_bindir}/getent passwd sanlock > /dev/null || %{_sbindir}/useradd \
-u 179 -c "sanlock" -s /sbin/nologin -r \
-g 179 -G disk -d /var/run/sanlock sanlock
%if %{with_systemd} %if %{with_systemd}
%service_add_pre wdmd.service %service_add_pre wdmd.service
%service_add_pre sanlock.service %service_add_pre sanlock.service
@ -107,6 +141,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with_systemd} %if %{with_systemd}
%service_add_post wdmd.service sanlock.service %service_add_post wdmd.service sanlock.service
%endif %endif
%fillup_only -n wdmd
%fillup_only -n sanlock %fillup_only -n sanlock
%restart_on_update wdmd %restart_on_update wdmd
%restart_on_update sanlock %restart_on_update sanlock
@ -131,6 +166,7 @@ rm -rf $RPM_BUILD_ROOT
%{_localstatedir}/adm/fillup-templates/sysconfig.sanlock %{_localstatedir}/adm/fillup-templates/sysconfig.sanlock
/etc/init.d/wdmd /etc/init.d/wdmd
%{_sbindir}/rcwdmd %{_sbindir}/rcwdmd
%{_localstatedir}/adm/fillup-templates/sysconfig.wdmd
%if %{with_systemd} %if %{with_systemd}
%{_unitdir}/sanlock.service %{_unitdir}/sanlock.service
%{_unitdir}/wdmd.service %{_unitdir}/wdmd.service
@ -139,6 +175,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sbindir}/wdmd %{_sbindir}/wdmd
%{_mandir}/man8/wdmd* %{_mandir}/man8/wdmd*
%{_mandir}/man8/sanlock* %{_mandir}/man8/sanlock*
%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
%package -n libsanlock1 %package -n libsanlock1
Provides: sanlock-lib Provides: sanlock-lib
@ -198,4 +235,47 @@ developing applications that use %{name}.
%{_includedir}/sanlock_resource.h %{_includedir}/sanlock_resource.h
%{_includedir}/sanlock_direct.h %{_includedir}/sanlock_direct.h
%if %{with_fence_sanlockd}
%package -n fence-sanlock
Summary: Fence agent using sanlock and wdmd
Group: System Environment/Base
Requires: sanlock = %{version}-%{release}
%description -n fence-sanlock
The fence-sanlock package contains the fence agent and
daemon for using sanlock and wdmd as a cluster fence agent.
%files -n fence-sanlock
%defattr(-,root,root,-)
/etc/init.d/fence_sanlockd
%{_sbindir}/fence_sanlockd
%if %{with_systemd}
/lib/systemd/systemd-fence_sanlockd
%{_unitdir}/fence_sanlockd.service
%endif
%{_sbindir}/fence_sanlock
%{_sbindir}/fence_sanlockd
%{_mandir}/man8/fence_sanlock*
%post -n fence-sanlock
%if %{with_systemd}
%service_add_post fence_sanlockd.service
%endif
%restart_on_update fence_sanlockd
#if [ $1 -eq 1 ] ; then
#ccs_update_schema > /dev/null 2>&1 ||:
#fi
%preun -n fence-sanlock
%if %{with_systemd}
%service_del_preun fence_sanlockd.service
%endif
%stop_on_removal fence_sanlockd
%postun -n fence-sanlock
%if %{with_systemd}
%service_del_postun fence_sanlockd.service
%endif
%endif
%changelog %changelog

View File

@ -1,14 +1,15 @@
Index: sanlock-2.1/src/main.c Index: sanlock-2.6/src/main.c
=================================================================== ===================================================================
--- sanlock-2.1.orig/src/main.c --- sanlock-2.6.orig/src/main.c
+++ sanlock-2.1/src/main.c +++ sanlock-2.6/src/main.c
@@ -1439,8 +1439,7 @@ static int read_command_line(int argc, c @@ -1841,8 +1841,8 @@ static int read_command_line(int argc, c
if (!strcmp(arg1, "version") || !strcmp(arg1, "--version") || if (!strcmp(arg1, "version") || !strcmp(arg1, "--version") ||
!strcmp(arg1, "-V")) { !strcmp(arg1, "-V")) {
- printf("%s %s (built %s %s)\n", - printf("%s %s (built %s %s)\n",
- argv[0], RELEASE_VERSION, __DATE__, __TIME__); - argv[0], VERSION, __DATE__, __TIME__);
+ printf("%s %s\n", argv[0], RELEASE_VERSION); + printf("%s %s\n",
+ argv[0], VERSION);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }

View File

@ -1,30 +1,33 @@
Index: sanlock-2.1/init.d/sanlock.service Index: sanlock-2.6/init.d/sanlock.service
=================================================================== ===================================================================
--- sanlock-2.1.orig/init.d/sanlock.service --- sanlock-2.6.orig/init.d/sanlock.service
+++ sanlock-2.1/init.d/sanlock.service +++ sanlock-2.6/init.d/sanlock.service
@@ -3,8 +3,9 @@ After=syslog.target wdmd.service @@ -5,8 +5,10 @@ After=syslog.target wdmd.service
[Service] [Service]
Type=forking Type=forking
ControlGroup=cpu:/
-ExecStart=/lib/systemd/systemd-sanlock start -ExecStart=/lib/systemd/systemd-sanlock start
-ExecStop=/lib/systemd/systemd-sanlock stop -ExecStop=/lib/systemd/systemd-sanlock stop
+EnvironmentFile=-/etc/sysconfig/sanlock +EnvironmentFile=-/etc/sysconfig/sanlock
+ExecStart=/usr/sbin/sanlock daemon $SANLOCKOPTS +ExecStart=/usr/sbin/sanlock daemon $SANLOCKOPTS
+ExecStop=/bin/kill -TERM $MAINPID
+ExecReload=/bin/kill -HUP $MAINPID +ExecReload=/bin/kill -HUP $MAINPID
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
Index: sanlock-2.1/init.d/wdmd.service Index: sanlock-2.6/init.d/wdmd.service
=================================================================== ===================================================================
--- sanlock-2.1.orig/init.d/wdmd.service --- sanlock-2.6.orig/init.d/wdmd.service
+++ sanlock-2.1/init.d/wdmd.service +++ sanlock-2.6/init.d/wdmd.service
@@ -3,8 +3,8 @@ After=syslog.target @@ -5,8 +5,10 @@ After=syslog.target
[Service] [Service]
Type=forking Type=forking
ControlGroup=cpu:/
-ExecStart=/lib/systemd/systemd-wdmd start -ExecStart=/lib/systemd/systemd-wdmd start
-ExecStop=/lib/systemd/systemd-wdmd stop -ExecStop=/lib/systemd/systemd-wdmd stop
+ExecStart=/usr/sbin/wdmd +EnvironmentFile=-/etc/sysconfig/wdmd
+ExecStart=/usr/sbin/wdmd $WDMDOPTS
+ExecStop=/bin/kill -TERM $MAINPID
+ExecReload=/bin/kill -HUP $MAINPID +ExecReload=/bin/kill -HUP $MAINPID
[Install] [Install]

View File

@ -1,10 +1,13 @@
## Path: System/Virtualization/sanlock ## Path: System/Virtualization/sanlock
## Type: string ## Type: string
## Default: "" ## Default: "-U sanlock -G sanlock"
# Options passed to sanlock daemon, see man sanlock(8) # Options passed to sanlock daemon, see man sanlock(8).
# E.g. to use sanlock without the watchdog multiplexing
# daemon set SANLOCK_OPTS as follows
# #
# SANLOCK_OPTS="-w 0" # E.g. to use sanlock without the watchdog multiplexing
SANLOCK_OPTS="" # daemon set SANLOCKOPTS as follows
#SANLOCKOPTS="-U sanlock -G sanlock -w 0"
#
# To disable use of watchdog via wdmd and disable high priority features
#SANLOCKOPTS="-U sanlock -G sanlock -w 0 -h 0"
SANLOCKOPTS="-U sanlock -G sanlock"

9
sysconfig.wdmd Normal file
View File

@ -0,0 +1,9 @@
## Path: System/Virtualization/wdmd
## Type: string
## Default: "-G sanlock"
# Options passed to wdmd daemon, see man wdmd(8).
#
# E.g. to enable use of test scripts
#WDMDOPTS="-G sanlock -S 1"
WDMDOPTS="-G sanlock"

View File

@ -12,46 +12,63 @@
# Description: starts and stops wdmd daemon # Description: starts and stops wdmd daemon
### END INIT INFO ### END INIT INFO
WDMD_BIN=/usr/sbin/wdmd WDMDBIN=/usr/sbin/wdmd
WDMD_PIDFILE=/var/run/wdmd/wdmd.pid WDMDRUNDIR=/var/run/wdmd
WDMDPIDFILE=$WDMDRUNDIR/wdmd.pid
WDMDGROUP="sanlock" WDMDGROUP="sanlock"
WDMDOPTS="-G $WDMDGROUP" WDMDOPTS="-G $WDMDGROUP"
test -x $WDMD_BIN || { echo "$WDMD_BIN not installed"; test -x $WDMDBIN || { echo "$WDMDBIN not installed";
if [ "$1" = "stop" ]; then exit 0; if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; } else exit 5; fi; }
[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog [ -f /etc/sysconfig/wdmd ] && . /etc/sysconfig/wdmd
. /etc/rc.status . /etc/rc.status
rc_reset rc_reset
watchdog_check() {
if [ ! -c /dev/watchdog ]; then
echo -n "Loading the softdog kernel module "
modprobe softdog && udevadm settle
if [ ! -c /dev/watchdog ]; then
rc_failed 1
rc_status -v
rc_exit
fi
rc_status -v
fi
}
case "$1" in case "$1" in
start) start)
if [ ! -d /var/run/$prog ]; then watchdog_check
mkdir -p /var/run/$prog
if [ ! -d $WDMDRUNDIR ]; then
install -d -g $WDMDGROUP -m 775 $WDMDRUNDIR
[ -x /sbin/restorecon ] && restorecon $WDMDRUNDIR
fi fi
if [ -e $WDMD_PIDFILE ]; then if [ -e $WDMDPIDFILE ]; then
if checkproc $WDMD_BIN ; then if checkproc $WDMDBIN; then
echo -n "wdmd is already running." echo -n "wdmd is already running."
rc_status -v rc_status -v
exit rc_exit
else else
echo "Removing stale PID file $WDMD_PIDFILE." echo "Removing stale PID file $WDMDPIDFILE."
rm -f $WDMD_PIDFILE rm -f $WDMDPIDFILE
fi fi
fi fi
echo -n "Starting wdmd " echo -n "Starting wdmd "
startproc $WDMD_BIN $WDMDOPTS startproc $WDMDBIN $WDMDOPTS
rc_status -v rc_status -v
;; ;;
stop) stop)
echo -n "Shutting down wdmd " echo -n "Shutting down wdmd "
killproc -TERM $WDMD_BIN > /dev/null 2>&1 killproc -TERM $WDMDBIN > /dev/null 2>&1
rm -f $WDMD_PIDFILE rm -f $WDMDPIDFILE
rc_status -v rc_status -v
;; ;;
try-restart) try-restart)
@ -64,12 +81,12 @@ case "$1" in
rc_status rc_status
;; ;;
reload) reload)
killproc -HUP $WDMD_BIN killproc -HUP $WDMDBIN
rc_status -v rc_status -v
;; ;;
status) status)
echo -n "Checking status of wdmd " echo -n "Checking status of wdmd "
checkproc $WDMD_BIN checkproc $WDMDBIN
rc_status -v rc_status -v
;; ;;
*) *)