commit 331aa19f8684d3ad8237f5c92fff9a158cc94efe413b743f32d80003040cfda0 Author: James Fehlig Date: Wed Oct 16 20:22:31 2024 +0000 - Update to version 3.9.5: * sanlock: change log level for resource names * sanlock: include worker thread info in status * sanlock: reuse io buffer with hugepages * sanlock: use hugepages to avoid splitting read io * sanlock: don't reduce max_sectors_kb * sanlock: fix is dead log message for unused host id * sanlock: repeat helper_msg string termination * sanlock: fix invalid strcpy in direct dump OBS-URL: https://build.opensuse.org/package/show/Virtualization/sanlock?expand=0&rev=79 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..86b0022 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + python + diff --git a/_service b/_service new file mode 100644 index 0000000..0448afc --- /dev/null +++ b/_service @@ -0,0 +1,18 @@ + + + sanlock + 651d101aab40bb75cf348ab667eba04d6d771c21 + git + disable + https://pagure.io/sanlock + @PARENT_TAG@ + ^sanlock[-]?(.*) + \1 + enable + + + *.tar + xz + + + diff --git a/_servicedata b/_servicedata new file mode 100644 index 0000000..e5657eb --- /dev/null +++ b/_servicedata @@ -0,0 +1,4 @@ + + + https://pagure.io/sanlock + 651d101aab40bb75cf348ab667eba04d6d771c21 \ No newline at end of file diff --git a/fence_sanlockd.init b/fence_sanlockd.init new file mode 100644 index 0000000..12db496 --- /dev/null +++ b/fence_sanlockd.init @@ -0,0 +1,168 @@ +#!/bin/sh +# +# fence_sanlockd - daemon for fence_sanlock agent +# +# chkconfig: 2345 20 80 +# description: starts and stops fence_sanlockd +# + +### 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 +### END INIT INFO + +prog="fence_sanlockd" +agent="fence_sanlock" +daemonrundir="/var/run/$prog" +agentrundir="/var/run/$agent" +runfile="$daemonrundir/$prog.pid" +fifofile="$daemonrundir/$prog.fifo" +lockfile="/var/lock/subsys/$prog" +exec="/usr/sbin/$prog" + +FENCESANLOCKDOPTS="-w" + +test -x $exec || { echo "$exec not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + +[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +. /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 + + if [ ! -d $daemonrundir ]; then + install -d -m 775 $daemonrundir + [ -x /sbin/restorecon ] && restorecon $daemonrundir + fi + if [ ! -d $agentrundir ]; then + install -d -m 775 $agentrundir + [ -x /sbin/restorecon ] && restorecon $agentrundir + fi + + if [ -e $runfile ]; then + if checkproc $exec ; then + echo -n "$prog is already running." + rc_status -v + rc_exit + else + echo "Removing stale PID file $runfile." + rm -f $runfile + fi + fi + + echo -n "Starting $prog " + startproc $exec daemon $FENCESANLOCKDOPTS + rc_status -v + ;; +stop) + agent_ps="$(ps ax -o pid,args | grep $agent | grep -v grep | grep -v $prog)" + + [ -n "$agent_ps" ] && { + agent_pid="$(echo $agent_ps | awk '{print $1}')" + echo -n "cannot stop while $agent $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 $runfile $prog) + + # 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=$? + 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 $fifofile ]; then + echo "" > $fifofile + fi + + echo -n $"Waiting for $prog ($PID) to stop" + 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 + + 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 + + rc_status -v + ;; +try-restart) + $0 status >/dev/null && $0 restart + rc_status + ;; +restart) + $0 stop + $0 start + rc_status + ;; +reload) + killproc -HUP $exec + rc_status -v + ;; +status) + echo -n "Checking status of $prog " + checkproc $exec + rc_status -v + ;; +*) + echo "Usage: $0 {start|stop|restart|try-restart|reload|status}" + rc_failed 2 + rc_exit + ;; +esac +rc_exit diff --git a/harden_fence_sanlockd.service.patch b/harden_fence_sanlockd.service.patch new file mode 100644 index 0000000..c2a1c6e --- /dev/null +++ b/harden_fence_sanlockd.service.patch @@ -0,0 +1,22 @@ +Index: sanlock-3.9.5/init.d/fence_sanlockd.service +=================================================================== +--- sanlock-3.9.5.orig/init.d/fence_sanlockd.service ++++ sanlock-3.9.5/init.d/fence_sanlockd.service +@@ -4,6 +4,17 @@ After=syslog.target wdmd.service sanlock + Before=corosync.service + + [Service] ++# added automatically, for details please see ++# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort ++ProtectSystem=full ++ProtectHome=true ++ProtectHostname=true ++ProtectKernelTunables=true ++ProtectKernelModules=true ++ProtectKernelLogs=true ++ProtectControlGroups=true ++RestrictRealtime=true ++# end of automatic additions + Type=forking + ExecStart=/usr/lib/systemd/systemd-fence_sanlockd start + ExecStop=/usr/lib/systemd/systemd-fence_sanlockd stop diff --git a/harden_sanlk-resetd.service.patch b/harden_sanlk-resetd.service.patch new file mode 100644 index 0000000..8bef4c2 --- /dev/null +++ b/harden_sanlk-resetd.service.patch @@ -0,0 +1,22 @@ +Index: sanlock-3.9.5/init.d/sanlk-resetd.service +=================================================================== +--- sanlock-3.9.5.orig/init.d/sanlk-resetd.service ++++ sanlock-3.9.5/init.d/sanlk-resetd.service +@@ -4,6 +4,17 @@ After=wdmd.service sanlock.service + Requires=wdmd.service sanlock.service + + [Service] ++# added automatically, for details please see ++# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort ++ProtectSystem=full ++ProtectHome=true ++ProtectHostname=true ++ProtectKernelTunables=true ++ProtectKernelModules=true ++ProtectKernelLogs=true ++ProtectControlGroups=true ++RestrictRealtime=true ++# end of automatic additions + Type=forking + ExecStart=/usr/sbin/sanlk-resetd + diff --git a/sanlock-3.9.3.tar.xz b/sanlock-3.9.3.tar.xz new file mode 100644 index 0000000..ab1cf7d --- /dev/null +++ b/sanlock-3.9.3.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c08bdf5c62ae514281efc96063cf87dc96ca6247b580d5080d356060726e1c35 +size 208896 diff --git a/sanlock-3.9.5.tar.xz b/sanlock-3.9.5.tar.xz new file mode 100644 index 0000000..aadc018 --- /dev/null +++ b/sanlock-3.9.5.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55054e334763cdf1c734c2b4b786d0194f1d05eea89dd37586584c0b40fcc49e +size 212960 diff --git a/sanlock-SCHED_RESET_ON_FORK-undefined.patch b/sanlock-SCHED_RESET_ON_FORK-undefined.patch new file mode 100644 index 0000000..0852ffa --- /dev/null +++ b/sanlock-SCHED_RESET_ON_FORK-undefined.patch @@ -0,0 +1,30 @@ +Index: src/main.c +=================================================================== +--- src/main.c.orig ++++ src/main.c +@@ -60,6 +60,10 @@ + + #define SIGRUNPATH 100 /* anything that's not SIGTERM/SIGKILL */ + ++#ifndef SCHED_RESET_ON_FORK ++#define SCHED_RESET_ON_FORK 0 ++#endif ++ + struct thread_pool { + int num_workers; + int max_workers; +Index: wdmd/main.c +=================================================================== +--- wdmd/main.c.orig ++++ wdmd/main.c +@@ -43,6 +43,10 @@ + #define GNUC_UNUSED __attribute__((__unused__)) + #endif + ++#ifndef SCHED_RESET_ON_FORK ++#define SCHED_RESET_ON_FORK 0 ++#endif ++ + #define DEFAULT_TEST_INTERVAL 10 + #define RECOVER_TEST_INTERVAL 1 + #define DEFAULT_FIRE_TIMEOUT 60 diff --git a/sanlock-python-prefix.patch b/sanlock-python-prefix.patch new file mode 100644 index 0000000..3ae8fc3 --- /dev/null +++ b/sanlock-python-prefix.patch @@ -0,0 +1,13 @@ +Index: python/Makefile +=================================================================== +--- python/Makefile.orig ++++ python/Makefile +@@ -10,7 +10,7 @@ all: + $(PYTHON) setup.py build $(BUILDARGS) + + install: +- $(PYTHON) setup.py install --root=$(DESTDIR) ++ $(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) + + clean: + rm -rf build diff --git a/sanlock.changes b/sanlock.changes new file mode 100644 index 0000000..7705dd7 --- /dev/null +++ b/sanlock.changes @@ -0,0 +1,350 @@ +------------------------------------------------------------------- +Wed Oct 16 20:14:45 UTC 2024 - jfehlig@suse.com + +- Update to version 3.9.5: + * sanlock: change log level for resource names + * sanlock: include worker thread info in status + * sanlock: reuse io buffer with hugepages + * sanlock: use hugepages to avoid splitting read io + * sanlock: don't reduce max_sectors_kb + * sanlock: fix is dead log message for unused host id + * sanlock: repeat helper_msg string termination + * sanlock: fix invalid strcpy in direct dump + +------------------------------------------------------------------- +Mon Jul 1 20:41:34 UTC 2024 - James Fehlig + +- suse-systemd.patch: Remove redundant 'ExecStart' from wdmd.service + boo#1227208 + +------------------------------------------------------------------- +Mon Jun 3 22:54:40 UTC 2024 - James Fehlig + +- Update to sanlock 3.9.3 + - Make the watchdog timeout configurable + - wdmd: close watchdog when not used + - userstorage: replace by PyPI userstorage + - sanlock: skip short delay in delta lease reacquire + - sanlock: use product_uuid for host name + - wdmd: fix timing for iTCO_wdt + - sanlock: save client_id in token and report in status and use in -C + - sanlock: include startup message in syslog + - sanlock: improve repeated ballots in paxos_acquire + - sanlock: fix zero io timeout for direct requests + - sanlock: fix release writing zero dblock values + - sanlock: skip delay when same host acquires delta lease + +------------------------------------------------------------------- +Mon Feb 26 13:04:34 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Jan 29 10:25:13 UTC 2024 - Dirk Müller + +- add user()/group() provides for rpm 4.19 + +------------------------------------------------------------------- +Tue Oct 18 14:27:20 UTC 2022 - James Fehlig + +- Update to sanlock 3.8.5 + - python: Replace distutils with setuptools + - sanlock: fix memory leak of lockspace renewal_history + - sanlock: fix pthread_create error check + - sanlock: use helper to set max_sectors_kb + +------------------------------------------------------------------- +Tue Nov 16 14:08:25 UTC 2021 - Johannes Segitz + +- Added hardening to systemd service(s) (bsc#1181400). Added patch(es): + * harden_fence_sanlockd.service.patch + * harden_sanlk-resetd.service.patch + +------------------------------------------------------------------- +Wed Jun 9 19:58:35 UTC 2021 - James Fehlig + +- Update to sanlock 3.8.4 + - sanlock: socket send and recv retries + - python: expose {get,set}_lvb + - sanlock: Shrink thread pool when there is no work + - config: Add max_worker_threads + +------------------------------------------------------------------- +Fri Oct 23 20:58:29 UTC 2020 - Benjamin Greiner + +- Make python subpackage ready for multiple python3 flavors + using the multibuild feature gh#openSUSE/python-rpm-macros#66 + +------------------------------------------------------------------- +Tue Aug 18 22:48:21 UTC 2020 - James Fehlig + +- Update to sanlock 3.8.2 + - Remove extra link args + - Add write_init_io_timeout + - Disable high_priority SCHED_RR by default + - Dropped patches: + sanlock-lto-disable-fpie.patch +- Add tar_scm source service and use xz compression + +------------------------------------------------------------------- +Mon Jul 13 21:39:12 UTC 2020 - James Fehlig + +- Update to sanlock 3.8.1 + - python: add flake8 env + - Add client debug logging + _ Add per command debug logging + - Misc bug fixes and improvements + +------------------------------------------------------------------- +Fri Aug 16 07:37:30 UTC 2019 - Dominique Leuenberger + +- Addpkgconfig(uuid) BuildRequires: so far we relied on util-linux' + blkid to pull in uuid for us. + +------------------------------------------------------------------- +Mon Jun 24 14:49:15 UTC 2019 - Martin Liška + +- Add sanlock-lto-disable-fpie.patch in order to handle + boo#1138836. Extra -fPIE is stripped. + +------------------------------------------------------------------- +Mon Jun 17 21:45:36 UTC 2019 - Jim Fehlig + +- Update to sanlock 3.8.0 + - Add support for python 3 + - Add support for 4k sector size + - More API test coverage + - Misc bug fixes and improvements + - Dropped patches: + revert-5d535c0d-py2.patch, sanlock-python3.patch + +------------------------------------------------------------------- +Tue Apr 9 22:17:12 UTC 2019 - Jim Fehlig + +- Update to sanlock 3.7.1 + - Fix bugs in read_resource_owners + +------------------------------------------------------------------- +Thu Mar 21 20:27:25 UTC 2019 - Jim Fehlig + +- Update to sanlock 3.7.0 + - Allow setting max_sectors_kb + - Configurable sector size and align size + - Support SANLOCK_RUN_DIR and SANLOCK_PRIVILEGED environment + variables + - Revert upstream commit forcing use of python2 + revert-5d535c0d-py2.patch + - Dropped patches: + sanlock-old_blkid.patch, suse-fix-link-errors.patch + +------------------------------------------------------------------- +Mon Mar 26 16:36:05 UTC 2018 - jfehlig@suse.com + +- Fix module initialization to work with both python2 and python3 + Updated sanlock-python3.patch + bsc#1076414 + +------------------------------------------------------------------- +Wed Mar 21 12:58:08 UTC 2018 - tchvatal@suse.com + +- Add code to build with both python2 and python3 bindings with + provided condition so we can later on optionalize python2 builds + sanlock-python3.patch + bsc#1076414 + +------------------------------------------------------------------- +Wed Mar 21 12:44:29 UTC 2018 - tchvatal@suse.com + +- Cleanup with spec-cleaner (only support SLE12 and newer) +- Add -fno-strict-aliasing to python subpkg +- Create rcsanlk-resetd link for the service control + +------------------------------------------------------------------- +Tue Dec 5 18:53:41 UTC 2017 - jfehlig@suse.com + +- Update to sanlock 3.6.0 + - preserve dblock values when setting shared flag + - fix detection of shared lease + - fix release interference with paxos + - retry ballot when new lver is seen + - add a NOWAIT flag for convert + +------------------------------------------------------------------- +Thu Nov 23 13:47:59 UTC 2017 - rbrown@suse.com + +- Replace references to /var/adm/fillup-templates with new + %_fillupdir macro (boo#1069468) + +------------------------------------------------------------------- +Wed Jun 7 22:39:48 UTC 2017 - jfehlig@suse.com + +- Update to sanlock 3.5.0 + - increase open file limit to 2048 + - add option to log UTC timestamps + - doc improvements +- Remove support for old, non-systemd distros + +------------------------------------------------------------------- +Fri Apr 7 21:53:33 UTC 2017 - jengelh@inai.de + +- Remove redundant %if guards around %package and scriptlets. + They are only really needed for %files. +- Replace $RPM_ shell vars by modern macros. +- Trim descriptions a little. + +------------------------------------------------------------------- +Mon Apr 3 15:43:17 UTC 2017 - jfehlig@suse.com + +- spec: fix permissions on config files + +------------------------------------------------------------------- +Mon Apr 3 15:31:43 UTC 2017 - jfehlig@suse.com + +- Use System/Base in fence and reset subpackages + +------------------------------------------------------------------- +Mon Apr 3 07:21:10 UTC 2017 - mpluskal@suse.com + +- Use correct permissions on unit files (bsc#1032046) + +------------------------------------------------------------------- +Wed Mar 29 10:49:35 UTC 2017 - meissner@suse.com + +- prerequire groupadd and useradd. + +------------------------------------------------------------------- +Wed Mar 15 08:23:44 UTC 2017 - zren@suse.com + +- Update to sanlock 3.4.0 +- Enable fence_sanlockd so that lvm2 can use the new lvmlocked + feature in cluster environment + * fix unpackaged file - /usr/sbin/rcfence_sanlockd + * refresh suse-no-date-time.patch to cover the same issue + in fence_sanlockd + * adjust fence_sanlockd.init and suse-systemd.patch +- Enable sanlk-reset subpackage +- Fix "undefined symbol to io_suspend" at runtime, bsc#1030060 + suse-fix-link-errors.patch + +------------------------------------------------------------------- +Sat Mar 11 08:40:02 UTC 2017 - kukuk@suse.com + +- Add group disk as Prerequires + +------------------------------------------------------------------- +Fri Jun 19 10:48:55 MDT 2015 - jfehlig@suse.com + +- Update to sanlock 3.2.4 + - Add conf file sanlock.conf + - Add pkgconfig files + - Numerous improvements and bug fixes. For details, see + https://git.fedorahosted.org/cgit/sanlock.git/log/ + +------------------------------------------------------------------- +Sat Mar 21 16:26:54 UTC 2015 - p.drouand@gmail.com + +- Update to version 3.2.2 + * reset: native timeout + * reset: Reduce logging noise to stderr and syslog + * sanlock, reset: coverity fixes +- Refactor specfile to be policy compliant +- Use download Url as source +- Add xz build requires; needed as the source tarball is compressed + with xz +- Do not provide both systemd and sysvinit support on a same system; + it's redundant +- Add systemd backward compatibility links +- Update patchs: + * suse-no-date-time.patch + * suse-systemd.patch + +------------------------------------------------------------------- +Fri Jan 10 10:16:16 MST 2014 - jfehlig@suse.com + +- Update to sanlock 3.1.0 + - fix debug status for add/rem lockspace + - add_lockspace error for conflicting lockspace definitions + - transient timeout handling in acquire and release + - allow more than 8 resources per client + - fix spaces in path names + +------------------------------------------------------------------- +Thu Aug 1 16:42:24 MDT 2013 - jfehlig@suse.com + +- Update to sanlock 3.0.1 + - Add lvb feature + - Various bug fixes and improvements + - Drop upstream patch 0001-fix-systemd-service-files.patch + +------------------------------------------------------------------- +Fri Mar 1 06:25:28 UTC 2013 - coolo@suse.com + +- update license to new format + +------------------------------------------------------------------- +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 + +- Update to sanlock 2.1 + - python: release leases for other processes + - python: add shared resource parameter to acquire + - add a logrotate file + - status for all shared tokens + - retry transient sh failures + - fix inquire state string + +------------------------------------------------------------------- +Wed Jan 25 11:03:43 MST 2012 - jfehlig@suse.com + +- Fixed init script packaging + +------------------------------------------------------------------- +Mon Jan 23 11:20:40 MST 2012 - jfehlig@suse.com + +- Fixed specification of licenses + +------------------------------------------------------------------- +Mon Jan 23 09:39:31 MST 2012 - jfehlig@suse.com + +- Source sanlock tarball instead of download URL + +------------------------------------------------------------------- +Fri Jan 20 15:37:56 MST 2012 - jfehlig@suse.com + +- Don't use __DATE__ and __TIME__ macros when printing version +- Don't add user 'sanlock' for now + +------------------------------------------------------------------- +Thu Jan 19 18:04:13 MST 2012 - jfehlig@suse.com + +- Fix some rpmlint warnings + +------------------------------------------------------------------- +Thu Jan 19 17:05:58 MST 2012 - jfehlig@suse.com + +- Add support for systemd +- Add /etc/sysconfig/sanlock configuration file + +------------------------------------------------------------------- +Thu Jan 19 16:23:03 MST 2012 - jfehlig@suse.com + +- Pass '-g sanlock' option to wdmd + +------------------------------------------------------------------- +Wed Jan 18 10:17:57 MST 2012 - jfehlig@suse.com + +- Update to sanlock 1.9 +- Add SUSE init script for sanlock and wdmd + +------------------------------------------------------------------- +Thu Dec 22 01:15:39 CET 2011 - ro@suse.de + +- initial package based on package from openstack + diff --git a/sanlock.spec b/sanlock.spec new file mode 100644 index 0000000..286120f --- /dev/null +++ b/sanlock.spec @@ -0,0 +1,324 @@ +# +# spec file +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "python" +%global pprefix python- +%define oldpython python +%bcond_without python +%bcond_without python2 +%else +%global pprefix %{nil} +%bcond_with python +%bcond_with python2 +%endif + +%define with_fence_sanlockd 0 +%define with_sanlk_reset 0 +%if 0%{?suse_version} > 1320 +%define with_fence_sanlockd 1 +%define with_sanlk_reset 1 +%endif +#Compat macro for new _fillupdir macro introduced in Nov 2017 +%if ! %{defined _fillupdir} + %define _fillupdir %{_localstatedir}/adm/fillup-templates +%endif +%define pname sanlock +Name: %{pprefix}%{pname} +Version: 3.9.5 +Release: 0 +%if ! %{with python} +Summary: A shared disk lock manager +License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later +Group: System/Base +%else +Summary: Python bindings for the sanlock library +License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later +Group: System/Base +%endif +URL: https://pagure.io/sanlock +Source0: %{pname}-%{version}.tar.xz +Source1: sysconfig.sanlock +Source2: sysconfig.wdmd +Source3: fence_sanlockd.init +# Upstream patches +# SUSE patches +Patch100: sanlock-SCHED_RESET_ON_FORK-undefined.patch +Patch101: sanlock-python-prefix.patch +Patch102: suse-systemd.patch +Patch103: suse-no-date-time.patch +Patch104: harden_fence_sanlockd.service.patch +Patch105: harden_sanlk-resetd.service.patch +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: libaio-devel +BuildRequires: pkgconfig +BuildRequires: python-rpm-macros +BuildRequires: systemd-rpm-macros +BuildRequires: pkgconfig(blkid) +BuildRequires: pkgconfig(uuid) +%if ! %{with python} +Requires(pre): %fillup_prereq +Requires(pre): shadow +Provides: group(sanlock) +Provides: user(sanlock) +Recommends: logrotate +%{?systemd_requires} +%if 0%{?suse_version} >= 1500 +Requires(pre): group(disk) +%endif +%else +BuildRequires: %{pname}-devel = %{version} +Provides: sanlock-python +%if "%{python_flavor}" == "python2" +Provides: %{oldpython}-%{pname} +%endif +%endif +%python_subpackages + +%description +sanlock uses disk paxos to manage leases on shared storage. +Hosts connected to a common SAN can use this to synchronize their +access to the shared disks. +%if %{with python} +This package provides a module that permits applications written in +the Python programming language to use the interface supplied by the +sanlock library. +%endif + +%package -n libsanlock1 +Summary: A shared disk lock manager library +Group: Development/Libraries/C and C++ +Provides: sanlock-lib = %{version} + +%description -n libsanlock1 +The runtime libraries for sanlock, a shared disk lock manager. +Hosts connected to a common SAN can use this to synchronize their +access to the shared disks. + +%package -n %{pname}-devel +Summary: Development files for %{pname} +Group: Development/Libraries/C and C++ +Requires: libsanlock1 = %{version}-%{release} + +%description -n %{pname}-devel +The %{pname}-devel package contains libraries and header files for +developing applications that use %{pname}. + +%package -n fence-sanlock +Summary: Fence agent using sanlock and wdmd +Group: System/Base +Requires: sanlock = %{version}-%{release} + +%description -n fence-sanlock +Fence agent and daemon for using sanlock and wdmd as a cluster fence agent. + +%package -n sanlk-reset +Summary: Host reset daemon and client using sanlock +Group: System/Base +Requires: libsanlock1 = %{version}-%{release} +Requires: sanlock = %{version}-%{release} + +%description -n sanlk-reset +The reset daemon and client for sanlock. +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. + +%prep +%setup -q -n %{pname}-%{version} +%patch -P 100 +%patch -P 101 +%patch -P 102 -p1 +%patch -P 103 -p1 +%patch -P 104 -p1 +%patch -P 105 -p1 + +%build +%if ! %{with python} +# upstream does not require configure +# upstream does not support _smp_mflags +CFLAGS="%{optflags}" make -j1 -C wdmd +CFLAGS="%{optflags}" make -j1 -C src +%if %{with_fence_sanlockd} +CFLAGS="%{optflags}" make -j1 -C fence_sanlock +%endif +%if %{with_sanlk_reset} +CFLAGS="%{optflags}" make -j1 -C reset +%endif +%else +pushd python +CFLAGS="%{optflags} -fno-strict-aliasing" %python_build +popd +%endif + +%install +%if ! %{with python} +%make_install LIBDIR=%{_libdir} -C src +%make_install LIBDIR=%{_libdir} -C wdmd +%if %{with_fence_sanlockd} +%make_install LIBDIR=%{_libdir} -C fence_sanlock +%endif +%if %{with_sanlk_reset} +%make_install LIBDIR=%{_libdir} -C reset +%endif + +install -D -m 644 src/sanlock.conf %{buildroot}/%{_sysconfdir}/sanlock/sanlock.conf +install -D -m 644 %{SOURCE1} %{buildroot}/%{_fillupdir}/sysconfig.sanlock +install -D -m 644 %{SOURCE2} %{buildroot}/%{_fillupdir}/sysconfig.wdmd + +install -D -m 644 init.d/sanlock.service %{buildroot}/%{_unitdir}/sanlock.service +ln -s service %{buildroot}%{_sbindir}/rcsanlock +install -D -m 644 init.d/wdmd.service %{buildroot}/%{_unitdir}/wdmd.service +ln -s service %{buildroot}%{_sbindir}/rcwdmd +%if %{with_fence_sanlockd} +install -D -m 0755 %{SOURCE3} %{buildroot}%{_prefix}/lib/systemd/systemd-fence_sanlockd +install -D -m 0644 init.d/fence_sanlockd.service %{buildroot}/%{_unitdir}/fence_sanlockd.service +ln -s service %{buildroot}%{_sbindir}/rcfence_sanlockd +%endif +%if %{with_sanlk_reset} +install -D -m 0644 init.d/sanlk-resetd.service %{buildroot}/%{_unitdir}/sanlk-resetd.service +ln -s service %{buildroot}%{_sbindir}/rcsanlk-resetd +%endif + +install -Dm 0644 src/logrotate.sanlock \ + %{buildroot}%{_sysconfdir}/logrotate.d/sanlock + +install -Dd -m 0755 %{buildroot}%{_sysconfdir}/wdmd.d +%else +pushd python +%python_install +popd +%endif + +%if ! %{with python} +%pre -n %{pname} +getent group sanlock > /dev/null || groupadd \ + -g 179 sanlock +getent passwd sanlock > /dev/null || useradd \ + -u 179 -c "sanlock" -s /sbin/nologin -r \ + -g 179 -G disk -d %{_localstatedir}/run/sanlock sanlock + +%service_add_pre wdmd.service +%service_add_pre sanlock.service + +%pre -n fence-sanlock +%service_add_pre fence_sanlockd.service + +%pre -n sanlk-reset +%service_add_pre sanlk-resetd.service + +%post -n %{pname} +%service_add_post wdmd.service sanlock.service + +%fillup_only -n wdmd +%fillup_only -n sanlock + +%post -n libsanlock1 -p /sbin/ldconfig + +%if %{with_fence_sanlockd} +%post -n fence-sanlock +%service_add_post fence_sanlockd.service +%endif + +%post -n sanlk-reset +%service_add_post sanlk-resetd.service + +%preun -n %{pname} +%service_del_preun wdmd.service sanlock.service + +%preun -n fence-sanlock +%service_del_preun fence_sanlockd.service + +%preun -n sanlk-reset +%service_del_preun sanlk-resetd.service + +%postun -n %{pname} +%service_del_postun wdmd.service sanlock.service + +%postun -n libsanlock1 -p /sbin/ldconfig + +%postun -n fence-sanlock +%service_del_postun fence_sanlockd.service + +%postun -n sanlk-reset +%service_del_postun sanlk-resetd.service + +%files -n %{pname} +%dir %attr(0700, root, root) %{_sysconfdir}/wdmd.d/ +%dir %attr(0700, root, root) %{_sysconfdir}/sanlock/ +%config(noreplace) %{_sysconfdir}/sanlock/sanlock.conf +%{_sbindir}/rcsanlock +%{_fillupdir}/sysconfig.sanlock +%{_sbindir}/rcwdmd +%{_fillupdir}/sysconfig.wdmd +%{_unitdir}/sanlock.service +%{_unitdir}/wdmd.service +%{_sbindir}/sanlock +%{_sbindir}/wdmd +%{_mandir}/man8/wdmd* +%{_mandir}/man8/sanlock* +%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock + +%files -n libsanlock1 +%{_libdir}/libsanlock.so.* +%{_libdir}/libsanlock_client.so.* +%{_libdir}/libwdmd.so.* + +%files -n %{pname}-devel +%{_libdir}/libwdmd.so +%{_includedir}/wdmd.h +%{_libdir}/libsanlock.so +%{_libdir}/libsanlock_client.so +%{_includedir}/sanlock.h +%{_includedir}/sanlock_rv.h +%{_includedir}/sanlock_admin.h +%{_includedir}/sanlock_resource.h +%{_includedir}/sanlock_direct.h +%{_libdir}/pkgconfig/libsanlock.pc +%{_libdir}/pkgconfig/libsanlock_client.pc + +%if %{with_fence_sanlockd} +%files -n fence-sanlock +%{_sbindir}/fence_sanlockd +%{_prefix}/lib/systemd/systemd-fence_sanlockd +%{_unitdir}/fence_sanlockd.service +%{_sbindir}/fence_sanlock +%{_sbindir}/fence_sanlockd +%{_sbindir}/rcfence_sanlockd +%{_mandir}/man8/fence_sanlock* +%endif + +%if %{with_sanlk_reset} +%files -n sanlk-reset +%{_sbindir}/sanlk-reset +%{_sbindir}/sanlk-resetd +%{_sbindir}/rcsanlk-resetd +%{_unitdir}/sanlk-resetd.service +%{_mandir}/man8/sanlk-reset.8%{?ext_man} +%{_mandir}/man8/sanlk-resetd.8%{?ext_man} +%endif + +%else + +%files %{python_files} +%{python_sitearch}/sanlock*.so +%{python_sitearch}/sanlock_python-%{version}*info +%endif + +%changelog diff --git a/suse-no-date-time.patch b/suse-no-date-time.patch new file mode 100644 index 0000000..c1fb3a0 --- /dev/null +++ b/suse-no-date-time.patch @@ -0,0 +1,29 @@ +Index: sanlock-3.9.5/src/main.c +=================================================================== +--- sanlock-3.9.5.orig/src/main.c ++++ sanlock-3.9.5/src/main.c +@@ -2389,8 +2389,8 @@ static int read_command_line(int argc, c + } + + if (!strcmp(arg1, "--version") || !strcmp(arg1, "-V")) { +- printf("%s %s (built %s %s)\n", +- argv[0], VERSION, __DATE__, __TIME__); ++ printf("%s %s\n", ++ argv[0], VERSION); + exit(EXIT_SUCCESS); + } + +Index: sanlock-3.9.5/fence_sanlock/fence_sanlockd.c +=================================================================== +--- sanlock-3.9.5.orig/fence_sanlock/fence_sanlockd.c ++++ sanlock-3.9.5/fence_sanlock/fence_sanlockd.c +@@ -565,8 +565,7 @@ int main(int argc, char *argv[]) + print_usage(); + exit(0); + case 'V': +- printf("fence_sanlockd %s (built %s %s)\n", +- VERSION, __DATE__, __TIME__); ++ printf("fence_sanlockd %s\n", VERSION); + exit(0); + case EOF: + cont = 0; diff --git a/suse-systemd.patch b/suse-systemd.patch new file mode 100644 index 0000000..732a492 --- /dev/null +++ b/suse-systemd.patch @@ -0,0 +1,49 @@ +Index: sanlock-3.9.5/init.d/sanlock.service +=================================================================== +--- sanlock-3.9.5.orig/init.d/sanlock.service ++++ sanlock-3.9.5/init.d/sanlock.service +@@ -5,8 +5,10 @@ Wants=wdmd.service + + [Service] + Type=forking +-ExecStart=/lib/systemd/systemd-sanlock start +-ExecStop=/lib/systemd/systemd-sanlock stop ++EnvironmentFile=-/etc/sysconfig/sanlock ++ExecStart=/usr/sbin/sanlock daemon $SANLOCKOPTS ++ExecStop=/bin/kill -TERM $MAINPID ++ExecReload=/bin/kill -HUP $MAINPID + + [Install] + WantedBy=multi-user.target +Index: sanlock-3.9.5/init.d/wdmd.service +=================================================================== +--- sanlock-3.9.5.orig/init.d/wdmd.service ++++ sanlock-3.9.5/init.d/wdmd.service +@@ -5,8 +5,10 @@ After=syslog.target + [Service] + Type=forking + ExecStartPre=/lib/systemd/systemd-wdmd watchdog-check +-ExecStart=/usr/sbin/wdmd +-SendSIGKILL=no ++EnvironmentFile=-/etc/sysconfig/wdmd ++ExecStart=/usr/sbin/wdmd $WDMDOPTS ++ExecStop=/bin/kill -TERM $MAINPID ++ExecReload=/bin/kill -HUP $MAINPID + + [Install] + WantedBy=multi-user.target +Index: sanlock-3.9.5/init.d/fence_sanlockd.service +=================================================================== +--- sanlock-3.9.5.orig/init.d/fence_sanlockd.service ++++ sanlock-3.9.5/init.d/fence_sanlockd.service +@@ -5,8 +5,8 @@ Before=corosync.service + + [Service] + Type=forking +-ExecStart=/lib/systemd/systemd-fence_sanlockd start +-ExecStop=/lib/systemd/systemd-fence_sanlockd stop ++ExecStart=/usr/lib/systemd/systemd-fence_sanlockd start ++ExecStop=/usr/lib/systemd/systemd-fence_sanlockd stop + + [Install] + WantedBy=multi-user.target diff --git a/sysconfig.sanlock b/sysconfig.sanlock new file mode 100644 index 0000000..465d51d --- /dev/null +++ b/sysconfig.sanlock @@ -0,0 +1,13 @@ +## Path: System/Virtualization/sanlock + +## Type: string +## Default: "-U sanlock -G sanlock" +# Options passed to sanlock daemon, see man sanlock(8). +# +# E.g. to use sanlock without the watchdog multiplexing +# 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" \ No newline at end of file diff --git a/sysconfig.wdmd b/sysconfig.wdmd new file mode 100644 index 0000000..4f20639 --- /dev/null +++ b/sysconfig.wdmd @@ -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" \ No newline at end of file