Update to require sanlock 1.8 for license compliance

Inexplicably 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
This commit is contained in:
Daniel P. Berrange 2011-09-19 11:04:59 +01:00 committed by Daniel Veillard
parent b4c3be5943
commit 19ff0ddfbb
4 changed files with 12 additions and 13 deletions

View File

@ -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"])

View File

@ -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}

View File

@ -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

View File

@ -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"),