Skip to contentSkip to conversation

clvmd: port to new corosync >= 2.0

PATCH New Fabio M. Di Nitto 1 participant 1 message Jan 31, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clvmd: port to new corosync >= 2.0

From: "Fabio M. Di Nitto" <[email protected]>

configure.in: update to check for libcmap/libconfdb

daemons/clvmd/Makefile.in: propagate CMAP_LDFLAGS/CMAP_CFLAGS

lib/misc/configure.h.in: autoupdated

daemons/clvmd/clvmd-corosync.c:
- update to use new libquorum init api
- use either confdb or cmap as necessary
NOTE that the new cluster_name is defined in corosync.conf

totem {
cluster_name: foobar
}

tested using corosync 1.99.1 (2.0 beta release) and dlm from
http://people.redhat.com/teigland/dlm-3.99.0-1.fc15.src.rpm

---
 configure.in                   |   39 +++++++++++++++++++++++++----
 daemons/clvmd/Makefile.in      |    6 +++-
 daemons/clvmd/clvmd-corosync.c |   53 ++++++++++++++++++++++++++++++++++++++++
 lib/misc/configure.h.in        |    3 ++
 4 files changed, 93 insertions(+), 8 deletions(-)
configure.in +33 -6
index 96b5f51..e7c4c7e 100644
@@ -549,6 +549,7 @@ if test x$BUILDCOROSYNC = xyes || \
    test x$BUILDOPENAIS = xyes; then
 	PKG_CHECK_MODULES(COROSYNC, corosync, [HAVE_COROSYNC=yes], $bailout)
 	CHECKCONFDB=yes
+	CHECKCMAP=yes
 fi
 
 dnl -- Look for corosync libraries if required.
@@ -567,7 +568,7 @@ fi
 dnl -- Below are checks for libraries common to more than one build.
 
 dnl -- Check confdb library.
-dnl -- mandatory for corosync build.
+dnl -- mandatory for corosync < 2.0 build.
 dnl -- optional for openais/cman build.
 
 if test x$CHECKCONFDB = xyes; then
@@ -586,11 +587,34 @@ if test x$CHECKCONFDB = xyes; then
 		CONFDB_LIBS="-lconfdb"
 		HAVE_CONFDB=yes
 	fi
+fi
+
+dnl -- Check cmap library
+dnl -- mandatory for corosync >= 2.0 build.
+
+if test x$CHECKCMAP = xyes; then
+	PKG_CHECK_MODULES(CMAP, libcmap,
+			  [HAVE_CMAP=yes],
+			  [HAVE_CMAP=no])
 
-	if test x$BUILDCOROSYNC = xyes && \
-	   test x$HAVE_CONFDB != xyes &&
+	AC_CHECK_HEADERS(corosync/cmap.h,
+		[HAVE_CMAP_H=yes],
+		[HAVE_CMAP_H=no])
+
+	if test x$HAVE_CMAP != xyes && \ 
+	   test x$HAVE_CMAP_H = xyes; then
+		check_lib_no_libs cmap cmap_initialize
+		AC_MSG_RESULT([no pkg for cmap, using -lcmap])
+		CMAP_LIBS="-lcmap"
+		HAVE_CMAP=yes
+	fi
+fi
+
+if test x$BUILDCOROSYNC = xyes; then
+	if test x$HAVE_CMAP != xyes && \
+	   test x$HAVE_CONFDB != xyes && \
 	   test x$CLVMD != xall; then
-		AC_MSG_ERROR([bailing out... confdb library is required])
+		AC_MSG_ERROR([bailing out... cmap (corsync >= 2.0) or confdb (corosync < 2.0) library is required])
 	fi
 fi
 
@@ -629,11 +653,12 @@ if test x$CLVMD = xall; then
 	if test x$HAVE_COROSYNC = xyes && \
 	   test x$HAVE_QUORUM = xyes && \
 	   test x$HAVE_CPG = xyes && \
-	   test x$HAVE_DLM = xyes && \
-	   test x$HAVE_CONFDB = xyes; then
+	   test x$HAVE_DLM = xyes; then
+	   if test x$HAVE_CONFDB = xyes || test x$HAVE_CMAP = xyes; then
 		AC_MSG_RESULT([Enabling clvmd corosync cluster manager])
 		CLVMD="$CLVMD,corosync"
 		CLVMD_CMANAGERS="$CLVMD_CMANAGERS corosync"
+	   fi
 	fi
 	if test x$HAVE_COROSYNC = xyes && \
 	   test x$HAVE_CPG = xyes && \
@@ -1311,6 +1336,8 @@ AC_SUBST(CLVMD_CMANAGERS)
 AC_SUBST(CLVMD_PATH)
 AC_SUBST(CMAN_CFLAGS)
 AC_SUBST(CMAN_LIBS)
+AC_SUBST(CMAP_CFLAGS)
+AC_SUBST(CMAP_LIBS)
 AC_SUBST(CMDLIB)
 AC_SUBST(CONFDB_CFLAGS)
 AC_SUBST(CONFDB_LIBS)
daemons/clvmd/Makefile.in +4 -2
index dcdabab..9ca11ba 100644
@@ -17,6 +17,8 @@ top_builddir = @top_builddir@
 
 CMAN_LIBS = @CMAN_LIBS@
 CMAN_CFLAGS = @CMAN_CFLAGS@
+CMAP_LIBS = @CMAP_LIBS@
+CMAP_CFLAGS = @CMAP_CFLAGS@
 CONFDB_LIBS = @CONFDB_LIBS@
 CONFDB_CFLAGS = @CONFDB_CFLAGS@
 CPG_LIBS = @CPG_LIBS@
@@ -54,8 +56,8 @@ endif
 
 ifneq (,$(findstring corosync,, "@CLVMD@,"))
 	SOURCES += clvmd-corosync.c
-	LMLIBS += $(CONFDB_LIBS) $(CPG_LIBS) $(DLM_LIBS) $(QUORUM_LIBS)
-	CFLAGS += $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(DLM_CFLAGS) $(QUORUM_CFLAGS)
+	LMLIBS += $(CMAP_LIBS) $(CONFDB_LIBS) $(CPG_LIBS) $(DLM_LIBS) $(QUORUM_LIBS)
+	CFLAGS += $(CMAP_CFLAGS) $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(DLM_CFLAGS) $(QUORUM_CFLAGS)
 	DEFS += -DUSE_COROSYNC
 endif
 
daemons/clvmd/clvmd-corosync.c +53 -0

86 lines not on this page · raw message

lib/misc/configure.h.in +3 -0
index 707445a..1c86c15 100644
@@ -87,6 +87,9 @@
 /* Define to 1 if your system has a working `chown' function. */
 #undef HAVE_CHOWN
 
+/* Define to 1 if you have the <corosync/cmap.h> header file. */
+#undef HAVE_COROSYNC_CMAP_H
+
 /* Define to 1 if you have the <corosync/confdb.h> header file. */
 #undef HAVE_COROSYNC_CONFDB_H
 
Signature · 1 line
1.7.7.6