]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Update to require sanlock 1.8 for license compliance
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 19 Sep 2011 10:04:59 +0000 (11:04 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 20 Sep 2011 03:18:54 +0000 (11:18 +0800)
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

configure.ac
libvirt.spec.in
src/Makefile.am
src/locking/lock_driver_sanlock.c

index ad9d7541c69e1997b9f69d8353e993ae023c05a1..4208cfaba011e9b648e445c683eac4ef827787ac 100644 (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"])
index 25e521c6b0b159ac43c4ecb6988c23df0e0497fe..f3f6722bcee80b8d9dfef0114bfc277c166120fc 100644 (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}
index 9a903ea6b503f3fb3ca77de50c88f45420685409..738ee912379429a1821f6d3628f4b278cc2cea0a 100644 (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
index b93fe010aa9962003fce2dbe51e812dcf6a78f5c..2d72510013896a09d7c7aea291ee138796e79263 100644 (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"),