Changes to 'timeout3'
by David Teigland
New branch 'timeout3' available with the following commits:
commit db945909cd88cf59ea2ab013397307069cadee63
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 08:58:57 2012 -0500
sanlock: adjustable io timeouts
New sanlock_add_lockspace_timeout() api to allow
the timeout to be specified per lockspace.
Also correctly handle nodes that may be using
different timeouts in the same lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
11 years, 4 months
Changes to 'timeout2'
by David Teigland
New branch 'timeout2' available with the following commits:
commit 86cd2605959f568cbfff3f65efd71c63f953cde7
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 08:58:57 2012 -0500
sanlock: adjustable io timeouts
New sanlock_add_lockspace_timeout() api to allow
the timeout to be specified per lockspace.
Also correctly handle nodes that may be using
different timeouts in the same lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
commit 9168d210b73bb7e446bc94d5062e08f696760c61
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 26 15:35:02 2012 -0500
daemon: log kill pid messages
Put messages in syslog when pids are being killed
for a failed lockspace, and when all pids have been
cleared from a failed lockspace.
Signed-off-by: David Teigland <teigland(a)redhat.com>
11 years, 4 months
src/lockfile.c src/lockfile.h src/main.c
by David Teigland
src/lockfile.c | 18 ++++++++++++++++--
src/lockfile.h | 2 +-
src/main.c | 8 ++++----
3 files changed, 21 insertions(+), 7 deletions(-)
New commits:
commit a80c4a0d0b3cd1cb9a10fb8b681c48bf639ca9d1
Author: David Teigland <teigland(a)redhat.com>
Date: Tue Jul 24 09:21:30 2012 -0500
daemon: fix lockfile ownership
make the owner sanlock uid/gid instead of root
so the daemon continues to have access to it
after the process drops root privileges.
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/lockfile.c b/src/lockfile.c
index cd4d4e2..129d956 100644
--- a/src/lockfile.c
+++ b/src/lockfile.c
@@ -29,7 +29,7 @@
#include "log.h"
#include "lockfile.h"
-int lockfile(const char *dir, const char *name)
+int lockfile(const char *dir, const char *name, int uid, int gid)
{
char path[PATH_MAX];
char buf[16];
@@ -38,13 +38,20 @@ int lockfile(const char *dir, const char *name)
int fd, rv;
old_umask = umask(0022);
- rv = mkdir(SANLK_RUN_DIR, 0777);
+ rv = mkdir(SANLK_RUN_DIR, 0775);
if (rv < 0 && errno != EEXIST) {
umask(old_umask);
return rv;
}
umask(old_umask);
+ rv = chown(SANLK_RUN_DIR, uid, gid);
+ if (rv < 0) {
+ log_error("lockfile chown error %s: %s",
+ SANLK_RUN_DIR, strerror(errno));
+ return rv;
+ }
+
snprintf(path, PATH_MAX, "%s/%s", dir, name);
fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0666);
@@ -83,6 +90,13 @@ int lockfile(const char *dir, const char *name)
goto fail;
}
+ rv = fchown(fd, uid, gid);
+ if (rv < 0) {
+ log_error("lockfile fchown error %s: %s",
+ path, strerror(errno));
+ goto fail;
+ }
+
return fd;
fail:
close(fd);
diff --git a/src/lockfile.h b/src/lockfile.h
index 1702d71..57bbcec 100644
--- a/src/lockfile.h
+++ b/src/lockfile.h
@@ -9,7 +9,7 @@
#ifndef __LOCKFILE_H__
#define __LOCKFILE_H__
-int lockfile(const char *dir, const char *name);
+int lockfile(const char *dir, const char *name, int uid, int gid);
void unlink_lockfile(int fd, const char *dir, const char *name);
#endif
diff --git a/src/main.c b/src/main.c
index fdf068d..8e39855 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1558,14 +1558,14 @@ static int do_daemon(void)
setup_logging();
+ fd = lockfile(SANLK_RUN_DIR, SANLK_LOCKFILE_NAME, com.uid, com.gid);
+ if (fd < 0)
+ return fd;
+
setup_host_name();
setup_groups();
- fd = lockfile(SANLK_RUN_DIR, SANLK_LOCKFILE_NAME);
- if (fd < 0)
- return fd;
-
log_error("sanlock daemon started %s aio %d %d renew %d %d host %s time %llu",
RELEASE_VERSION,
main_task.use_aio, main_task.io_timeout_seconds,
11 years, 4 months
[PATCH] rpm: add sanlock run directory permissions
by Federico Simoncelli
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
sanlock.spec | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/sanlock.spec b/sanlock.spec
index 56b861c..4f37046 100644
--- a/sanlock.spec
+++ b/sanlock.spec
@@ -1,6 +1,6 @@
Name: sanlock
Version: 2.3
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: A shared disk lock manager
Group: System Environment/Base
@@ -60,6 +60,8 @@ install -Dm 0644 src/logrotate.sanlock \
install -Dm 0644 src/sysconfig.sanlock \
$RPM_BUILD_ROOT/etc/sysconfig/sanlock
+install -Dd -m 775 $RPM_BUILD_ROOT/%{_localstatedir}/run/sanlock
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -119,6 +121,7 @@ fi
%endif
%{_sbindir}/sanlock
%{_sbindir}/wdmd
+%dir %attr(-,sanlock,sanlock) %{_localstatedir}/run/sanlock
%{_mandir}/man8/wdmd*
%{_mandir}/man8/sanlock*
%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
--
1.7.1
11 years, 4 months
src/main.c
by David Teigland
src/main.c | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 9f47804b2e8a0bc822b038427562d3a481c28693
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 10:58:50 2012 -0500
daemon: include resource.h
for rlimits
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/main.c b/src/main.c
index d5f4d04..fdf068d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,6 +32,7 @@
#include <sys/mman.h>
#include <sys/mman.h>
#include <sys/utsname.h>
+#include <sys/resource.h>
#include <uuid/uuid.h>
#define EXTERN
11 years, 4 months
Changes to 'refs/tags/sanlock-2.4'
by David Teigland
Changes since the dawn of time:
Daniel P. Berrange (15):
Fix const-ness of many APIs.
Fix warnings in watchdog module
Fix function prototypes for no-arg methods
Remove use of 'index' as a variable name
Make many functions static
Fix missing include in logging file
Annotate many unused parameters to avoid warnings
Remove redundant redeclaration of 'to' variable
Fix args to execv()
Remove redundant arg to 'run_command'
Rename optarg to optionarg to avoid clashing with getopt.h
Disable the read_request method since it is unused
Add many more compiler warning flags & safety checks
Hard code a sector size of 512 if the lease volume is a regular file
Ensure libsanlock.so is built with debug/warning flags
David Teigland (353):
sync_manager: initial commit
sync_manager: misc updates
sync_manager: misc updates
sync_manager: misc updates
sync_manager: misc updates
sync_manager: add more logging
sync_manager: misc updates
sync_manager: misc updates
sync_manager: num_hosts/MAX_HOSTS stuff
daemon: reworking notions of resource_id/token_name
sync_manager: resource lockfiles
sync_manager: lease arg processing
sync_manager: Began multiple lease support
sync_manager: use first command line arg as action
sync_manager: leader record changes and verify
sync_manager: clean up released leases
sync_manager: move functions around
sync_manager: add more tool actions
sync_manager: naming changes
sync_manager: separate token index and id
sync_manager: fix index usage and other misc
sync_manager: use pthread cond in acquire
sync_manager: write all log entries
sync_manager: simplify polling
sync_manager: fix waitpid use
sync_manager: acquire can fail early
sync_manager: write log entries at exit
sync_manager: add test program
sync_manager: move secondary pid check
sync_manager: fix disk paxos contention
devcount: fix verify checks
sync_manager: add GPL license file
sync_manager: fix leader block offsets
sync_manager: increase COMMAND_MAX
sync_manager: renewal should verify
sync_manager: use sector size from libblkid
sync_manager: use a real checksum function
sync_manager: add libblkid to spec file
sync_manager: print status info
sync_manager: one watchdog file per lease
sync_manager: lease_threads handle watchdog files
sync_manager: fix/add some text/comments
sync_manager: refactor read/write
sync_manager: move disk io functions
sync_manager: remove token arg
sync_manager: rename paxos_disk sync_disk
sync_manager: add aio read/write
sync_manager: make io_timeout_seconds a diskio arg
sync_manager: forgot to add new files
sync_manager: use log thread
sync_manager: client connections
sync_manager: connection processing
sync_manager: send/recv pid
sync_manager: add write_sectors
sync_manager: restructuring
sync_manager: write_sectors code factoring
sync_manager: daemonize
sync_manager: releasing leases
sync_manager: async releasing
sync_manager: release fixes
sync_manager: add direct and indirect acquire/release
sync_manager: reacquire resources
sync_manager: move code
sync_manager: same pid may reacquire resource
sync_manager: lease migration
sync_manager: handle client errors
sync_manager: improve error handling
sync_manager: host_id leases
sync_manager: remove empty files
sync_manager: print initialization info
sync_manager: rename files
sync_manager: clean up header org
sync_manager: delta_lease implementation
sync_manager: accept offset units
sync_manager: fix up init output
sync_manager: put back watchdog calls
sync_manager: fix start_host_id error paths
sync_manager: add log_error's for watchdog file errors
sync_manager: actual timeouts
sync_manager: change timeouts on cmd line
sanlock: create new external api
sanlock: build libsanlock
sanlock: use MAX_LEASES everywhere
sanlock: add libvirt plugin
sanlock plugin: couple minor fixes
sanlock: clean up /var file names
sanlock plugin: fix symbol needed by libvirt
sanlock: add some debug output
sanlock plugin: fix uuid copy
sanlock plugin: fix names
sanlock: add "owner_name"
sanlock: fix renewal checks
sanlock: clean up host_id types
sanlock: set_host_id command
sanlock: fix killing pids
sanlock: add status command
sanlock: set version to 1.0
sanlock: delta_lease cleanup
sanlock: changing num_hosts
sanlock: add dump command
sanlock: renewal timings
sanlock: add direct option
sanlock: check for watchdog file
sanlock: recovery fixes
lock_driver_sanlock: fix compile problems
sanlock: improve command options
sanlock: tidying help text
sanlock: move binary to /usr/sbin
sanlock: add init script
sanlock: fix sigterm shutdown
sanlock: init stop
sanlock: add wdtest command
sanlock.spec: new url
lock_driver_sanlock: remove close
sanlock: introduce lockspaces
lock_driver_sanlock: remove files
sanlock: better logging functions
sanlock: misc log message
sanlock.spec: sbin not libexec
sanlock init: remove watchdog reference
wdmd: watchdog multiplexing daemon
sanlock: add code to use wdmd
sanlock/wdmd: use wdmd in sanlock
sanlock/wdmd: add copyright header to source files
sanlock: rename sanlock source dir
sanlock: move tests dir
move COPYING file
wdmd: use signalfd for signal handling
Fix Makefile comments
wdmd: fix daemon debug option
wdmd: add init script
sanlock.spec: updates
sanlock.spec: src dir
sanlock: build with uninstalled libwdmd
sanlock: version 1.1
sanlock: high priority options
wdmd: high priority options
sanlock: return migration state
sanlock: migration.txt describes libvirt/sanlock steps
libsanlock: include admin functions
sanlock: fix host_id expiration check
sanlock: migration working
devcount: migrate test
sanlock: setowner improvements
sanlock: migrate to target fix
sanlock: fix wdmd stop order
sanlock: various fixes
sanlock: remove wdtest
sanlock: remove migration
sanlock: clean up command return data
sanlock: add resource string conversion functions
sanlock: rework internal structs
devcount: add relock test
sanlock: fix release and inquire
sanlock: add_lockspace EEXIST
sanlock: rework client handling
sanlock: clean up warnings
sanlock: debug message changes
sanlock: add lockspace checks
wdmd: enable test scripts
sanlock: add str_to_lockspace to lib
WIP devcount migrate
devcount: new migrate test
sanlock: read_id and live_id commands
sanlock: check lockspace name and host_id
sanlock: remove remaining cluster_mode
sanlock: add libsanlock_direct
devcountn: start multiple devcount tests
devcount: small changes
sanlock: new return values
sanlock: misc changes and fix
sanlock: log error of full bad block
sanlock: interval between renewal checks
sanlock: renewal changes
sanlock: fix log_dump
sanlock: fix find_client_pid
sanlock: fix host_id reads from paxos_acquire
sanlock: init with one write
devcount: improve output
devcount: new pause/resume
devcount: add expire test
sanlock: correct paxos usage
sanlock: direct read_leader
sanlock: paxos delays
sanlock: use thread pool
sanlock: client status output format changes
sanlock: fix inquire of dead pid
sanlock: use native linux aio
sanlock: i/o changes
sanlock: aio changes
sanlock: reduce paxos acquire read ops
sanlock: quiet error case
sanlock: don't free aio buf until event completes
sanlock: io timeout related changes
sanlock: read dblocks in single aligned io
sanlock: add sanlock_restrict api
sanlock: add sanlock_direct_sector_size api
sanlock: add checksum to dblocks
sanlock: fix init restart
sanlock: don't release tokens in dead lockspace
sanlock: fix adding lockspace
sanlock: official 1MB/8MB alignment
devcount: use aio in init
libsanlock: link with LDFLAGS
sanlock: increase version to 1.3
sanlock/wdmd: shut up warnings
sanlock: fix libwdmd linking
remove spec file
sanlock: use a completed read after renewal timeout
sanlock: use unique host name in delta leases
sanlock: remove sector_size api
sanlock: abort delta wait on shutdown
sanlock: fix add_lockspace failure
sanlk_load: add new test
sanlock: fix recv and inquire
sanlock: initial pid_dead check in acquire
sanlock: release 1.4
sanlock: generate a uuid for host id
sanlock: return -EINPROGRESS from add_lockspace
sanlk_load: periodically kill and replace a pid
sanlock: zero num_hosts uses DEFAULT_MAX_HOSTS
tests: misc changes
sanlock: break paxos_acquire wait loop
sanlock: increase log line to 512 bytes
sanlock: change a log_error to log_debug
sanlock: fail host_id when corrupted
sanlock: release 1.5
sanlock: release 1.6
sanlock: handle colon escaping in path strings
wdmd: add option for high priority
wdmd: use accept4 with SOCK_NONBLOCK
wdmd: tidy sun_addr snprintf
wdmd: pid and sock file changes
wdmd: add man page
wdmd: disable test scripts
sanlock: use accept4 with SOCK_NONBLOCK
sanlock: tidy sun_addr snprintf
sanlock: add explicit -luuid
sanlock: pid and sock file changes
sanlock: add man page
sanlock/wdmd: improve mkdir of run dir
wdmd: new build flags
sanlock: new build flags
sanlock/wdmd: use monotonic time
sanlock: build with pie
sanlock/wdmd: nonblocking listening/accept
sanlock: add missing monotime files
sanlock: update man page
sanlock: man page update
sanlock: update man page and help text
sanlock: print connections limit
release: sanlock 1.7
makefile: install mode for man pages
sanlock: read align_size in renewal
sanlock: check other host_id leases
sanlock: minor fixes and cleanups
sanlock: add request api/cmd
sanlock: crc code tidying
sanlock/wdmd: add license header to files
sanlock: create libsanlock_client
sanlock: move client code
remove COPYING file
sanlock: remove internal header from sanlock_sock
libsanlock_client: use LGPLv2+
libwdmd: use LGPLv2+
sanlock_rv.h: switch to LGPLv2+
README.license: document licenses
sanlock: client align and init
sanlock: write request record
sanlock: request struct magic and version numbers
sanlock: set bitmap for requests
sanlock: examine resource requests
sanlock: update man page
sanlock: remove old comment
sanlock: renaming functions
sanlock: optimize paxos wait
sanlock: use flags in struct resource
sanlock: restructure lockspace checks
sanlock: remove BLOCK_WD force mode
libsanlock: fix function stubs
sanlock: new status and host_status
sanlock: improve status output
sanlock: status output sorting
sanlock: SIGTERM and SIGKILL for REQ_KILL_PID
sanlock: add flag RESTRICT_SIGKILL
sanlock: setup fewer aio events
sanlock: move cmd processing
sanlock: suppress log messages
sanlock: rename source files
sanlock: improve killing pids
sanlock: fix log_dump
version 1.8
sanlock: quick host_id reacquire
sanlock: add force option to shutdown command
simpler copyright line
default to GPLv2+ for our original files
sanlock: improve daemon permission errors
add systemd files
fixing up init stuff
release 1.9
sanlock: setmode
Revert "sanlock: setmode"
sanlock: fix error exit
sanlock: fix debug line
init scripts: fix path to restorecon
sanlock: shared mode for leases
sanlock: fix missing close_disks
sanlock: fix problem in paxos
sanlock: add paxos sanity check
sanlock: fix leaking fd
sanlock: change to paxos algorithm
sanlock: change ondisk version
sanlock: remove log noise
sanlock: ignore SIGTERM if lockspaces exist
sanlock: quiet more error messages
sanlk_load: munging variable names
sanlk_load: add shared locks
sanlock: kill client connection on recv error
sanlk_load: ignore release errors
sanlock: set sector_size in shared tokens
sanlock man page: mention SH
release 2.0
sanlock: clean up warnings
sanlock: fix inquire state string
sanlock: retry transient sh failures
sanlock: status for all shared tokens
sanlock: add a logrotate file
release 2.1
python: fix path strncpy
sanlock: remove physical sector size requirement
sanlock: add sample sysconfig file
sanlock: ASYNC flag for lockspace add and rem
sanlock: UNUSED flag for lockspace rem
release 2.2
sanlock.log: empty file to install from rpm
Revert "sanlock.log: empty file to install from rpm"
sanlock: remove limits.conf
sysconfig: remove user option
init: root user
release 2.3
latest spec file
sanlock.spec: fix exclusive arch
sanlock/wdmd: use /var/log/subsys/file
daemon: skip setup_groups when no -U or -G
sanlock.spec: require useradd and groupadd
sanlock.spec updated
daemon: don't put struct space on stack
daemon: fix add_lockspace that has been removed
daemon: fix inquire lver
daemon: graceful pid handling
Revert "init: make explicit to run sanlock as root"
remove spec file
release 2.4
David Weber (2):
Fix order of linking
Install another symlink to shared library
Fabio M. Di Nitto (5):
build: sanlock should link with libsanlock
build: install shared lib header files and fix DESTDIR usage
build: drop rpm target
spec file: do first cut for total spec file
build: fix linking with libsanlock and install target
Federico Simoncelli (53):
rpm: sync specfile with fedora
rpm: add sanlock_admin.h header
rpm: add the lib package, install the initscripts
python: remove unused python code
python: add python binding
python: release the gil during sanlock operations
python: wrap sanlock extension with a module
rpm: add python binding package
python: pass a lockspace copy to str_to_lockspace
makefile: fix install typo
rpm: add sanlock_direct header
python: add sanlock init functions and exception
direct: close disks after initialization
python: register process only once
daemon: configurable socket permissions
rpm: add sanlock user and group
python: exceptions must contain the errno
rpm: add missing libaio-devel dependency
rpm: add daemon options in the init file
python: add missing aio library
python: add get_alignment function
libs: include libsanlock_direct into libsanlock
python: align num_hosts and max_hosts defaults
python: expose sanlock file descriptor
python: improve error reporting
python: parse lockspaces and resources natively
python: add usage example
python: initial support for sanlock errors
python: document the sanlock module
python: module cleanup
build: fix documentation install path
client: return appropriate errno on failure
python: expose errno in the exception
python: acquire leases for other processes
sanlock: implement the inq_lockspace command
python: add the inq_lockspace command binding
misc: run sanlock daemon as sanlock user
wdmd: use getopt to parse the command line
wdmd: make socket group ownership configurable
python: add shared resource parameter to acquire
python: release leases for other processes
python: ASYNC flag for lockspace add and rem
python: UNUSED flag for lockspace rem
log: add full time and date to the log messages
sanlock: set the supplementary groups at startup
log: add the thread id in the log messages
sanlock: fix an rv check typo in setup_groups
init: add a stop timeout for the sanlock service
build: add a generic rpm spec file
init: make explicit to run sanlock as root
wdmd: load the softdog module when needed
sanlock: WAIT flag for sanlock_inq_lockspace
daemon: drop root privileges and use the helper
Saggi Mizrahi (21):
Added the begining of the testing and debugging tools
Better handling of max hosts
sync_manager: Updated tests to work with new lease struct
sync_manager: fixed skipping first arg in command
sync_manager: acquire and release actions
sync_manager: minor fixes
sync_manager: renamed stuff
sync_manager: made acquire synchronous again
sync_manager: added set_host_id action
sync_manager: use kill(0) for secondary pid check
sync_manager: make rpm and install
sync_manager: spec file update
sync_manager: Allow longer resource names
sync_manager: allow repeated set_host_id
sync_manager: Added escaping for the leases arg
sync_manager: Created the python bindings for sync_manager
sync_manager: listener socket permissions
sync_manager: Updated python binding and tests
sync_manager: Made 'token' a const in log_level
sync_manager: refactor messaging system
sync_manager: use getsockopt PEERCRED
11 years, 4 months
src/main.c wdmd/main.c
by David Teigland
src/main.c | 2 +-
wdmd/main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit d7a06800560481fbb6fedc4e97d61ae7a5713665
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 09:24:38 2012 -0500
release 2.4
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/main.c b/src/main.c
index e186314..d5f4d04 100644
--- a/src/main.c
+++ b/src/main.c
@@ -51,7 +51,7 @@
#include "cmd.h"
#include "helper.h"
-#define RELEASE_VERSION "2.3"
+#define RELEASE_VERSION "2.4"
#define SIGRUNPATH 100 /* anything that's not SIGTERM/SIGKILL */
diff --git a/wdmd/main.c b/wdmd/main.c
index 0143a92..63ae2bc 100644
--- a/wdmd/main.c
+++ b/wdmd/main.c
@@ -41,7 +41,7 @@
#define GNUC_UNUSED __attribute__((__unused__))
#endif
-#define RELEASE_VERSION "2.3"
+#define RELEASE_VERSION "2.4"
#define DEFAULT_TEST_INTERVAL 10
#define DEFAULT_FIRE_TIMEOUT 60
11 years, 4 months
2 commits - init.d/sanlock sanlock.spec
by David Teigland
init.d/sanlock | 2
sanlock.spec | 277 ---------------------------------------------------------
2 files changed, 1 insertion(+), 278 deletions(-)
New commits:
commit 5517b7c61d15734388413d67720089b7e9e88928
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 09:21:10 2012 -0500
remove spec file
I've not been able to keep this updated or properly in sync
with the "real" copies.
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/sanlock.spec b/sanlock.spec
deleted file mode 100644
index 56b861c..0000000
--- a/sanlock.spec
+++ /dev/null
@@ -1,277 +0,0 @@
-Name: sanlock
-Version: 2.3
-Release: 4%{?dist}
-Summary: A shared disk lock manager
-
-Group: System Environment/Base
-License: GPLv2 and GPLv2+ and LGPLv2+
-URL: https://fedorahosted.org/sanlock/
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: libblkid-devel libaio-devel python python-devel
-Requires: %{name}-lib = %{version}-%{release}
-Requires(pre): /usr/sbin/groupadd
-Requires(pre): /usr/sbin/useradd
-Source0: https://fedorahosted.org/releases/s/a/sanlock/%{name}-%{version}.tar.gz
-
-%if 0%{?fedora} >= 16
-BuildRequires: systemd-units
-%endif
-
-%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.
-
-%prep
-%setup -q
-
-%build
-# upstream does not require configure
-# upstream does not support _smp_mflags
-CFLAGS=$RPM_OPT_FLAGS make -C wdmd
-CFLAGS=$RPM_OPT_FLAGS make -C src
-CFLAGS=$RPM_OPT_FLAGS make -C python
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make -C src \
- install LIBDIR=%{_libdir} \
- DESTDIR=$RPM_BUILD_ROOT
-make -C wdmd \
- install LIBDIR=%{_libdir} \
- DESTDIR=$RPM_BUILD_ROOT
-make -C python \
- install LIBDIR=%{_libdir} \
- DESTDIR=$RPM_BUILD_ROOT
-
-%if 0%{?fedora} >= 16
-install -D -m 0755 init.d/sanlock $RPM_BUILD_ROOT/lib/systemd/systemd-sanlock
-install -D -m 0644 init.d/sanlock.service $RPM_BUILD_ROOT/%{_unitdir}/sanlock.service
-install -D -m 0755 init.d/wdmd $RPM_BUILD_ROOT/lib/systemd/systemd-wdmd
-install -D -m 0644 init.d/wdmd.service $RPM_BUILD_ROOT/%{_unitdir}/wdmd.service
-%else
-install -D -m 755 init.d/sanlock $RPM_BUILD_ROOT/%{_initddir}/sanlock
-install -D -m 755 init.d/wdmd $RPM_BUILD_ROOT/%{_initddir}/wdmd
-%endif
-
-install -Dm 0644 src/logrotate.sanlock \
- $RPM_BUILD_ROOT/etc/logrotate.d/sanlock
-
-install -Dm 0644 src/sysconfig.sanlock \
- $RPM_BUILD_ROOT/etc/sysconfig/sanlock
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%pre
-getent group sanlock > /dev/null || /usr/sbin/groupadd \
- -g 179 sanlock
-getent passwd sanlock > /dev/null || /usr/sbin/useradd \
- -u 179 -c "sanlock" -s /sbin/nologin -r \
- -g 179 -d /var/run/sanlock sanlock
-
-%post
-if [ $1 -eq 1 ] ; then
-%if 0%{?fedora} >= 16
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-%else
- /sbin/chkconfig --add sanlock
- /sbin/chkconfig --add wdmd
-%endif
-fi
-
-%preun
-if [ $1 = 0 ]; then
-%if 0%{?fedora} >= 16
- /bin/systemctl --no-reload sanlock.service > /dev/null 2>&1 || :
- /bin/systemctl --no-reload wdmd.service > /dev/null 2>&1 || :
- /bin/systemctl stop sanlock.service > /dev/null 2>&1 || :
- /bin/systemctl stop wdmd.service > /dev/null 2>&1 || :
-%else
- /sbin/service sanlock stop > /dev/null 2>&1
- /sbin/service wdmd stop > /dev/null 2>&1
- /sbin/chkconfig --del sanlock
- /sbin/chkconfig --del wdmd
-%endif
-fi
-
-%postun
-if [ $1 -ge 1 ] ; then
-%if 0%{?fedora} >= 16
- /bin/systemctl try-restart sanlock.service >/dev/null 2>&1 || :
- /bin/systemctl try-restart wdmd.service >/dev/null 2>&1 || :
-%else
- /sbin/service sanlock condrestart >/dev/null 2>&1 || :
- /sbin/service wdmd condrestart >/dev/null 2>&1 || :
-%endif
-fi
-
-%files
-%defattr(-,root,root,-)
-%if 0%{?fedora} >= 16
-/lib/systemd/systemd-sanlock
-/lib/systemd/systemd-wdmd
-%{_unitdir}/sanlock.service
-%{_unitdir}/wdmd.service
-%else
-%{_initddir}/sanlock
-%{_initddir}/wdmd
-%endif
-%{_sbindir}/sanlock
-%{_sbindir}/wdmd
-%{_mandir}/man8/wdmd*
-%{_mandir}/man8/sanlock*
-%config(noreplace) %{_sysconfdir}/logrotate.d/sanlock
-%config(noreplace) %{_sysconfdir}/sysconfig/sanlock
-
-%package lib
-Summary: A shared disk lock manager library
-Group: System Environment/Libraries
-
-%description lib
-The %{name}-lib package contains 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.
-
-%post lib -p /sbin/ldconfig
-
-%postun lib -p /sbin/ldconfig
-
-%files lib
-%defattr(-,root,root,-)
-%{_libdir}/libsanlock.so.*
-%{_libdir}/libsanlock_client.so.*
-%{_libdir}/libwdmd.so.*
-
-%package python
-Summary: Python bindings for the sanlock library
-Group: Development/Libraries
-Requires: %{name}-lib = %{version}-%{release}
-
-%description python
-The %{name}-python package contains a module that permits applications
-written in the Python programming language to use the interface
-supplied by the sanlock library.
-
-%files python
-%defattr(-,root,root,-)
-%{python_sitearch}/Sanlock-1.0-py*.egg-info
-%{python_sitearch}/sanlock.so
-
-%package devel
-Summary: Development files for %{name}
-Group: Development/Libraries
-Requires: %{name}-lib = %{version}-%{release}
-
-%description devel
-The %{name}-devel package contains libraries and header files for
-developing applications that use %{name}.
-
-%files devel
-%defattr(-,root,root,-)
-%{_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
-
-%changelog
-* Mon Jun 18 2012 David Teigland <teigland(a)redhat.com> - 2.3-4
-- Require systemd-units
-
-* Fri Jun 15 2012 David Teigland <teigland(a)redhat.com> - 2.3-3
-- Require useradd and groupadd
-
-* Mon Jun 04 2012 David Teigland <teigland(a)redhat.com> - 2.3-2
-- Remove exclusive arch
-
-* Wed May 30 2012 David Teigland <teigland(a)redhat.com> - 2.3-1
-- Update to sanlock-2.3
-
-* Fri May 25 2012 Federico Simoncelli <fsimonce(a)redhat.com> 2.2-2
-- Support multiple platforms in the spec file
-
-* Mon May 07 2012 David Teigland <teigland(a)redhat.com> - 2.2-1
-- Update to sanlock-2.2
-
-* Thu Apr 05 2012 David Teigland <teigland(a)redhat.com> - 2.1-2
-- Install service files instead of init files
-
-* Wed Mar 21 2012 David Teigland <teigland(a)redhat.com> - 2.1-1
-- Update to sanlock-2.1
-
-* Fri Mar 02 2012 David Teigland <teigland(a)redhat.com> - 2.0-1
-- Update to sanlock-2.0
-
-* Tue Sep 20 2011 David Teigland <teigland(a)redhat.com> - 1.8-2
-- fix useradd command in spec file
-
-* Fri Sep 16 2011 Chris Feist <cfeist(a)redhat.com - 1.8-1
-- Update to sanlock-1.8
-
-* Fri Aug 19 2011 Dan Horák <dan[at]danny.cz> - 1.6-2
-- build on all arches again
-
-* Sun Aug 07 2011 Chris Feist <cfeist(a)redhat.com> - 1.7-4
-- Fix for minor file include issues
-
-* Fri Aug 05 2011 David Teigland <teigland(a)redhat.com> - 1.7-3
-- fix man page mode
-
-* Fri Aug 05 2011 David Teigland <teigland(a)redhat.com> - 1.7-1
-- Update to sanlock-1.7
-
-* Fri Jul 08 2011 David Teigland <teigland(a)redhat.com> - 1.6-1
-- Update to sanlock-1.6
-
-* Thu Jun 30 2011 David Teigland <teigland(a)redhat.com> - 1.5-1
-- Update to sanlock-1.5
-
-* Tue Jun 21 2011 David Teigland <teigland(a)redhat.com> - 1.4-1
-- Update to sanlock-1.4
-
-* Fri Jun 10 2011 David Teigland <teigland(a)redhat.com> - 1.3-6
-- fix python version, build i686 also
-
-* Thu Jun 09 2011 David Teigland <teigland(a)redhat.com> - 1.3-5
-- build exclusive x86_64, at least for now
-
-* Thu Jun 09 2011 David Teigland <teigland(a)redhat.com> - 1.3-4
-- build only x86_64, at least for now
-
-* Thu Jun 09 2011 David Teigland <teigland(a)redhat.com> - 1.3-3
-- fix libwdmd linking
-
-* Thu Jun 09 2011 David Teigland <teigland(a)redhat.com> - 1.3-2
-- shut up build warnings for wdmd and sanlock
-
-* Thu Jun 09 2011 David Teigland <teigland(a)redhat.com> - 1.3-1
-- Update to sanlock-1.3
-
-* Mon May 09 2011 Chris Feist <cfeist(a)redhat.com> - 1.2.0-3
-- Add python and python-devel to build requires
-
-* Mon May 09 2011 Chris Feist <cfeist(a)redhat.com> - 1.2.0-1
-- Use latest sources
-- Sync .spec file
-
-* Mon Apr 4 2011 Federico Simoncelli <fsimonce(a)redhat.com> - 1.1.0-3
-- Add sanlock_admin.h header
-
-* Fri Feb 18 2011 Chris Feist <cfeist(a)redhat.com> - 1.1.0-2
-- Fixed install for wdmd
-
-* Thu Feb 17 2011 Chris Feist <cfeist(a)redhat.com> - 1.1.0-1
-- Updated to latest sources
-- Now include wdmd
-
-* Tue Feb 8 2011 Angus Salkeld <asalkeld(a)redhat.com> - 1.0-2
-- SPEC: Add docs and make more consistent with the fedora template
-
-* Mon Jan 10 2011 Fabio M. Di Nitto <fdinitto(a)redhat.com> - 1.0-1
-- first cut at rpm packaging
commit 5c9e1a0af8486b01d461beb76d785e9d4c917284
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jul 23 09:17:52 2012 -0500
Revert "init: make explicit to run sanlock as root"
This reverts commit 6cead337ff6c065a983e9d4e539fb28f3b812498.
diff --git a/init.d/sanlock b/init.d/sanlock
index f68ac14..bd8dccb 100644
--- a/init.d/sanlock
+++ b/init.d/sanlock
@@ -40,7 +40,7 @@ start() {
fi
echo -n $"Starting $prog: "
- daemon --user root $prog daemon $SANLOCKOPTS
+ daemon $prog daemon $SANLOCKOPTS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
11 years, 4 months
Changes to 'helper2'
by David Teigland
New branch 'helper2' available with the following commits:
commit 789aca6a66acfd5202e68d21ca5644266b3d56fa
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Wed Jul 18 12:44:15 2012 -0500
daemon: drop root privileges and use the helper
This patch lets the daemon drop the root privileges and routes
the kill requests to the helper.
Modifications from:
Signed-off-by: David Teigland <teigland(a)redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
commit 5318a1247fb5bc9f4a8a5de32065bc36d2be0280
Author: David Teigland <teigland(a)redhat.com>
Date: Thu May 24 11:07:17 2012 -0500
daemon: graceful pid handling
Add the "killpath" api to set a program/script for
"killing" a pid/connection, where killing could
be anything that either causes the pid to exit,
or causes the pid to be put into a safe state and
releases its leases, e.g. pausing a vm.
Add a helper process to fork/exec the killpaths.
If pids need to be killed, a configured killpath will
first be run instead of kill(SIGTERM). If the pid
has not exited or had its leases released before
the existing SIGTERM time limit, then sanlock will
escalate to SIGKILL.
This allows for the following:
- pids running with leases in lockspace
- lockspace storage fails (i/o errors, host_id cannot be renewed)
- sanlock runs killpath for each pid
- killpath does inquire, saves state, releases leases
- sanlock finds no more pids with leases in lockspace
- sanlock releases lockspace
- pids remain, but without leases
later:
- lockspace storage is restored
- add_lockspace reacquires host_id
- leases are reacquired for each pid using saved state
- pids running with leases again
This sequence is used by the following test:
cd tests
cp killpath /root/killpath_pause
On host_id 1
./clientn 2 init /dev/bull/leases
./clientn 2 start /dev/bull/leases 1 /root/killpath_pause
./clientn 2 error /dev/bull/leases
./clientn 2 resume /dev/bull/leases 1
If between error and resume, host_id 2 completes:
./clientn 2 start /dev/bull/leases 2 /root/killpath_pause
Then, the resume on host_id 1 will fail and the sanlk_client
pids will be killed.
Python changes from:
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Signed-off-by: David Teigland <teigland(a)redhat.com>
11 years, 4 months