]> xenbits.xensource.com Git - libvirt.git/commitdiff
locking: Fix build with sanlock < 2.4
authorJiri Denemark <jdenemar@redhat.com>
Tue, 16 Oct 2012 10:41:20 +0000 (12:41 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 16 Oct 2012 19:32:05 +0000 (21:32 +0200)
libvirt started using sanlock_killpath to implement on_lockfailure
action. Since sanlock_killpath was introduced in sanlock 2.4, libvirt
fails to build with older sanlock.

configure.ac
src/locking/lock_driver_sanlock.c

index 08dc63db9799d447d1e0b683ee7c070d2945efd4..8810efd0419f7df4dc089316e6c8dd86b76cef73 100644 (file)
@@ -1216,6 +1216,13 @@ if test "x$with_sanlock" != "xno"; then
   if test "x$with_sanlock" = "xyes" ; then
     AC_DEFINE_UNQUOTED([HAVE_SANLOCK], 1,
       [whether Sanlock plugin for lock management is available])
+
+    AC_CHECK_LIB([sanlock_client], [sanlock_killpath],
+                 [sanlock_killpath=yes], [sanlock_killpath=no])
+    if test "x$sanlock_killpath" = "xyes" ; then
+      AC_DEFINE_UNQUOTED([HAVE_SANLOCK_KILLPATH], 1,
+        [whether Sanlock supports sanlock_killpath])
+    fi
   fi
 fi
 AM_CONDITIONAL([HAVE_SANLOCK], [test "x$with_sanlock" = "xyes"])
index a218432fd21eea3a18ac1e69a45af92c8151e0bf..46827011ba4afd655d2f583387f9a75725f27f35 100644 (file)
@@ -687,6 +687,7 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
     return 0;
 }
 
+#if HAVE_SANLOCK_KILLPATH
 static int
 virLockManagerSanlockRegisterKillscript(int sock,
                                         const char *vmuri,
@@ -762,6 +763,18 @@ cleanup:
     VIR_FREE(args);
     return ret;
 }
+#else
+static int
+virLockManagerSanlockRegisterKillscript(int sock ATTRIBUTE_UNUSED,
+                                        const char *vmuri ATTRIBUTE_UNUSED,
+                                        const char *uuidstr ATTRIBUTE_UNUSED,
+                                        virDomainLockFailureAction action ATTRIBUTE_UNUSED)
+{
+    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                   _("sanlock is too old to support lock failure action"));
+    return -1;
+}
+#endif
 
 static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
                                         const char *state,