@@ -81,6 +81,7 @@ HAVE_COROSYNC = @HAVE_COROSYNC@
BUILD_OCFS2_CONTROLD = @BUILD_OCFS2_CONTROLD@
BUILD_PCMK_SUPPORT = @BUILD_PCMK_SUPPORT@
BUILD_CMAN_SUPPORT = @BUILD_CMAN_SUPPORT@
+BUILD_CMAP_SUPPORT = @BUILD_CMAP_SUPPORT@
BUILD_FSDLM_SUPPORT = @BUILD_FSDLM_SUPPORT@
CPG_LDFLAGS = @CPG_LDFLAGS@
AIS_LDFLAGS = @AIS_LDFLAGS@
@@ -382,6 +382,25 @@ if test "x$cpg_found" = "xyes" -a "x$ckpt_found" = "xyes" -a "x$libdlmcontrol_fo
fi
AC_SUBST(BUILD_OCFS2_CONTROLD)
+LIBCMAP_FOUND=
+AC_CHECK_HEADER(corosync/cmap.h, LIBCMAP_FOUND=yes,
+ [AC_MSG_WARN([corosync/cmap.h not found, cmap support will not be built. Older api will be used])])
+AC_SUBST(LIBCMAP_FOUND)
+
+fsdlm_found=
+if test "x$LIBCMAP_FOUND" = "xyes"; then
+ AC_CHECK_LIB(cmap, cmap_initialize, cmap_found=yes)
+ if test "x$cmap_found" = "xyes"; then
+ AC_MSG_WARN([libcmap not found, cmap support will not be built. Older api will be used])
+ fi
+fi
+
+BUILD_CMAP_SUPPORT=
+if test "x$cmap_found" = "xyes"; then
+ BUILD_CMAP_SUPPORT=yes
+fi
+AC_SUBST(BUILD_CMAP_SUPPORT)
+
BUILD_PCMK_SUPPORT=
if test "x$pcmk_found" = "xyes" -a "x$BUILD_OCFS2_CONTROLD" = "xyes"; then
BUILD_PCMK_SUPPORT=yes
@@ -33,6 +33,9 @@ OBJS = $(subst .c,.o,$(CFILES))
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
MANS = debugfs.ocfs2.8
@@ -13,6 +13,9 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal
LIBTOOLS_INTERNAL_DEPS = $(TOPDIR)/libtools-internal/libtools-internal.a
@@ -11,6 +11,11 @@ LIBRARIES = libo2cb.a
CFLAGS += -fPIC
+ifneq ($(BUILD_CMAP_SUPPORT),)
+DEFINES += -DHAVE_CMAP
+endif
+
+
ifneq ($(OCFS2_DEBUG_EXE),)
DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
DEBUG_EXE_PROGRAMS = $(addprefix debug_,$(subst .c,,$(DEBUG_EXE_FILES)))
@@ -37,6 +37,9 @@
#include <ctype.h>
#include <linux/types.h>
+#ifdef HAVE_CMAP
+#include <corosync/cmap.h>
+#endif
#include "o2cb/o2cb.h"
#include "o2cb/o2cb_client_proto.h"
@@ -1962,6 +1965,30 @@ static errcode_t classic_list_clusters(char ***clusters)
return o2cb_list_dir(path, clusters);
}
+#ifdef HAVE_CMAP
+static errcode_t user_list_clusters(char ***clusters)
+{
+ cmap_handle_t handle;
+ char **list;
+ int rv;
+
+ rv = cmap_initialize(&handle);
+ if (rv != CS_OK)
+ return O2CB_ET_SERVICE_UNAVAILABLE;
+
+ /* We supply only one cluster_name */
+ list = (char **)malloc(sizeof(char *) * 2);
+ rv = cmap_get_string(handle, "totem.cluster_name", &list[0]);
+ if (rv != CS_OK) {
+ free(list);
+ return O2CB_ET_INTERNAL_FAILURE;
+ }
+
+ list[1] = NULL;
+ *clusters = list;
+ return 0;
+}
+#else
static errcode_t user_list_clusters(char ***clusters)
{
errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE;
@@ -2011,6 +2038,7 @@ out:
return err;
}
+#endif
errcode_t o2cb_list_clusters(char ***clusters)
{
@@ -10,6 +10,9 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
@@ -11,6 +11,9 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
DEFINES = -DVERSION=\"$(VERSION)\"
@@ -9,6 +9,9 @@ LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
LIBTOOLS_INTERNAL_LIBS = -L$(TOPDIR)/libtools-internal -ltools-internal
@@ -14,6 +14,9 @@ LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
@@ -11,6 +11,9 @@ LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
ifndef OCFS2_DYNAMIC_CTL
@@ -12,6 +12,9 @@ LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm $(DL_LIBS)
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
+ifneq ($(BUILD_CMAP_SUPPORT),)
+LIBO2CB_LIBS += -lcmap
+endif
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
UNINST_LIBRARIES = libocfs2ne.a