sanlock.spec | 45 ++++++++++++++++++++++++++++++++++++++++-----
src/Makefile | 2 +-
src/client_admin.c | 1 -
src/client_resource.c | 1 -
src/diskio.c | 16 ++++++++++++++--
5 files changed, 55 insertions(+), 10 deletions(-)
New commits:
commit b8141bc0491fc73272756a672a6a52776d3f873e
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Apr 8 12:09:16 2011 -0500
sanlock: clean up warnings
diff --git a/src/client_admin.c b/src/client_admin.c
index 0cb4c15..2c90ad1 100644
--- a/src/client_admin.c
+++ b/src/client_admin.c
@@ -34,7 +34,6 @@
int sanlock_shutdown(void)
{
- struct sm_header h;
int fd;
fd = send_command(SM_CMD_SHUTDOWN, 0);
diff --git a/src/client_resource.c b/src/client_resource.c
index 46eceae..90416d0 100644
--- a/src/client_resource.c
+++ b/src/client_resource.c
@@ -551,7 +551,6 @@ int sanlock_state_to_args(char *res_state,
free(args[i]);
}
free(args);
- fail:
return rv;
}
commit e0f4b429d5edd6c501f36b525b92c90fda0dda79
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Apr 8 11:27:48 2011 +0100
Ensure libsanlock.so is built with debug/warning flags
diff --git a/src/Makefile b/src/Makefile
index 3cbd0e0..9513ec2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -59,7 +59,7 @@ CMD_LDFLAGS = -lpthread -lrt -lblkid -lsanlock -lwdmd
all: $(SHLIB_TARGET) $(CMD_TARGET)
$(SHLIB_TARGET): $(LIB_SOURCE)
- $(CC) -shared -fPIC -o $@ -Wl,-soname=$(LIB_TARGET).so.$(SOMAJOR) $^
+ $(CC) $(CFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_TARGET).so.$(SOMAJOR) $^
ln -sf $(SHLIB_TARGET) $(LIB_TARGET).so
ln -sf $(SHLIB_TARGET) $(LIB_TARGET).so.$(SOMAJOR)
commit 49248ca37fa7520c443ccd7b43bbed995a5b5831
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Apr 8 11:27:24 2011 +0100
Hard code a sector size of 512 if the lease volume is a regular file
libblkid can't determine sector size if the lease volume is a
regular file. Short-circuit libblkid for such files and hardcode
a sector size of 512.
diff --git a/src/diskio.c b/src/diskio.c
index 3c01650..78a5fee 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -20,6 +20,7 @@
#include <syslog.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/stat.h>
#include <aio.h>
#include <blkid/blkid.h>
@@ -82,6 +83,7 @@ int open_disks(struct sync_disk *disks, int num_disks)
int d, fd, rv;
uint32_t ss = 0;
uint64_t orig_offset;
+ struct stat st;
for (d = 0; d < num_disks; d++) {
disk = &disks[d];
@@ -91,12 +93,22 @@ int open_disks(struct sync_disk *disks, int num_disks)
continue;
}
- rv = set_disk_properties(disk);
- if (rv < 0) {
+ if (fstat(fd, &st) < 0) {
+ log_error("fstat error %d %s", fd, disk->path);
close(fd);
continue;
}
+ if (S_ISREG(st.st_mode)) {
+ disk->sector_size = 512;
+ } else {
+ rv = set_disk_properties(disk);
+ if (rv < 0) {
+ close(fd);
+ continue;
+ }
+ }
+
if (!ss) {
ss = disk->sector_size;
} else if (ss != disk->sector_size) {
commit f95e049c23c0e4ab5baaca429ebc701207021d3c
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Thu Apr 7 16:57:55 2011 +0100
rpm: add the lib package, install the initscripts
diff --git a/sanlock.spec b/sanlock.spec
index ce6e46e..d936756 100644
--- a/sanlock.spec
+++ b/sanlock.spec
@@ -11,7 +11,7 @@ BuildRoot:
%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libblkid-devel
-#Requires: <nothing>
+Requires: %{name}-lib = %{version}-%{release}
%description
sanlock uses disk paxos to manage leases on shared storage.
@@ -35,22 +35,55 @@ make -C src \
make -C wdmd \
install LIB_LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT
+install -D -m 755 init.d/sanlock $RPM_BUILD_ROOT/%{_initddir}/sanlock
+install -D -m 755 init.d/wdmd $RPM_BUILD_ROOT/%{_initddir}/wdmd
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
+%post
+/sbin/chkconfig --add sanlock
+/sbin/chkconfig --add wdmd
-%postun -p /sbin/ldconfig
+%preun
+if [ $1 = 0 ]; then
+ /sbin/service sanlock stop > /dev/null 2>&1
+ /sbin/service wdmd stop > /dev/null 2>&1
+ /sbin/chkconfig --del sanlock
+ /sbin/chkconfig --del wdmd
+fi
+
+%postun
+#/sbin/service sanlock condrestart >/dev/null 2>&1 || :
+#/sbin/service wdmd condrestart >/dev/null 2>&1 || :
%files
%defattr(-,root,root,-)
%doc COPYING
+%{_initddir}/sanlock
+%{_initddir}/wdmd
%{_sbindir}/sanlock
%{_sbindir}/wdmd
+
+%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,-)
+%doc COPYING
%{_libdir}/libsanlock.so.*
-%{_libdir}/libwdmd.*
-%{_includedir}/wdmd.h
+%{_libdir}/libwdmd.so.*
%package devel
Summary: Development files for %{name}
@@ -64,6 +97,8 @@ developing applications that use %{name}.
%files devel
%defattr(-,root,root,-)
%doc COPYING
+%{_libdir}/libwdmd.so
+%{_includedir}/wdmd.h
%{_libdir}/libsanlock.so
%{_includedir}/sanlock.h
%{_includedir}/sanlock_admin.h
Show replies by date