From: "Daniel P. Berrange" <berrange(a)redhat.com>
Inexpicably the sanlock code all got placed under the GPLv2-only,
so libvirt's use of sanlock introduces a license incompatibility.
The sanlock developers have now rearranged the code such that there
is a 'sanlock_client.so' which is LGPLv2+ while their daemon remains
GPLv2-only. To use the new client library we need to call the new
sanlock_init and sanlock_align APIs instead of sanlock_direct_init
and sanlock_direct_align. These APIs calls are now routed via the
sanlock daemon, instead of doing direct I/O calls to disk.
For all this we require sanlock >= 1.8
* configure.ac: Check for sanlock_client.so instead of sanlock.so
and fix various comments
* libvirt.spec.in: Mandate sanlock >= 1.8
* src/Makefile.am: Link to -lsanlock_client
* src/locking/lock_driver_sanlock.c: Use sanlock_init and
sanlock_align
---
configure.ac | 10 +++++-----
libvirt.spec.in | 4 ++--
src/Makefile.am | 2 +-
src/locking/lock_driver_sanlock.c | 9 ++++-----
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/configure.ac b/configure.ac
index ad9d754..4208cfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -966,7 +966,7 @@ AC_SUBST([YAJL_LIBS])
dnl SANLOCK
https://fedorahosted.org/sanlock/
AC_ARG_WITH([sanlock],
- AC_HELP_STRING([--with-sanlock], [use SANLOCK for lock management
@<:@default=check@:>@]),
+ AC_HELP_STRING([--with-sanlock], [build Sanlock plugin for lock management
@<:@default=check@:>@]),
[],
[with_sanlock=check])
@@ -989,8 +989,8 @@ if test "x$with_sanlock" != "xno"; then
fail=1
fi])
if test "x$with_sanlock" != "xno" ; then
- AC_CHECK_LIB([sanlock], [sanlock_restrict],[
- SANLOCK_LIBS="$SANLOCK_LIBS -lsanlock"
+ AC_CHECK_LIB([sanlock_client], [sanlock_init],[
+ SANLOCK_LIBS="$SANLOCK_LIBS -lsanlock_client"
with_sanlock=yes
],[
if test "x$with_sanlock" = "xcheck" ; then
@@ -1001,12 +1001,12 @@ if test "x$with_sanlock" != "xno"; then
])
fi
test $fail = 1 &&
- AC_MSG_ERROR([You must install the SANLOCK development package in order to compile
libvirt])
+ AC_MSG_ERROR([You must install the Sanlock development package in order to compile
libvirt])
CPPFLAGS="$old_cppflags"
LIBS="$old_libs"
if test "x$with_sanlock" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK], 1,
- [whether SANLOCK is available for JSON parsing/formatting])
+ [whether Sanlock plugin for lock management is available])
fi
fi
AM_CONDITIONAL([HAVE_SANLOCK], [test "x$with_sanlock" = "xyes"])
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 25e521c..f3f6722 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -354,7 +354,7 @@ BuildRequires: libpciaccess-devel >= 0.10.9
BuildRequires: yajl-devel
%endif
%if %{with_sanlock}
-BuildRequires: sanlock-devel
+BuildRequires: sanlock-devel >= 1.8
%endif
%if %{with_libpcap}
BuildRequires: libpcap-devel
@@ -518,7 +518,7 @@ the virtualization capabilities of recent versions of Linux (and other
OSes).
%package lock-sanlock
Summary: Sanlock lock manager plugin for QEMU driver
Group: Development/Libraries
-Requires: sanlock
+Requires: sanlock >= 1.8
#for virt-sanlock-cleanup require augeas
Requires: augeas
Requires: %{name} = %{version}-%{release}
diff --git a/src/Makefile.am b/src/Makefile.am
index 9a903ea..738ee91 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1279,7 +1279,7 @@ lockdriver_LTLIBRARIES = sanlock.la
sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES)
sanlock_la_CFLAGS = $(AM_CLFAGS)
sanlock_la_LDFLAGS = -module -avoid-version
-sanlock_la_LIBADD = -lsanlock \
+sanlock_la_LIBADD = -lsanlock_client \
../gnulib/lib/libgnu.la
augeas_DATA += locking/libvirt_sanlock.aug
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index b93fe01..2d72510 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -33,7 +33,6 @@
#include <sanlock.h>
#include <sanlock_resource.h>
-#include <sanlock_direct.h>
#include <sanlock_admin.h>
#include "lock_driver.h"
@@ -181,7 +180,7 @@ static int virLockManagerSanlockSetupLockspace(void)
}
VIR_DEBUG("Someone else just created lockspace %s", path);
} else {
- if ((rv = sanlock_direct_align(&ls.host_id_disk)) < 0) {
+ if ((rv = sanlock_align(&ls.host_id_disk)) < 0) {
if (rv <= -200)
virLockError(VIR_ERR_INTERNAL_ERROR,
_("Unable to query sector size %s: error
%d"),
@@ -210,7 +209,7 @@ static int virLockManagerSanlockSetupLockspace(void)
goto error_unlink;
}
- if ((rv = sanlock_direct_init(&ls, NULL, 0, 0, 0)) < 0) {
+ if ((rv = sanlock_init(&ls, NULL, 0, 0)) < 0) {
if (rv <= -200)
virLockError(VIR_ERR_INTERNAL_ERROR,
_("Unable to initialize lockspace %s: error
%d"),
@@ -555,7 +554,7 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource
*res)
}
VIR_DEBUG("Someone else just created lockspace %s",
res->disks[0].path);
} else {
- if ((rv = sanlock_direct_align(&res->disks[0])) < 0) {
+ if ((rv = sanlock_align(&res->disks[0])) < 0) {
if (rv <= -200)
virLockError(VIR_ERR_INTERNAL_ERROR,
_("Unable to query sector size %s: error
%d"),
@@ -584,7 +583,7 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource
*res)
goto error_unlink;
}
- if ((rv = sanlock_direct_init(NULL, res, 0, 0, 0)) < 0) {
+ if ((rv = sanlock_init(NULL, res, 0, 0)) < 0) {
if (rv <= -200)
virLockError(VIR_ERR_INTERNAL_ERROR,
_("Unable to initialize lease %s: error %d"),
--
1.7.6