summaryrefslogtreecommitdiffstats
path: root/daemons/clvmd
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2009-08-28 19:22:05 +0000
committerAlasdair Kergon <agk@redhat.com>2009-08-28 19:22:05 +0000
commita946372e504d2cc3089de66579319c2d0b61a9bd (patch)
tree6791f2ed473086eac3c3cf7dfa2cc6715d8e6508 /daemons/clvmd
parent226e79e7b78bf78db3a47a4491b3f0218700c265 (diff)
downloadlvm2-a946372e504d2cc3089de66579319c2d0b61a9bd.tar.gz
lvm2-a946372e504d2cc3089de66579319c2d0b61a9bd.tar.xz
lvm2-a946372e504d2cc3089de66579319c2d0b61a9bd.zip
Rewrite clvmd configuration code.
Diffstat (limited to 'daemons/clvmd')
-rw-r--r--daemons/clvmd/Makefile.in58
-rw-r--r--daemons/clvmd/clvmd-comms.h4
-rw-r--r--daemons/clvmd/clvmd-corosync.c16
-rw-r--r--daemons/clvmd/clvmd-openais.c49
4 files changed, 60 insertions, 67 deletions
diff --git a/daemons/clvmd/Makefile.in b/daemons/clvmd/Makefile.in
index 6054ded8..c23b51eb 100644
--- a/daemons/clvmd/Makefile.in
+++ b/daemons/clvmd/Makefile.in
@@ -15,12 +15,22 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-QUORUM_LIBS = @QUORUM_LIBS@
-QUORUM_CFLAGS = @QUORUM_CFLAGS@
+CCS_LIBS = @CCS_LIBS@
+CCS_CFLAGS = @CCS_CFLAGS@
+CMAN_LIBS = @CMAN_LIBS@
+CMAN_CFLAGS = @CMAN_CFLAGS@
CONFDB_LIBS = @CONFDB_LIBS@
CONFDB_CFLAGS = @CONFDB_CFLAGS@
CPG_LIBS = @CPG_LIBS@
CPG_CFLAGS = @CPG_CFLAGS@
+DLM_LIBS = @DLM_LIBS@
+DLM_CFLAGS = @DLM_CFLAGS@
+GULM_LIBS = @GULM_LIBS@
+GULM_CFLAGS = @GULM_CFLAGS@
+QUORUM_LIBS = @QUORUM_LIBS@
+QUORUM_CFLAGS = @QUORUM_CFLAGS@
+SALCK_LIBS = @SALCK_LIBS@
+SALCK_CFLAGS = @SALCK_CFLAGS@
SOURCES = \
clvmd-command.c \
@@ -28,55 +38,35 @@ SOURCES = \
lvm-functions.c \
refresh_clvmd.c
-ifneq (,$(findstring gulm,, "@CLVMD@,"))
- GULM = yes
-endif
-
-ifneq (,$(findstring cman,, "@CLVMD@,"))
- CMAN = yes
-endif
-
-ifneq (,$(findstring openais,, "@CLVMD@,"))
- OPENAIS = yes
-endif
-
-ifneq (,$(findstring corosync,, "@CLVMD@,"))
- COROSYNC = yes
-endif
-
-ifneq (,$(findstring all,, "@CLVMD@,"))
- GULM = yes
- CMAN = yes
- OPENAIS = yes
- COROSYNC = yes
-endif
-
ifeq ("@DEBUG@", "yes")
DEFS += -DDEBUG
endif
-ifeq ("$(GULM)", "yes")
+ifneq (,$(findstring gulm,, "@CLVMD@,"))
SOURCES += clvmd-gulm.c tcp-comms.c
- LMLIBS += -lccs -lgulm
+ LMLIBS += $(CCS_LIBS) $(GULM_LIBS)
+ CFLAGS += $(CCS_CFLAGS) $(GULM_CFLAGS)
DEFS += -DUSE_GULM
endif
-ifeq ("$(CMAN)", "yes")
+ifneq (,$(findstring cman,, "@CLVMD@,"))
SOURCES += clvmd-cman.c
- LMLIBS += -ldlm -lcman
+ LMLIBS += $(CMAN_LIBS) $(CONFDB_LIBS) $(DLM_LIBS)
+ CFLAGS += $(CMAN_CFLAGS) $(CONFDB_CFLAGS) $(DLM_CFLAGS)
DEFS += -DUSE_CMAN
endif
-ifeq ("$(OPENAIS)", "yes")
+ifneq (,$(findstring openais,, "@CLVMD@,"))
SOURCES += clvmd-openais.c
- LMLIBS += -lSaLck -lcpg
+ LMLIBS += $(CONFDB_LIBS) $(CPG_LIBS) $(SALCK_LIBS)
+ CFLAGS += $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(SALCK_CFLAGS)
DEFS += -DUSE_OPENAIS
endif
-ifeq ("$(COROSYNC)", "yes")
+ifneq (,$(findstring corosync,, "@CLVMD@,"))
SOURCES += clvmd-corosync.c
- LMLIBS += $(QUORUM_LIBS) $(CONFDB_LIBS) $(CPG_LIBS) -ldlm
- CFLAGS += $(QUORUM_CFLAGS) $(CONFDB_CFLAGS) $(CPG_CFLAGS)
+ LMLIBS += $(CONFDB_LIBS) $(CPG_LIBS) $(DLM_LIBS) $(QUORUM_LIBS)
+ CFLAGS += $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(DLM_CFLAGS) $(QUORUM_CFLAGS)
DEFS += -DUSE_COROSYNC
endif
diff --git a/daemons/clvmd/clvmd-comms.h b/daemons/clvmd/clvmd-comms.h
index 3de278d4..cc5def56 100644
--- a/daemons/clvmd/clvmd-comms.h
+++ b/daemons/clvmd/clvmd-comms.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -77,7 +77,7 @@ struct cluster_ops *init_cman_cluster(void);
#ifdef USE_OPENAIS
# include <openais/saAis.h>
-# include <openais/totem/totem.h>
+# include <corosync/totem/totem.h>
# define OPENAIS_CSID_LEN (sizeof(int))
# define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
# define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
diff --git a/daemons/clvmd/clvmd-corosync.c b/daemons/clvmd/clvmd-corosync.c
index be8ff787..239942ca 100644
--- a/daemons/clvmd/clvmd-corosync.c
+++ b/daemons/clvmd/clvmd-corosync.c
@@ -55,13 +55,13 @@
/* Timeout value for several corosync calls */
#define LOCKSPACE_NAME "clvmd"
-static void cpg_deliver_callback (cpg_handle_t handle,
+static void corosync_cpg_deliver_callback (cpg_handle_t handle,
const struct cpg_name *groupName,
uint32_t nodeid,
uint32_t pid,
void *msg,
size_t msg_len);
-static void cpg_confchg_callback(cpg_handle_t handle,
+static void corosync_cpg_confchg_callback(cpg_handle_t handle,
const struct cpg_name *groupName,
const struct cpg_address *member_list, size_t member_list_entries,
const struct cpg_address *left_list, size_t left_list_entries,
@@ -87,9 +87,9 @@ static dlm_lshandle_t *lockspace;
static struct cpg_name cpg_group_name;
/* Corosync callback structs */
-cpg_callbacks_t cpg_callbacks = {
- .cpg_deliver_fn = cpg_deliver_callback,
- .cpg_confchg_fn = cpg_confchg_callback,
+cpg_callbacks_t corosync_cpg_callbacks = {
+ .cpg_deliver_fn = corosync_cpg_deliver_callback,
+ .cpg_confchg_fn = corosync_cpg_confchg_callback,
};
quorum_callbacks_t quorum_callbacks = {
@@ -205,7 +205,7 @@ static char *print_corosync_csid(const char *csid)
return buf;
}
-static void cpg_deliver_callback (cpg_handle_t handle,
+static void corosync_cpg_deliver_callback (cpg_handle_t handle,
const struct cpg_name *groupName,
uint32_t nodeid,
uint32_t pid,
@@ -225,7 +225,7 @@ static void cpg_deliver_callback (cpg_handle_t handle,
msg_len-COROSYNC_CSID_LEN, (char*)&nodeid);
}
-static void cpg_confchg_callback(cpg_handle_t handle,
+static void corosync_cpg_confchg_callback(cpg_handle_t handle,
const struct cpg_name *groupName,
const struct cpg_address *member_list, size_t member_list_entries,
const struct cpg_address *left_list, size_t left_list_entries,
@@ -294,7 +294,7 @@ static int _init_cluster(void)
node_hash = dm_hash_create(100);
err = cpg_initialize(&cpg_handle,
- &cpg_callbacks);
+ &corosync_cpg_callbacks);
if (err != CS_OK) {
syslog(LOG_ERR, "Cannot initialise Corosync CPG service: %d",
err);
diff --git a/daemons/clvmd/clvmd-openais.c b/daemons/clvmd/clvmd-openais.c
index 31010693..7c058a81 100644
--- a/daemons/clvmd/clvmd-openais.c
+++ b/daemons/clvmd/clvmd-openais.c
@@ -1,7 +1,7 @@
/******************************************************************************
*******************************************************************************
**
-** Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
**
*******************************************************************************
******************************************************************************/
@@ -41,7 +41,9 @@
#include <openais/saAis.h>
#include <openais/saLck.h>
-#include <openais/cpg.h>
+
+#include <corosync/corotypes.h>
+#include <corosync/cpg.h>
#include "locking.h"
#include "lvm-logging.h"
@@ -53,17 +55,18 @@
/* Timeout value for several openais calls */
#define TIMEOUT 10
-static void cpg_deliver_callback (cpg_handle_t handle,
- struct cpg_name *groupName,
+static void openais_cpg_deliver_callback (cpg_handle_t handle,
+ const struct cpg_name *groupName,
uint32_t nodeid,
uint32_t pid,
void *msg,
- int msg_len);
-static void cpg_confchg_callback(cpg_handle_t handle,
- struct cpg_name *groupName,
- struct cpg_address *member_list, int member_list_entries,
- struct cpg_address *left_list, int left_list_entries,
- struct cpg_address *joined_list, int joined_list_entries);
+ size_t msg_len);
+static void openais_cpg_confchg_callback(cpg_handle_t handle,
+ const struct cpg_name *groupName,
+ const struct cpg_address *member_list, size_t member_list_entries,
+ const struct cpg_address *left_list, size_t left_list_entries,
+ const struct cpg_address *joined_list, size_t joined_list_entries);
+
static void _cluster_closedown(void);
/* Hash list of nodes in the cluster */
@@ -85,9 +88,9 @@ static SaLckHandleT lck_handle;
static struct cpg_name cpg_group_name;
/* Openais callback structs */
-cpg_callbacks_t cpg_callbacks = {
- .cpg_deliver_fn = cpg_deliver_callback,
- .cpg_confchg_fn = cpg_confchg_callback,
+cpg_callbacks_t openais_cpg_callbacks = {
+ .cpg_deliver_fn = openais_cpg_deliver_callback,
+ .cpg_confchg_fn = openais_cpg_confchg_callback,
};
struct node_info
@@ -230,12 +233,12 @@ static int add_internal_client(int fd, fd_callback_t callback)
return 0;
}
-static void cpg_deliver_callback (cpg_handle_t handle,
- struct cpg_name *groupName,
+static void openais_cpg_deliver_callback (cpg_handle_t handle,
+ const struct cpg_name *groupName,
uint32_t nodeid,
uint32_t pid,
void *msg,
- int msg_len)
+ size_t msg_len)
{
int target_nodeid;
@@ -250,11 +253,11 @@ static void cpg_deliver_callback (cpg_handle_t handle,
msg_len-OPENAIS_CSID_LEN, (char*)&nodeid);
}
-static void cpg_confchg_callback(cpg_handle_t handle,
- struct cpg_name *groupName,
- struct cpg_address *member_list, int member_list_entries,
- struct cpg_address *left_list, int left_list_entries,
- struct cpg_address *joined_list, int joined_list_entries)
+static void openais_cpg_confchg_callback(cpg_handle_t handle,
+ const struct cpg_name *groupName,
+ const struct cpg_address *member_list, size_t member_list_entries,
+ const struct cpg_address *left_list, size_t left_list_entries,
+ const struct cpg_address *joined_list, size_t joined_list_entries)
{
int i;
struct node_info *ninfo;
@@ -330,7 +333,7 @@ static int _init_cluster(void)
lock_hash = dm_hash_create(10);
err = cpg_initialize(&cpg_handle,
- &cpg_callbacks);
+ &openais_cpg_callbacks);
if (err != SA_AIS_OK) {
syslog(LOG_ERR, "Cannot initialise OpenAIS CPG service: %d",
err);
@@ -342,7 +345,7 @@ static int _init_cluster(void)
NULL,
&ver);
if (err != SA_AIS_OK) {
- cpg_initialize(&cpg_handle, &cpg_callbacks);
+ cpg_initialize(&cpg_handle, &openais_cpg_callbacks);
syslog(LOG_ERR, "Cannot initialise OpenAIS lock service: %d",
err);
DEBUGLOG("Cannot initialise OpenAIS lock service: %d\n\n", err);