public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - cman (mainly): use corosync
@ 2008-08-12 11:34 Christine Caulfield
0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2008-08-12 11:34 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=72ffa95c03dd531d2ed6e7cbc1ed89dddf0bf8ec
Commit: 72ffa95c03dd531d2ed6e7cbc1ed89dddf0bf8ec
Parent: e46fc61639a46aacf68277182d8d7ef6a9f6790d
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Tue Aug 12 11:28:26 2008 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Tue Aug 12 11:28:26 2008 +0100
cman (mainly): use corosync
This patch changes cman to use corosync, the new split-up version
of openais. It's mainly name changes, and changes to accommodate
the new corosync API.
It also changes the includes of other services from openais/ to corosync/
though I can't guarantee I've caught all of them.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
ccs/ccsais/config.c | 17 +--
ccs/daemon/ccsd.c | 2 +-
ccs/daemon/cluster_mgr.c | 2 +-
ccs/daemon/cnx_mgr.c | 2 +-
ccs/daemon/misc.c | 2 +-
cman/cman_tool/Makefile | 2 +-
cman/cman_tool/join.c | 42 ++++----
cman/daemon/ais.c | 103 +++++++++---------
cman/daemon/ais.h | 2 -
cman/daemon/barrier.c | 14 ++--
cman/daemon/cman-preconfig.c | 217 ++++++++++++++++++-------------------
cman/daemon/cmanconfig.c | 103 +++++++++---------
cman/daemon/cmanconfig.h | 36 +------
cman/daemon/cnxman-private.h | 2 -
cman/daemon/commands.c | 138 +++++++++++++++---------
cman/daemon/commands.h | 5 +-
cman/daemon/daemon.c | 7 +-
cman/daemon/logging.c | 2 +-
cman/daemon/logging.h | 2 +-
cman/daemon/nodelist.h | 79 ++++++++++----
cman/man/cman_tool.8 | 5 +
cman/qdisk/daemon_init.c | 2 +-
cman/qdisk/disk.c | 2 +-
cman/qdisk/disk_util.c | 2 +-
cman/qdisk/main.c | 2 +-
cman/qdisk/mkqdisk.c | 2 +-
cman/qdisk/proc.c | 2 +-
cman/qdisk/score.c | 2 +-
config/libs/libccsconfdb/libccs.c | 28 +----
config/plugins/ldap/configldap.c | 26 ++---
config/plugins/xml/config.c | 10 +-
config/tools/ldap/confdb2ldif.c | 3 +-
configure | 4 +-
fence/agents/xvm/debug.h | 2 +-
fence/fence_node/fence_node.c | 2 +-
fence/fenced/fd.h | 4 +-
group/daemon/cman.c | 2 +-
group/daemon/cpg.c | 2 +-
group/daemon/gd_internal.h | 4 +-
group/dlm_controld/dlm_daemon.h | 8 +-
group/gfs_controld/gfs_daemon.h | 6 +-
41 files changed, 446 insertions(+), 453 deletions(-)
diff --git a/ccs/ccsais/config.c b/ccs/ccsais/config.c
index e5ec83a..b56a24f 100644
--- a/ccs/ccsais/config.c
+++ b/ccs/ccsais/config.c
@@ -2,21 +2,16 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <syslog.h>
#include <netinet/in.h>
-/* openais headers */
-#include <openais/service/objdb.h>
#include "list.h"
#include "cnxman-socket.h"
#include "cnxman-private.h"
-#include <openais/service/swab.h>
-#include <openais/totem/totemip.h>
-#include <openais/totem/totempg.h>
-#include <openais/totem/aispoll.h>
-#include <openais/service/service.h>
-#include <openais/service/config.h>
-#include <openais/lcr/lcr_comp.h>
-#include <openais/service/swab.h>
+
+#include <corosync/lcr/lcr_comp.h>
+#include <corosync/engine/objdb.h>
+#include <corosync/engine/config.h>
#include "libccscompat.h"
#include "logging.h"
@@ -186,7 +181,7 @@ static int ccs_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
int ret;
/* We need to set this up to internal defaults too early */
- openlog("openais", LOG_CONS|LOG_PID, SYSLOGFACILITY);
+ openlog("corosync", LOG_CONS|LOG_PID, SYSLOGFACILITY);
/* Read low-level totem/aisexec etc config from CCS */
if ( !(ret = init_config(objdb, error_reason)) )
diff --git a/ccs/daemon/ccsd.c b/ccs/daemon/ccsd.c
index ee5e02d..d3b63d8 100644
--- a/ccs/daemon/ccsd.c
+++ b/ccs/daemon/ccsd.c
@@ -13,7 +13,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <libxml/parser.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "debug.h"
#include "cnx_mgr.h"
diff --git a/ccs/daemon/cluster_mgr.c b/ccs/daemon/cluster_mgr.c
index 46779b7..236933f 100644
--- a/ccs/daemon/cluster_mgr.c
+++ b/ccs/daemon/cluster_mgr.c
@@ -11,7 +11,7 @@
#include <sys/ioctl.h>
#include <errno.h>
#include <libxml/parser.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "comm_headers.h"
#include "debug.h"
diff --git a/ccs/daemon/cnx_mgr.c b/ccs/daemon/cnx_mgr.c
index 21b7ff6..0dfa1cd 100644
--- a/ccs/daemon/cnx_mgr.c
+++ b/ccs/daemon/cnx_mgr.c
@@ -17,7 +17,7 @@
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "comm_headers.h"
#include "debug.h"
diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c
index 168944b..543dd31 100644
--- a/ccs/daemon/misc.c
+++ b/ccs/daemon/misc.c
@@ -16,7 +16,7 @@
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "comm_headers.h"
#include "debug.h"
diff --git a/cman/cman_tool/Makefile b/cman/cman_tool/Makefile
index df9ebb5..9bdc38c 100644
--- a/cman/cman_tool/Makefile
+++ b/cman/cman_tool/Makefile
@@ -13,7 +13,7 @@ include $(OBJDIR)/make/uninstall.mk
OBJS= main.o \
join.o
-CFLAGS += -DAISEXECBIN=\"${aisexecbin}\"
+CFLAGS += -DCOROSYNCBIN=\"${aisexecbin}\"
CFLAGS += -I${cmanincdir}
CFLAGS += -I${incdir}
diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
index 1da36bd..98ed2f2 100644
--- a/cman/cman_tool/join.c
+++ b/cman/cman_tool/join.c
@@ -47,7 +47,7 @@ int join(commandline_t *comline, char *main_envp[])
char scratch[1024];
cman_handle_t h;
int status;
- pid_t aisexec_pid;
+ pid_t corosync_pid;
int p[2];
/*
@@ -100,10 +100,10 @@ int join(commandline_t *comline, char *main_envp[])
}
if (comline->noconfig_opt) {
envp[envptr++] = strdup("CMAN_NOCONFIG=true");
- envp[envptr++] = strdup("OPENAIS_DEFAULT_CONFIG_IFACE=cmanpreconfig");
+ envp[envptr++] = strdup("COROSYNC_DEFAULT_CONFIG_IFACE=cmanpreconfig");
}
else {
- snprintf(scratch, sizeof(scratch), "OPENAIS_DEFAULT_CONFIG_IFACE=%s:cmanpreconfig", comline->config_lcrso);
+ snprintf(scratch, sizeof(scratch), "COROSYNC_DEFAULT_CONFIG_IFACE=%s:cmanpreconfig", comline->config_lcrso);
envp[envptr++] = strdup(scratch);
}
@@ -124,7 +124,7 @@ int join(commandline_t *comline, char *main_envp[])
envp[envptr++] = strdup(scratch);
envp[envptr++] = NULL;
- argv[0] = "aisexec";
+ argv[0] = "corosync";
if (comline->verbose & ~DEBUG_STARTUP_ONLY)
argv[++argvptr] = "-f";
if (comline->nosetpri_opt)
@@ -132,15 +132,15 @@ int join(commandline_t *comline, char *main_envp[])
argv[++argvptr] = NULL;
/* Fork/exec cman */
- switch ( (aisexec_pid = fork()) )
+ switch ( (corosync_pid = fork()) )
{
case -1:
- die("fork of aisexec daemon failed: %s", strerror(errno));
+ die("fork of corosync daemon failed: %s", strerror(errno));
case 0: /* child */
close(p[0]);
if (comline->verbose & DEBUG_STARTUP_ONLY) {
- fprintf(stderr, "Starting %s", AISEXECBIN);
+ fprintf(stderr, "Starting %s", COROSYNCBIN);
for (i=0; i< argvptr; i++) {
fprintf(stderr, " %s", argv[i]);
}
@@ -150,10 +150,10 @@ int join(commandline_t *comline, char *main_envp[])
}
}
be_daemon(!(comline->verbose & ~DEBUG_STARTUP_ONLY));
- execve(AISEXECBIN, argv, envp);
+ execve(COROSYNCBIN, argv, envp);
/* exec failed - tell the parent process */
- sprintf(scratch, "execve of " AISEXECBIN " failed: %s", strerror(errno));
+ sprintf(scratch, "execve of " COROSYNCBIN " failed: %s", strerror(errno));
err = write(p[1], scratch, strlen(scratch));
exit(1);
break;
@@ -184,10 +184,10 @@ int join(commandline_t *comline, char *main_envp[])
int len;
if ((len = read(p[0], message, sizeof(message)) > 0)) {
- /* Success! get the new PID of double-forked aisexec */
- if (sscanf(message, "SUCCESS: %d", &aisexec_pid) == 1) {
+ /* Success! get the new PID of double-forked corosync */
+ if (sscanf(message, "SUCCESS: %d", &corosync_pid) == 1) {
if (comline->verbose & DEBUG_STARTUP_ONLY)
- fprintf(stderr, "aisexec running, process ID is %d\n", aisexec_pid);
+ fprintf(stderr, "corosync running, process ID is %d\n", corosync_pid);
status = 0;
}
else {
@@ -200,16 +200,16 @@ int join(commandline_t *comline, char *main_envp[])
}
else { /* Error or EOF - check the child status */
int pidstatus;
- status = waitpid(aisexec_pid, &pidstatus, WNOHANG);
+ status = waitpid(corosync_pid, &pidstatus, WNOHANG);
if (status == -1 && errno == ECHILD) {
fprintf(stderr, "cman not started\n");
break;
}
if (status == 0 && pidstatus != 0) {
if (WIFEXITED(pidstatus))
- fprintf(stderr, "aisexec died with status: %d\n", WEXITSTATUS(pidstatus));
+ fprintf(stderr, "corosync died with status: %d\n", WEXITSTATUS(pidstatus));
if (WIFSIGNALED(pidstatus))
- fprintf(stderr, "aisexec died with signal: %d\n", WTERMSIG(pidstatus));
+ fprintf(stderr, "corosync died with signal: %d\n", WTERMSIG(pidstatus));
status = -1;
break;
}
@@ -222,18 +222,18 @@ int join(commandline_t *comline, char *main_envp[])
} while (status != 0);
close(p[0]);
- /* If aisexec has started, try to connect to cman ... if it's still there */
+ /* If corosync has started, try to connect to cman ... if it's still there */
if (status == 0) {
do {
if (status == 0) {
- if (kill(aisexec_pid, 0) < 0) {
- die("aisexec died during startup\n");
+ if (kill(corosync_pid, 0) < 0) {
+ die("corosync died during startup\n");
}
h = cman_admin_init(NULL);
if (!h && comline->verbose & DEBUG_STARTUP_ONLY)
{
- fprintf(stderr, "waiting for aisexec to start\n");
+ fprintf(stderr, "waiting for corosync to start\n");
}
}
sleep (1);
@@ -241,10 +241,10 @@ int join(commandline_t *comline, char *main_envp[])
}
if (!h)
- die("aisexec daemon didn't start");
+ die("corosync daemon didn't start");
if ((comline->verbose & DEBUG_STARTUP_ONLY) && !cman_is_active(h))
- fprintf(stderr, "aisexec started, but not joined the cluster yet.\n");
+ fprintf(stderr, "corosync started, but not joined the cluster yet.\n");
cman_finish(h);
return 0;
diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index 615afcb..f0eb2e5 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -14,17 +14,11 @@
#include <arpa/inet.h>
#include <netdb.h>
-/* openais headers */
-#include <openais/service/objdb.h>
-#include <openais/service/swab.h>
-#include <openais/totem/totemip.h>
-#include <openais/totem/totempg.h>
-#include <openais/totem/aispoll.h>
-#include <openais/service/service.h>
-#include <openais/service/config.h>
-#include <openais/lcr/lcr_comp.h>
-#include <openais/service/swab.h>
-#include <openais/service/logsys.h>
+/* corosync headers */
+#include <corosync/ipc_gen.h>
+#include <corosync/engine/coroapi.h>
+#include <corosync/engine/logsys.h>
+#include <corosync/lcr/lcr_comp.h>
#include "list.h"
#include "cnxman-socket.h"
@@ -34,6 +28,8 @@
#include "ais.h"
#include "cman.h"
+#define OBJDB_API struct corosync_api_v1
+#include "nodelist.h"
#include "cmanconfig.h"
#include "daemon.h"
@@ -43,7 +39,7 @@ extern char *key_filename;
extern unsigned int quorumdev_poll;
extern unsigned int ccsd_poll_interval;
extern unsigned int shutdown_timeout;
-extern int init_config(struct objdb_iface_ver0 *objdb);
+extern int init_config(struct corosync_api_v1 *api);
struct totem_ip_address mcast_addr[MAX_INTERFACES];
struct totem_ip_address ifaddrs[MAX_INTERFACES];
@@ -56,8 +52,10 @@ static unsigned int cluster_parent_handle;
static int startup_pipe;
static unsigned int debug_mask;
static int first_trans = 1;
-static totempg_groups_handle group_handle;
-static struct totempg_group cman_group[1] = {
+struct corosync_api_v1 *corosync;
+
+static corosync_tpg_handle group_handle;
+static struct corosync_tpg_group cman_group[1] = {
{ .group = "CMAN", .group_len = 4},
};
@@ -74,46 +72,44 @@ struct cl_protheader {
int tgtid; /* Node ID of the target */
};
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
- int endian_conversion_required);
-static void cman_confchg_fn(enum totem_configuration_type configuration_type,
- unsigned int *member_list, int member_list_entries,
- unsigned int *left_list, int left_list_entries,
- unsigned int *joined_list, int joined_list_entries,
- struct memb_ring_id *ring_id);
-
/* Plugin-specific code */
/* Need some better way of determining these.... */
#define CMAN_SERVICE 9
static int cman_exit_fn(void *conn_info);
-static int cman_exec_init_fn(struct objdb_iface_ver0 *objdb);
+static int cman_exec_init_fn(struct corosync_api_v1 *api);
+static void cman_confchg_fn(enum totem_configuration_type configuration_type,
+ unsigned int *member_list, int member_list_entries,
+ unsigned int *left_list, int left_list_entries,
+ unsigned int *joined_list, int joined_list_entries,
+ struct memb_ring_id *ring_id);
+static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
+ int endian_conversion_required);
/*
* Exports the interface for the service
*/
-static struct openais_service_handler cman_service_handler = {
- .name = (char *)"openais CMAN membership service 2.90",
+static struct corosync_service_engine cman_service_handler = {
+ .name = (char *)"corosync CMAN membership service 2.90",
.id = CMAN_SERVICE,
- .flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED,
+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED,
.lib_exit_fn = cman_exit_fn,
.exec_init_fn = cman_exec_init_fn,
.config_init_fn = NULL,
};
-static struct openais_service_handler *cman_get_handler_ver0(void)
+static struct corosync_service_engine *cman_get_handler_ver0(void)
{
return (&cman_service_handler);
}
-static struct openais_service_handler_iface_ver0 cman_service_handler_iface = {
- .openais_get_service_handler_ver0 = cman_get_handler_ver0
+static struct corosync_service_engine_iface_ver0 cman_service_handler_iface = {
+ .corosync_get_service_engine_ver0 = cman_get_handler_ver0
};
-
static struct lcr_iface ifaces_ver0[1] = {
{
- .name = "openais_cman",
+ .name = "corosync_cman",
.version = 0,
.versions_replace = 0,
.versions_replace_count = 0,
@@ -140,34 +136,38 @@ __attribute__ ((constructor)) static void cman_comp_register(void) {
/* ------------------------------- */
-static int cman_exec_init_fn(struct objdb_iface_ver0 *objdb)
+static int cman_exec_init_fn(struct corosync_api_v1 *api)
{
unsigned int object_handle;
+ unsigned int find_handle;
char pipe_msg[256];
+ corosync = api;
+
if (getenv("CMAN_PIPE"))
startup_pipe = atoi(getenv("CMAN_PIPE"));
/* Get our config variables */
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- objdb->object_find(OBJECT_PARENT_HANDLE,
- "cluster", strlen("cluster"), &cluster_parent_handle);
+ corosync->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
+ corosync->object_find_next(find_handle, &cluster_parent_handle);
+ corosync->object_find_destroy(find_handle);
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle, "cman", strlen("cman"), &object_handle) == 0)
+ corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (corosync->object_find_next(find_handle, &object_handle) == 0)
{
- objdb_get_int(objdb, object_handle, "quorum_dev_poll", &quorumdev_poll, DEFAULT_QUORUMDEV_POLL);
- objdb_get_int(objdb, object_handle, "shutdown_timeout", &shutdown_timeout, DEFAULT_SHUTDOWN_TIMEOUT);
- objdb_get_int(objdb, object_handle, "ccsd_poll", &ccsd_poll_interval, DEFAULT_CCSD_POLL);
- objdb_get_int(objdb, object_handle, "debug_mask", &debug_mask, 0);
+ objdb_get_int(api, object_handle, "quorum_dev_poll", &quorumdev_poll, DEFAULT_QUORUMDEV_POLL);
+ objdb_get_int(api, object_handle, "shutdown_timeout", &shutdown_timeout, DEFAULT_SHUTDOWN_TIMEOUT);
+ objdb_get_int(api, object_handle, "ccsd_poll", &ccsd_poll_interval, DEFAULT_CCSD_POLL);
+ objdb_get_int(api, object_handle, "debug_mask", &debug_mask, 0);
/* All other debugging options should already have been set in preconfig */
set_debuglog(debug_mask);
}
+ corosync->object_find_destroy(find_handle);
P_DAEMON(CMAN_NAME " starting");
/* Open local sockets and initialise I/O queues */
- if (read_cman_config(objdb, &config_version)) {
+ if (read_cman_config(api, &config_version)) {
/* An error message will have been written to cman_pipe */
exit(9);
}
@@ -180,8 +180,8 @@ static int cman_exec_init_fn(struct objdb_iface_ver0 *objdb)
startup_pipe = 0;
/* Start totem */
- totempg_groups_initialize(&group_handle, cman_deliver_fn, cman_confchg_fn);
- totempg_groups_join(group_handle, cman_group, 1);
+ api->tpg_init(&group_handle, cman_deliver_fn, cman_confchg_fn);
+ api->tpg_join(group_handle, cman_group, 1);
return 0;
}
@@ -202,7 +202,7 @@ int comms_send_message(void *buf, int len,
{
struct iovec iov[2];
struct cl_protheader header;
- int totem_flags = TOTEMPG_AGREED;
+ int totem_flags = TOTEM_AGREED;
P_AIS("comms send message %p len = %d\n", buf,len);
header.tgtport = toport;
@@ -217,20 +217,20 @@ int comms_send_message(void *buf, int len,
iov[1].iov_len = len;
if (flags & MSG_TOTEM_SAFE)
- totem_flags = TOTEMPG_SAFE;
+ totem_flags = TOTEM_SAFE;
- return totempg_groups_mcast_joined(group_handle, iov, 2, totem_flags);
+ return corosync->tpg_joined_mcast(group_handle, iov, 2, totem_flags);
}
-/* This assumes the iovec has only one element ... is it true ?? */
+// This assumes the iovec has only one element ... is it true ??
static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
int endian_conversion_required)
{
struct cl_protheader *header = iovec->iov_base;
char *buf = iovec->iov_base;
- P_AIS("deliver_fn called, iov_len = %d, iov[0].len = %lu, source nodeid = %d, conversion reqd=%d\n",
- iov_len, (unsigned long)iovec->iov_len, nodeid, endian_conversion_required);
+ P_AIS("deliver_fn source nodeid = %d, len=%d, endian_conv=%d\n",
+ nodeid, iovec->iov_len, endian_conversion_required);
if (endian_conversion_required) {
header->srcid = swab32(header->srcid);
@@ -243,8 +243,7 @@ static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_le
header->tgtid == 0) {
send_to_userport(header->srcport, header->tgtport,
header->srcid, header->tgtid,
- buf + sizeof(struct cl_protheader),
- iovec->iov_len - sizeof(struct cl_protheader),
+ buf + sizeof(struct cl_protheader), iovec->iov_len,
endian_conversion_required);
}
}
diff --git a/cman/daemon/ais.h b/cman/daemon/ais.h
index b4e4950..4b3e846 100644
--- a/cman/daemon/ais.h
+++ b/cman/daemon/ais.h
@@ -1,8 +1,6 @@
/* DLM Currently maxes out at 3 ! */
#define MAX_INTERFACES 8
-#include <openais/totem/totem.h>
-
extern int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum);
extern int comms_send_message(void *buf, int len,
unsigned char toport, unsigned char fromport,
diff --git a/cman/daemon/barrier.c b/cman/daemon/barrier.c
index 63c2c64..54df19a 100644
--- a/cman/daemon/barrier.c
+++ b/cman/daemon/barrier.c
@@ -16,10 +16,9 @@
#include <netinet/in.h>
#include <sys/errno.h>
-#include <openais/service/swab.h>
-#include <openais/totem/totemip.h>
-#include <openais/totem/aispoll.h>
-#include <openais/service/timer.h>
+#include <corosync/ipc_gen.h>
+#include <corosync/engine/coroapi.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "cnxman-socket.h"
#include "cnxman-private.h"
@@ -51,8 +50,9 @@ struct cl_barrier {
unsigned long timeout; /* In seconds */
struct connection *con;
- openais_timer_handle timer;
+ corosync_timer_handle_t timer;
};
+extern struct corosync_api_v1 *corosync;
/* A list of all current barriers */
static struct list barrier_list;
@@ -60,7 +60,7 @@ static struct list barrier_list;
static void send_barrier_complete_msg(struct cl_barrier *barrier)
{
if (barrier->timeout) {
- openais_timer_delete(barrier->timer);
+ corosync->timer_delete(barrier->timer);
barrier->timeout = 0;
}
@@ -274,7 +274,7 @@ static int barrier_setattr_enabled(struct cl_barrier *barrier,
/* Start the timer if one was wanted */
if (barrier->timeout) {
- openais_timer_add_duration((unsigned long long)barrier->timeout*1000000000ULL, barrier,
+ corosync->timer_add_duration((unsigned long long)barrier->timeout*1000000000ULL, barrier,
barrier_timer_fn, &barrier->timer);
}
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 0cc2f73..a5bfcbe 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -14,16 +14,14 @@
#include <ifaddrs.h>
#include <arpa/inet.h>
-/* openais headers */
-#include <openais/service/objdb.h>
-#include <openais/service/swab.h>
-#include <openais/service/service.h>
-#include <openais/service/config.h>
-#include <openais/lcr/lcr_comp.h>
-#include <openais/service/swab.h>
+/* corosync headers */
+#include <corosync/engine/logsys.h>
+#include <corosync/lcr/lcr_comp.h>
+#include <corosync/engine/objdb.h>
+#include <corosync/engine/config.h>
#include "cman.h"
-#include "cmanconfig.h"
+#define OBJDB_API struct objdb_iface_ver0
#include "cnxman-socket.h"
#include "nodelist.h"
#include "logging.h"
@@ -199,11 +197,11 @@ static int address_family(char *addr, struct sockaddr_storage *ssaddr)
static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned int object_handle)
{
unsigned int subsys_handle;
+ unsigned int find_handle;
char *str;
- objdb->object_find_reset(object_handle);
- while (!objdb->object_find(object_handle,
- "logger_subsys", strlen("logger_subsys"), &subsys_handle)) {
+ objdb->object_find_create(object_handle, "logger_subsys", strlen("logger_subsys"), &find_handle);
+ while (!objdb->object_find_next(object_handle, &subsys_handle)) {
if (objdb_get_string(objdb, subsys_handle, "subsys", &str)) {
continue;
@@ -211,13 +209,14 @@ static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned in
if (strcmp(str, CMAN_NAME) == 0)
return subsys_handle;
}
+ objdb->object_find_destroy(find_handle);
/* We can't find it ... create one */
if (objdb->object_create(object_handle, &subsys_handle,
- "logger_subsys", strlen("logger_subsys")) == 0) {
+ "logger_subsys", strlen("logger_subsys")) == 0) {
objdb->object_key_create(subsys_handle, "subsys", strlen("subsys"),
- CMAN_NAME, strlen(CMAN_NAME)+1);
+ CMAN_NAME, strlen(CMAN_NAME)+1);
}
return subsys_handle;
@@ -228,6 +227,7 @@ static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned in
static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int portnum)
{
unsigned int totem_object_handle;
+ unsigned int find_handle;
unsigned int interface_object_handle;
struct sockaddr_storage if_addr, localhost, mcast_addr;
char tmp[132];
@@ -247,13 +247,13 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
return -1;
}
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE,
- "totem", strlen("totem"), &totem_object_handle)) {
+ objdb->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &find_handle);
+ if (objdb->object_find_next(find_handle, &totem_object_handle)) {
objdb->object_create(OBJECT_PARENT_HANDLE, &totem_object_handle,
"totem", strlen("totem"));
}
+ objdb->object_destroy(find_handle);
if (objdb->object_create(totem_object_handle, &interface_object_handle,
"interface", strlen("interface")) == 0) {
@@ -332,7 +332,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
struct ifaddrs *ifa, *ifa_list;
struct sockaddr *sa;
unsigned int nodes_handle;
- unsigned int parent_handle;
+ unsigned int find_handle;
int error;
/* nodename is either from commandline or from uname */
@@ -353,7 +353,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
/* If nodename (from uname) is domain-less, try to match against
cluster.conf names which may have domainname specified */
- nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &parent_handle);
+ nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &find_handle);
do {
int len;
@@ -374,7 +374,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
strcpy(nodename, str);
return 0;
}
- nodes_handle = nodeslist_next(objdb, parent_handle);
+ nodes_handle = nodeslist_next(objdb, find_handle);
} while (nodes_handle);
@@ -494,6 +494,7 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
{
char *nodeid_str;
unsigned int object_handle;
+ unsigned int find_handle;
unsigned int node_object_handle;
unsigned int alt_object;
int error;
@@ -551,23 +552,21 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
}
}
- objdb->object_find_reset(cluster_parent_handle);
+ objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"),
- &object_handle) == 0) {
+ if (objdb->object_find_next(find_handle, &object_handle) == 0) {
unsigned int mcast_handle;
+ unsigned int find_handle2;
if (!mcast_name) {
- objdb->object_find_reset(object_handle);
- if (objdb->object_find(object_handle,
- "multicast", strlen("multicast"),
- &mcast_handle) == 0) {
+ objdb->object_find_create(object_handle, "multicast", strlen("multicast"), &find_handle2);
+ if (objdb->object_find_next(find_handle2, &mcast_handle) == 0) {
objdb_get_string(objdb, mcast_handle, "addr", &mcast_name);
}
+ objdb->object_find_destroy(find_handle2);
}
if (!mcast_name) {
@@ -575,8 +574,9 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
}
objdb->object_key_create(object_handle, "nodename", strlen("nodename"),
- nodename, strlen(nodename)+1);
+ nodename, strlen(nodename)+1);
}
+ objdb->object_find_destroy(find_handle);
nodeid = atoi(nodeid_str);
error = 0;
@@ -591,10 +591,8 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
/* Get all alternative node names */
num_nodenames = 1;
- objdb->object_find_reset(node_object_handle);
- while (objdb->object_find(node_object_handle,
- "altname", strlen("altname"),
- &alt_object) == 0) {
+ objdb->object_find_create(node_object_handle,"altname", strlen("altname"), &find_handle);
+ while (objdb->object_find_next(find_handle, &alt_object) == 0) {
unsigned int port;
char *nodename;
char *mcast;
@@ -614,6 +612,7 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
num_nodenames++;
}
+ objdb->object_find_destroy(find_handle);
out:
return error;
@@ -622,14 +621,16 @@ out:
/* These are basically cman overrides to the totem config bits */
static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
{
+ unsigned int logger_object_handle;
+ char *logstr;
+ char *logfacility;
unsigned int object_handle;
+ unsigned int find_handle;
char tmp[256];
/* "totem" key already exists, because we have added the interfaces by now */
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE,
- "totem", strlen("totem"),
- &object_handle) == 0)
+ objdb->object_find_create(OBJECT_PARENT_HANDLE,"totem", strlen("totem"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle) == 0)
{
char *value;
@@ -665,7 +666,6 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
"4800", strlen("4800")+1);
}
-
/* Set RRP mode appropriately */
if (objdb_get_string(objdb, object_handle, "rrp_mode", &value)) {
if (num_interfaces > 1) {
@@ -710,78 +710,68 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
tmp, keylen);
}
}
+ objdb->object_find_destroy(find_handle);
/* Make sure mainconfig doesn't stomp on our logging options */
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE,
- "logging", strlen("logging"), &object_handle)) {
+ objdb->object_find_create(OBJECT_PARENT_HANDLE, "logging", strlen("logging"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle)) {
objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
"logging", strlen("logging"));
}
+ objdb->object_find_destroy(find_handle);
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE,
- "logging", strlen("logging"),
- &object_handle) == 0) {
- unsigned int logger_object_handle;
- char *logstr;
- char *logfacility;
-
- logfacility = facility_name_get(SYSLOGFACILITY);
+ logfacility = facility_name_get(SYSLOGFACILITY);
- logger_object_handle = find_cman_logger(objdb, object_handle);
+ logger_object_handle = find_cman_logger(objdb, object_handle);
- if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
- objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
- logfacility, strlen(logfacility)+1);
- }
+ if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
+ objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
+ logfacility, strlen(logfacility)+1);
+ }
- if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) {
- objdb->object_key_create(object_handle, "to_file", strlen("to_file"),
- "yes", strlen("yes")+1);
- }
+ if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) {
+ objdb->object_key_create(object_handle, "to_file", strlen("to_file"),
+ "yes", strlen("yes")+1);
+ }
- if (objdb_get_string(objdb, object_handle, "logfile", &logstr)) {
- objdb->object_key_create(object_handle, "logfile", strlen("logfile"),
- LOGDIR "/cman.log", strlen(LOGDIR "/cman.log")+1);
- }
+ if (objdb_get_string(objdb, object_handle, "logfile", &logstr)) {
+ objdb->object_key_create(object_handle, "logfile", strlen("logfile"),
+ LOGDIR "/cman.log", strlen(LOGDIR "/cman.log")+1);
+ }
- if (debug_mask) {
- objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
- "yes", strlen("yes")+1);
- objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
- "on", strlen("on")+1);
- objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
- "debug", strlen("debug")+1);
+ if (debug_mask) {
+ objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
+ "yes", strlen("yes")+1);
+ objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
+ "on", strlen("on")+1);
+ objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
+ "debug", strlen("debug")+1);
- }
- else {
- char *loglevel;
- loglevel = priority_name_get(SYSLOGLEVEL);
- objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
- loglevel, strlen(loglevel)+1);
- }
+ }
+ else {
+ char *loglevel;
+ loglevel = priority_name_get(SYSLOGLEVEL);
+ objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
+ loglevel, strlen(loglevel)+1);
}
+
/* Don't run under user "ais" */
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &object_handle) != 0) {
+ objdb->object_find_create(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle) != 0) {
objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
- "aisexec", strlen("aisexec"));
+ "aisexec", strlen("aisexec"));
}
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (objdb->object_find(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &object_handle) == 0)
- {
- objdb->object_key_create(object_handle, "user", strlen("user"),
- "root", strlen("root") + 1);
- objdb->object_key_create(object_handle, "group", strlen("group"),
- "root", strlen("root") + 1);
- }
+ objdb->object_find_destroy(find_handle);
+ objdb->object_key_create(object_handle, "user", strlen("user"),
+ "root", strlen("root") + 1);
+ objdb->object_key_create(object_handle, "group", strlen("group"),
+ "root", strlen("root") + 1);
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle, "cman", strlen("cman"), &object_handle) == 0)
+ objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle) == 0)
{
char str[255];
@@ -801,12 +791,13 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
str, strlen(str) + 1);
}
}
+ objdb->object_find_destroy(find_handle);
/* Make sure we load our alter-ego - the main cman module */
objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
"service", strlen("service"));
objdb->object_key_create(object_handle, "name", strlen("name"),
- "openais_cman", strlen("openais_cman") + 1);
+ "corosync_cman", strlen("corosync_cman") + 1);
objdb->object_key_create(object_handle, "ver", strlen("ver"),
"0", 2);
}
@@ -816,6 +807,7 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
{
char tmp[255];
unsigned int object_handle;
+ unsigned int find_handle;
/* Enforce key */
key_filename = NOCCS_KEY_FILENAME;
@@ -901,40 +893,34 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
cluster_name, strlen(cluster_name)+1);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"), &object_handle)) {
+ objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle) == 0) {
objdb->object_create(cluster_parent_handle, &object_handle,
"cman", strlen("cman"));
}
+ sprintf(tmp, "%d", cluster_id);
+ objdb->object_key_create(object_handle, "cluster_id", strlen("cluster_id"),
+ tmp, strlen(tmp)+1);
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"),
- &object_handle) == 0) {
+ sprintf(tmp, "%d", expected_votes);
+ objdb->object_key_create(object_handle, "expected_votes", strlen("expected_votes"),
+ tmp, strlen(tmp)+1);
- sprintf(tmp, "%d", cluster_id);
- objdb->object_key_create(object_handle, "cluster_id", strlen("cluster_id"),
- tmp, strlen(tmp)+1);
-
- sprintf(tmp, "%d", expected_votes);
- objdb->object_key_create(object_handle, "expected_votes", strlen("expected_votes"),
- tmp, strlen(tmp)+1);
- }
+ objdb->object_find_destroy(find_handle);
return 0;
}
static int get_cman_globals(struct objdb_iface_ver0 *objdb)
{
unsigned int object_handle;
+ unsigned int find_handle;
objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
/* Get the <cman> bits that override <totem> bits */
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"),
- &object_handle) == 0) {
+ objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle) == 0) {
if (!portnum)
objdb_get_int(objdb, object_handle, "port", &portnum, DEFAULT_PORT);
@@ -947,6 +933,7 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
if (!cluster_id)
cluster_id = generate_cluster_id(cluster_name);
}
+ objdb->object_find_destroy(find_handle);
return 0;
}
@@ -954,20 +941,22 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_strin
{
int ret = 0;
unsigned int object_handle;
+ unsigned int find_handle;
if (getenv("CMAN_PIPE"))
startup_pipe = atoi(getenv("CMAN_PIPE"));
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- objdb->object_find(OBJECT_PARENT_HANDLE,
- "cluster", strlen("cluster"), &cluster_parent_handle);
+ objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
+ objdb->object_find_next(find_handle, &cluster_parent_handle);
+ objdb->object_find_destroy(find_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"), &object_handle)) {
+ objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (objdb->object_find_next(find_handle, &object_handle)) {
objdb->object_create(cluster_parent_handle, &object_handle,
- "cman", strlen("cman"));
+ "cman", strlen("cman"));
}
+ objdb->object_find_destroy(find_handle);
get_env_overrides();
if (getenv("CMAN_NOCONFIG"))
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index 3a6091e..ae94f37 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -7,9 +7,9 @@
#include <errno.h>
#include <netdb.h>
-#include <openais/service/objdb.h>
-#include <openais/service/swab.h>
-#include <openais/service/logsys.h>
+#include <corosync/ipc_gen.h>
+#include <corosync/engine/coroapi.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "cnxman-socket.h"
@@ -17,11 +17,12 @@
#include "logging.h"
#include "commands.h"
#include "cman.h"
+#define OBJDB_API struct corosync_api_v1
#include "cmanconfig.h"
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
#include "nodelist.h"
#include "ais.h"
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
/* Local vars - things we get from ccs */
int two_node;
@@ -37,7 +38,7 @@ static unsigned int cluster_parent_handle;
* add them to our node list.
* Called when we start up and on "cman_tool version".
*/
-int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_version, int check_nodeids)
+int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_version, int check_nodeids)
{
int error;
unsigned int expected = 0;
@@ -45,43 +46,38 @@ int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_version
int nodeid;
unsigned int object_handle;
unsigned int nodes_handle;
- unsigned int parent_handle;
+ unsigned int find_handle;
char *nodename;
/* New config version */
- objdb_get_int(objdb, cluster_parent_handle, "config_version", config_version, 0);
+ objdb_get_int(corosync, cluster_parent_handle, "config_version", config_version,0);
- objdb->object_find_reset(cluster_parent_handle);
+ corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"),
- &object_handle) == 0)
+ if (corosync->object_find_next(find_handle, &object_handle) == 0)
{
/* This overrides any other expected votes calculation /except/ for
one specified on a join command-line */
- objdb_get_int(objdb, object_handle, "expected_votes", &expected, 0);
- objdb_get_int(objdb, object_handle, "two_node", (unsigned int *)&two_node, 0);
- objdb_get_int(objdb, object_handle, "cluster_id", &cluster_id, 0);
- objdb_get_string(objdb, object_handle, "nodename", &our_nodename);
- objdb_get_int(objdb, object_handle, "max_queued", &max_outstanding_messages, DEFAULT_MAX_QUEUED);
+ objdb_get_int(corosync, object_handle, "expected_votes", &expected, 0);
+ objdb_get_int(corosync, object_handle, "two_node", (unsigned int *)&two_node, 0);
+ objdb_get_int(corosync, object_handle, "cluster_id", &cluster_id, 0);
+ objdb_get_string(corosync, object_handle, "nodename", &our_nodename);
+ objdb_get_int(corosync, object_handle, "max_queued", &max_outstanding_messages, DEFAULT_MAX_QUEUED);
}
+ corosync->object_find_destroy(find_handle);
clear_reread_flags();
/* Get the nodes list */
- nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &parent_handle);
+ nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
do {
- if (objdb_get_string(objdb, nodes_handle, "name", &nodename)) {
- nodes_handle = nodeslist_next(objdb, parent_handle);
+ if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) {
+ nodes_handle = nodeslist_next(corosync, find_handle);
continue;
}
- objdb_get_int(objdb, nodes_handle, "votes", (unsigned int *)&votes, 0);
- if (votes == 0)
- votes = 1;
-
- objdb_get_int(objdb, nodes_handle, "nodeid", (unsigned int *)&nodeid, 0);
-
+ objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
+ objdb_get_int(corosync, nodes_handle, "nodeid", (unsigned int *)&nodeid, 0);
if (check_nodeids && nodeid == 0) {
char message[132];
@@ -96,8 +92,9 @@ int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_version
P_MEMB("Got node %s from ccs (id=%d, votes=%d)\n", nodename, nodeid, votes);
add_ccs_node(nodename, nodeid, votes, expected);
- nodes_handle = nodeslist_next(objdb, parent_handle);
+ nodes_handle = nodeslist_next(corosync, find_handle);
} while (nodes_handle);
+ corosync->object_find_destroy(find_handle);
if (expected)
override_expected(expected);
@@ -109,7 +106,7 @@ out_err:
return error;
}
-static int join(struct objdb_iface_ver0 *objdb)
+static int join(struct corosync_api_v1 *corosync)
{
int error;
error = cman_set_nodename(our_nodename);
@@ -118,7 +115,7 @@ static int join(struct objdb_iface_ver0 *objdb)
/*
* Setup join information
*/
- error = cman_join_cluster(objdb, cluster_name, cluster_id,
+ error = cman_join_cluster(corosync, cluster_name, cluster_id,
two_node, our_votes, expected_votes);
if (error == -EINVAL) {
write_cman_pipe("Cannot start, cluster name is too long or other CCS error");
@@ -132,7 +129,7 @@ static int join(struct objdb_iface_ver0 *objdb)
return 0;
}
-static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
+static int get_cman_join_info(struct corosync_api_v1 *corosync)
{
char *cname = NULL;
int error, vote_sum = 0, node_count = 0;
@@ -141,7 +138,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
unsigned int node_object;
/* Cluster name */
- if (objdb_get_string(objdb, cluster_parent_handle, "name", &cname)) {
+ if (objdb_get_string(corosync, cluster_parent_handle, "name", &cname)) {
log_printf(LOG_ERR, "cannot find cluster name in config file");
write_cman_pipe("Can't find cluster name in CCS");
error = -ENOENT;
@@ -165,18 +162,15 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
/* Sum node votes for expected */
if (expected_votes == 0) {
unsigned int nodes_handle;
- unsigned int parent_handle;
+ unsigned int find_handle;
- nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &parent_handle);
+ nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
do {
int votes;
node_count++;
- objdb_get_int(objdb, nodes_handle, "votes", (unsigned int *)&votes, 0);
- if (votes == 0)
- votes = 1;
-
+ objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
if (votes < 0) {
log_printf(LOG_ERR, "negative votes not allowed");
write_cman_pipe("Found negative votes for this node in CCS");
@@ -184,20 +178,20 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
goto out;
}
vote_sum += votes;
- nodes_handle = nodeslist_next(objdb, parent_handle);
+ nodes_handle = nodeslist_next(corosync, find_handle);
} while (nodes_handle);
+ corosync->object_find_destroy(find_handle);
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle,
- "cman", strlen("cman"),
- &object_handle) == 0)
+ corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
+ if (corosync->object_find_next(find_handle, &object_handle) == 0)
{
/* optional expected_votes supercedes vote sum */
- objdb_get_int(objdb, object_handle, "expected_votes", (unsigned int *)&expected_votes, 0);
+ objdb_get_int(corosync, object_handle, "expected_votes", (unsigned int *)&expected_votes, 0);
if (!expected_votes)
expected_votes = vote_sum;
}
+ corosync->object_find_destroy(find_handle);
}
/* find our own number of votes */
@@ -206,7 +200,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
log_printf(LOG_INFO, "Using override votes %d\n", votes);
}
- node_object = nodelist_byname(objdb, cluster_parent_handle, our_nodename);
+ node_object = nodelist_byname(corosync, cluster_parent_handle, our_nodename);
if (!node_object) {
log_printf(LOG_ERR, "unable to find votes for %s", our_nodename);
write_cman_pipe("Unable to find votes for node in CCS");
@@ -215,8 +209,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
if (!votes) {
unsigned int votestmp=-1;
- objdb_get_int(objdb, node_object, "votes", &votestmp, 1);
-
+ objdb_get_int(corosync, node_object, "votes", &votestmp, 1);
if (votestmp < 0 || votestmp > 255) {
log_printf(LOG_ERR, "invalid votes value %d", votestmp);
write_cman_pipe("Found invalid votes for node in CCS");
@@ -233,7 +226,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)
}
if (!nodeid) {
- objdb_get_int(objdb, node_object, "nodeid", (unsigned int *)&nodeid, 0);
+ objdb_get_int(corosync, node_object, "nodeid", (unsigned int *)&nodeid, 0);
}
if (!nodeid) {
@@ -274,22 +267,26 @@ out:
/* Read the stuff we need to get started.
This does what 'cman_tool join' used to to */
-int read_cman_config(struct objdb_iface_ver0 *objdb, unsigned int *config_version)
+int read_cman_config(struct corosync_api_v1 *corosync, unsigned int *config_version)
{
int error;
+ unsigned int find_handle;
+
+ /* Get the parent object handle */
+ corosync->object_find_create(OBJECT_PARENT_HANDLE,
+ "cluster", strlen("cluster"), &find_handle);
- objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- objdb->object_find(OBJECT_PARENT_HANDLE,
- "cluster", strlen("cluster"), &cluster_parent_handle);
+ corosync->object_find_next(find_handle, &cluster_parent_handle);
+ corosync->object_find_destroy(find_handle);
- read_cman_nodes(objdb, config_version, 1);
- error = get_cman_join_info(objdb);
+ read_cman_nodes(corosync, config_version, 1);
+ error = get_cman_join_info(corosync);
if (error) {
log_printf(LOG_ERR, "Error reading configuration, cannot start");
return error;
}
- error = join(objdb);
+ error = join(corosync);
return error;
}
diff --git a/cman/daemon/cmanconfig.h b/cman/daemon/cmanconfig.h
index aa30f65..2d66add 100644
--- a/cman/daemon/cmanconfig.h
+++ b/cman/daemon/cmanconfig.h
@@ -1,35 +1,3 @@
-int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_version, int check_nodeids);
-int read_cman_config(struct objdb_iface_ver0 *objdb, unsigned int *config_version);
+int read_cman_nodes(struct corosync_api_v1 *api, unsigned int *config_version, int check_nodeids);
+int read_cman_config(struct corosync_api_v1 *api, unsigned int *config_version);
-/* These just make the access a little neater */
-static inline int objdb_get_string(struct objdb_iface_ver0 *objdb, unsigned int object_service_handle,
- char *key, char **value)
-{
- int res;
-
- *value = NULL;
- if ( !(res = objdb->object_key_get(object_service_handle,
- key,
- strlen(key),
- (void *)value,
- NULL))) {
- if (*value)
- return 0;
- }
- return -1;
-}
-
-static inline void objdb_get_int(struct objdb_iface_ver0 *objdb, unsigned int object_service_handle,
- char *key, unsigned int *intvalue, unsigned int default_value)
-{
- char *value = NULL;
-
- *intvalue = default_value;
-
- if (!objdb->object_key_get(object_service_handle, key, strlen(key),
- (void *)&value, NULL)) {
- if (value) {
- *intvalue = atoi(value);
- }
- }
-}
diff --git a/cman/daemon/cnxman-private.h b/cman/daemon/cnxman-private.h
index aa012bb..3666b10 100644
--- a/cman/daemon/cnxman-private.h
+++ b/cman/daemon/cnxman-private.h
@@ -1,8 +1,6 @@
#ifndef __CNXMAN_PRIVATE_H
#define __CNXMAN_PRIVATE_H
-#include <openais/totem/totem.h>
-
/* Protocol Version triplet */
#define CNXMAN_MAJOR_VERSION 6
#define CNXMAN_MINOR_VERSION 1
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 65e4df4..f2236cb 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -6,6 +6,7 @@
#include <inttypes.h>
#include <syslog.h>
#include <string.h>
+#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/types.h>
@@ -19,14 +20,9 @@
#include <sys/errno.h>
#include <dlfcn.h>
-#include <openais/service/objdb.h>
-#include <openais/service/swab.h>
-#include <openais/totem/totemip.h>
-#include <openais/totem/totempg.h>
-#include <openais/service/swab.h>
-#include <openais/service/logsys.h>
-#include <openais/service/timer.h>
-#include <openais/totem/aispoll.h>
+#include <corosync/ipc_gen.h>
+#include <corosync/engine/coroapi.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "cman.h"
#include "cnxman-socket.h"
@@ -34,7 +30,9 @@
#include "daemon.h"
#include "barrier.h"
#include "logging.h"
+#define OBJDB_API struct corosync_api_v1
#include "cmanconfig.h"
+#include "nodelist.h"
#include "commands.h"
#include "ais.h"
@@ -67,15 +65,15 @@ static struct cluster_node *quorum_device;
static uint16_t cluster_id;
static int ais_running;
static time_t join_time;
-static openais_timer_handle quorum_device_timer;
-static struct objdb_iface_ver0 *global_objdb;
+static corosync_timer_handle_t quorum_device_timer;
+static struct corosync_api_v1 *corosync;
/* If CCS gets out of sync, we poll it until it isn't */
-static openais_timer_handle ccsd_timer;
+static corosync_timer_handle_t ccsd_timer;
static unsigned int wanted_config_version;
static int config_error;
-static openais_timer_handle shutdown_timer;
+static corosync_timer_handle_t shutdown_timer;
static struct connection *shutdown_con;
static uint32_t shutdown_flags;
static int shutdown_yes;
@@ -88,7 +86,7 @@ static int get_node_count(void);
static int get_highest_nodeid(void);
static int send_port_open_msg(unsigned char port);
static int send_port_enquire(int nodeid);
-static void process_internal_message(char *data, int len, int nodeid, int byteswap);
+static void process_internal_message(char *data, int nodeid, int byteswap);
static void recalculate_quorum(int allow_decrease, int by_current_nodes);
static void send_kill(int nodeid, uint16_t reason);
static char *killmsg_reason(int reason);
@@ -138,6 +136,39 @@ static int have_disallowed(void)
return 0;
}
+/* Make a totem_ip_address into a usable sockaddr_storage */
+static int totemip_to_sockaddr(struct totem_ip_address *ip_addr,
+ uint16_t port, struct sockaddr_storage *saddr, int *addrlen)
+{
+ int ret = -1;
+
+ if (ip_addr->family == AF_INET) {
+ struct sockaddr_in *sin = (struct sockaddr_in *)saddr;
+
+ memset(sin, 0, sizeof(struct sockaddr_in));
+ sin->sin_family = ip_addr->family;
+ sin->sin_port = port;
+ memcpy(&sin->sin_addr, ip_addr->addr, sizeof(struct in_addr));
+ *addrlen = sizeof(struct sockaddr_in);
+ ret = 0;
+ }
+
+ if (ip_addr->family == AF_INET6) {
+ struct sockaddr_in6 *sin = (struct sockaddr_in6 *)saddr;
+
+ memset(sin, 0, sizeof(struct sockaddr_in6));
+ sin->sin6_family = ip_addr->family;
+ sin->sin6_port = port;
+ sin->sin6_scope_id = 2;
+ memcpy(&sin->sin6_addr, ip_addr->addr, sizeof(struct in6_addr));
+
+ *addrlen = sizeof(struct sockaddr_in6);
+ ret = 0;
+ }
+
+ return ret;
+}
+
/* If "cluster_is_quorate" is 0 then all activity apart from protected ports is
* blocked. */
static void set_quorate(int total_votes)
@@ -356,9 +387,9 @@ static void copy_to_usernode(struct cluster_node *node,
/* Just send the first address. If the user wants the full set they
must ask for them */
- totempg_ifaces_get(node->node_id, node_ifs, &status, &numaddrs);
+ corosync->totem_ifaces_get(node->node_id, node_ifs, &status, &numaddrs);
- totemip_totemip_to_sockaddr_convert(&node_ifs[0], 0, &ss, &addrlen);
+ totemip_to_sockaddr(&node_ifs[0], 0, &ss, &addrlen);
memcpy(unode->addr, &ss, addrlen);
unode->addrlen = addrlen;
}
@@ -382,7 +413,7 @@ int cman_set_nodeid(int nodeid)
return 0;
}
-int cman_join_cluster(struct objdb_iface_ver0 *objdb,
+int cman_join_cluster(struct corosync_api_v1 *api,
char *name, unsigned short cl_id,
int two_node_flag, int votes, int expected_votes)
{
@@ -395,7 +426,7 @@ int cman_join_cluster(struct objdb_iface_ver0 *objdb,
cluster_id = cl_id;
strncpy(cluster_name, name, MAX_CLUSTER_NAME_LEN);
two_node = two_node_flag;
- global_objdb = objdb;
+ corosync = api;
quit_threads = 0;
ais_running = 1;
@@ -450,6 +481,8 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
unsigned int num_interfaces;
unsigned int totem_object_handle;
unsigned int object_handle;
+ unsigned int totem_find_handle;
+ unsigned int iface_find_handle;
char **status;
struct cluster_node *node;
struct sockaddr_storage *ss;
@@ -459,7 +492,7 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
if (!we_are_a_cluster_member)
return -ENOENT;
- totempg_ifaces_get(us->node_id, node_ifs, &status, &num_interfaces);
+ corosync->totem_ifaces_get(us->node_id, node_ifs, &status, &num_interfaces);
list_iterate_items(node, &cluster_members_list) {
if (node->state == NODESTATE_MEMBER) {
@@ -505,20 +538,19 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
ptr = einfo->addresses;
- global_objdb->object_find_reset(OBJECT_PARENT_HANDLE);
- if (global_objdb->object_find(OBJECT_PARENT_HANDLE,
- "totem", strlen("totem"),
- &totem_object_handle) == 0) {
+ corosync->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &totem_find_handle);
+ if (corosync->object_find_next(totem_find_handle, &totem_object_handle) == 0) {
+
+ corosync->object_find_destroy(totem_find_handle);
- while (global_objdb->object_find(totem_object_handle,
- "interface", strlen("interface"),
- &object_handle) == 0) {
+ corosync->object_find_create(totem_object_handle, "interface", strlen("interface"), &iface_find_handle);
+ while (corosync->object_find_next(iface_find_handle, &object_handle) == 0) {
char *mcast;
struct sockaddr_in *saddr4;
struct sockaddr_in6 *saddr6;
- objdb_get_string(global_objdb, object_handle, "mcastaddr", &mcast);
+ objdb_get_string(corosync, object_handle, "mcastaddr", &mcast);
memset(ptr, 0, sizeof(struct sockaddr_storage));
saddr4 = (struct sockaddr_in *)ptr;
@@ -533,10 +565,11 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
ptr += sizeof(struct sockaddr_storage);
}
}
+ corosync->object_find_destroy(iface_find_handle);
for (i=0; i<num_interfaces; i++) {
ss = (struct sockaddr_storage *)ptr;
- totemip_totemip_to_sockaddr_convert(&node_ifs[i], 0, ss, &addrlen);
+ totemip_to_sockaddr(&node_ifs[i], 0, ss, &addrlen);
ptr += sizeof(struct sockaddr_storage);
}
@@ -891,7 +924,7 @@ static void check_shutdown_status()
/* All replies safely gathered in ? */
if (shutdown_yes + shutdown_no >= shutdown_expected) {
- openais_timer_delete(shutdown_timer);
+ corosync->timer_delete(shutdown_timer);
if (shutdown_yes >= shutdown_expected ||
shutdown_flags & SHUTDOWN_ANYWAY) {
@@ -976,7 +1009,7 @@ static int do_cmd_try_shutdown(struct connection *con, char *cmdbuf)
/* Start the timer. If we don't get a full set of replies before this goes
off we'll cancel the shutdown */
- openais_timer_add_duration((unsigned long long)shutdown_timeout*1000000, NULL,
+ corosync->timer_add_duration((unsigned long long)shutdown_timeout*1000000, NULL,
shutdown_timer_fn, &shutdown_timer);
notify_listeners(NULL, EVENT_REASON_TRY_SHUTDOWN, flags);
@@ -1053,12 +1086,12 @@ static void ccsd_timer_fn(void *arg)
int ccs_err;
log_printf(LOG_DEBUG, "Polling ccsd for updated information\n");
- ccs_err = read_cman_nodes(global_objdb, &config_version, 0);
+ ccs_err = read_cman_nodes(corosync, &config_version, 0);
if (ccs_err || config_version < wanted_config_version) {
log_printf(LOG_ERR, "Can't read CCS to get updated config version %d. Activity suspended on this node\n",
wanted_config_version);
- openais_timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
+ corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
ccsd_timer_fn, &ccsd_timer);
}
else {
@@ -1084,7 +1117,7 @@ static void quorum_device_timer_fn(void *arg)
recalculate_quorum(0, 0);
}
else {
- openais_timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
+ corosync->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
quorum_device_timer_fn, &quorum_device_timer);
}
}
@@ -1104,7 +1137,7 @@ static int do_cmd_poll_quorum_device(char *cmdbuf, int *retlen)
quorum_device->state = NODESTATE_MEMBER;
recalculate_quorum(0, 0);
- openais_timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
+ corosync->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
quorum_device_timer_fn, &quorum_device_timer);
}
}
@@ -1112,7 +1145,7 @@ static int do_cmd_poll_quorum_device(char *cmdbuf, int *retlen)
if (quorum_device->state == NODESTATE_MEMBER) {
quorum_device->state = NODESTATE_DEAD;
recalculate_quorum(0, 0);
- openais_timer_delete(quorum_device_timer);
+ corosync->timer_delete(quorum_device_timer);
}
}
@@ -1201,13 +1234,13 @@ static int do_cmd_get_node_addrs(char *cmdbuf, char **retbuf, int retsize, int *
if (node->state != NODESTATE_MEMBER)
return 0;
- if (totempg_ifaces_get(nodeid, node_ifs, &status, (unsigned int *)&addrs->numaddrs))
+ if (corosync->totem_ifaces_get(nodeid, node_ifs, &status, (unsigned int *)&addrs->numaddrs))
return -errno;
for (i=0; i<addrs->numaddrs; i++) {
- totemip_totemip_to_sockaddr_convert(&node_ifs[i], 0,
- &addrs->addrs[i].addr,
- &addrs->addrs[i].addrlen);
+ totemip_to_sockaddr(&node_ifs[i], 0,
+ &addrs->addrs[i].addr,
+ &addrs->addrs[i].addrlen);
}
*retlen = sizeof(struct cl_get_node_addrs) +
addrs->numaddrs * sizeof(struct cl_node_addrs);
@@ -1259,7 +1292,7 @@ int process_command(struct connection *con, int cmd, char *cmdbuf,
case CMAN_CMD_DUMP_OBJDB:
dumpfile = fopen(cmdbuf, "w+");
if (dumpfile) {
- global_objdb->object_dump(OBJECT_PARENT_HANDLE, dumpfile);
+ corosync->object_dump(OBJECT_PARENT_HANDLE, dumpfile);
fclose(dumpfile);
err = 0;
}
@@ -1396,12 +1429,13 @@ int process_command(struct connection *con, int cmd, char *cmdbuf,
int send_to_userport(unsigned char fromport, unsigned char toport,
int nodeid, int tgtid,
- char *recv_buf, int len, int endian_conv)
+ char *recv_buf, int len,
+ int endian_conv)
{
int ret = -1;
if (toport == 0) {
- process_internal_message(recv_buf, len, nodeid, endian_conv);
+ process_internal_message(recv_buf, nodeid, endian_conv);
ret = 0;
}
else {
@@ -1409,7 +1443,7 @@ int send_to_userport(unsigned char fromport, unsigned char toport,
if (port_array[toport]) {
struct connection *c = port_array[toport];
- P_MEMB("send_to_userport. cmd=%d, len=%d, endian_conv=%d\n", recv_buf[0], len, endian_conv);
+ P_MEMB("send_to_userport. cmd=%d, endian_conv=%d\n", recv_buf[0],endian_conv);
send_data_reply(c, nodeid, fromport, recv_buf, len);
ret = 0;
@@ -1547,14 +1581,14 @@ static int valid_transition_msg(int nodeid, struct cl_transmsg *msg)
if (msg->config_version > config_version) {
int ccs_err;
- ccs_err = read_cman_nodes(global_objdb, &config_version, 0);
+ ccs_err = read_cman_nodes(corosync, &config_version, 0);
if (ccs_err || config_version < msg->config_version) {
config_error = 1;
log_printf(LOG_ERR, "Can't read CCS to get updated config version %d. Activity suspended on this node\n",
msg->config_version);
wanted_config_version = msg->config_version;
- openais_timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
+ corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
ccsd_timer_fn, &ccsd_timer);
}
if (config_version > msg->config_version) {
@@ -1618,7 +1652,7 @@ void send_transition_msg(int last_memb_count, int first_trans)
0); /* flags */
}
-static void byteswap_internal_message(char *data, int len)
+static void byteswap_internal_message(char *data)
{
struct cl_protmsg *msg = (struct cl_protmsg *)data;
struct cl_barriermsg *barriermsg;
@@ -1709,7 +1743,7 @@ static void do_reconfigure_msg(void *data)
case RECONFIG_PARAM_CONFIG_VERSION:
if (config_version != msg->value &&
- read_cman_nodes(global_objdb, &config_version, 0)) {
+ read_cman_nodes(corosync, &config_version, 0)) {
log_printf(LOG_ERR, "Can't read CCS to get updated config version %d. Activity suspended on this node\n",
msg->value);
@@ -1717,7 +1751,7 @@ static void do_reconfigure_msg(void *data)
recalculate_quorum(0, 0);
wanted_config_version = config_version;
- openais_timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
+ corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
ccsd_timer_fn, &ccsd_timer);
}
notify_listeners(NULL, EVENT_REASON_CONFIG_UPDATE, config_version);
@@ -1749,7 +1783,7 @@ static void do_fence_msg(void *data)
}
-static void do_process_transition(int nodeid, char *data, int len)
+static void do_process_transition(int nodeid, char *data)
{
struct cl_transmsg *msg = (struct cl_transmsg *)data;
struct cluster_node *node;
@@ -1859,7 +1893,7 @@ static void do_process_transition(int nodeid, char *data, int len)
}
}
-static void process_internal_message(char *data, int len, int nodeid, int need_byteswap)
+static void process_internal_message(char *data, int nodeid, int need_byteswap)
{
struct cl_protmsg *msg = (struct cl_protmsg *)data;
struct cl_portmsg *portmsg;
@@ -1869,11 +1903,11 @@ static void process_internal_message(char *data, int len, int nodeid, int need_b
struct cluster_node *node = find_node_by_nodeid(nodeid);
unsigned char portresult[PORT_BITS_SIZE+1];
- P_MEMB("Message on port 0 is %d (len = %d)\n", msg->cmd, len);
+ P_MEMB("Message on port 0 is %d\n", msg->cmd);
/* Byteswap messages if needed */
if (need_byteswap)
- byteswap_internal_message(data, len);
+ byteswap_internal_message(data);
switch (msg->cmd) {
case CLUSTER_MSG_PORTOPENED:
@@ -1909,7 +1943,7 @@ static void process_internal_message(char *data, int len, int nodeid, int need_b
case CLUSTER_MSG_TRANSITION:
P_MEMB("got TRANSITION from node %d\n", nodeid);
- do_process_transition(nodeid, data, len);
+ do_process_transition(nodeid, data);
break;
case CLUSTER_MSG_KILLNODE:
diff --git a/cman/daemon/commands.h b/cman/daemon/commands.h
index 9110b43..5d325ad 100644
--- a/cman/daemon/commands.h
+++ b/cman/daemon/commands.h
@@ -1,7 +1,6 @@
-#include <openais/service/objdb.h>
struct cluster_node;
struct connection;
-extern void process_cnxman_message(char *data, int len, char *addr, int addrlen,
+extern void process_cnxman_message(char *data, char *addr, int addrlen,
struct cluster_node *rem_node);
extern int send_to_userport(unsigned char fromport, unsigned char toport,
@@ -30,7 +29,7 @@ extern void remove_unread_nodes(void);
/* Startup stuff called from cmanccs: */
extern int cman_set_nodename(char *name);
extern int cman_set_nodeid(int nodeid);
-extern int cman_join_cluster(struct objdb_iface_ver0 *objdb,
+extern int cman_join_cluster(struct corosync_api_v1 *api,
char *name, unsigned short cluster_id, int two_node,
int votes, int expected_votes);
diff --git a/cman/daemon/daemon.c b/cman/daemon/daemon.c
index 3934b0f..b08e78e 100644
--- a/cman/daemon/daemon.c
+++ b/cman/daemon/daemon.c
@@ -17,9 +17,10 @@
#include <netinet/in.h>
#include <sys/errno.h>
-#include <openais/service/swab.h>
-#include <openais/totem/aispoll.h>
-#include <openais/totem/totemip.h>
+#include <corosync/ipc_gen.h>
+#include <corosync/engine/coroapi.h>
+#include <corosync/engine/logsys.h>
+#include <corosync/totem/coropoll.h>
#include "list.h"
#include "cnxman-socket.h"
diff --git a/cman/daemon/logging.c b/cman/daemon/logging.c
index 727c4ad..ad3359f 100644
--- a/cman/daemon/logging.c
+++ b/cman/daemon/logging.c
@@ -8,7 +8,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "cman.h"
#include "cnxman-socket.h"
diff --git a/cman/daemon/logging.h b/cman/daemon/logging.h
index f2d84cd..23ecb90 100644
--- a/cman/daemon/logging.h
+++ b/cman/daemon/logging.h
@@ -1,4 +1,4 @@
-#include <openais/service/logsys.h>
+//#include <corosync/service/logsys.h>
extern void set_debuglog(int subsystems);
diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h
index 2df87b9..64a5807 100644
--- a/cman/daemon/nodelist.h
+++ b/cman/daemon/nodelist.h
@@ -1,59 +1,92 @@
+/* These just make the access a little neater */
+static inline int objdb_get_string(OBJDB_API *corosync, unsigned int object_service_handle,
+ char *key, char **value)
+{
+ int res;
+
+ *value = NULL;
+ if ( !(res = corosync->object_key_get(object_service_handle,
+ key,
+ strlen(key),
+ (void *)value,
+ NULL))) {
+ if (*value)
+ return 0;
+ }
+ return -1;
+}
+
+static inline void objdb_get_int(OBJDB_API *corosync, unsigned int object_service_handle,
+ char *key, unsigned int *intvalue, unsigned int default_value)
+{
+ char *value = NULL;
+
+ *intvalue = default_value;
+
+ if (!corosync->object_key_get(object_service_handle, key, strlen(key),
+ (void *)&value, NULL)) {
+ if (value) {
+ *intvalue = atoi(value);
+ }
+ }
+}
+
+
/* Helper functions for navigating the nodes list */
-static unsigned int nodeslist_init(struct objdb_iface_ver0 *objdb,
- unsigned int cluster_parent_handle,
- unsigned int *parent_handle)
+static inline unsigned int nodeslist_init(OBJDB_API *corosync,
+ unsigned int cluster_parent_handle,
+ unsigned int *find_handle)
{
unsigned int object_handle;
+ unsigned int find_handle1;
+ unsigned int find_handle2;
- objdb->object_find_reset(cluster_parent_handle);
- if (objdb->object_find(cluster_parent_handle,
- "clusternodes", strlen("clusternodes"),
- &object_handle) == 0)
+ corosync->object_find_create(cluster_parent_handle,"clusternodes", strlen("clusternodes"), &find_handle1);
+ if (corosync->object_find_next(find_handle1, &object_handle) == 0)
{
unsigned int nodes_handle;
- objdb->object_find_reset(object_handle);
+ corosync->object_find_destroy(find_handle1);
+
+ corosync->object_find_create(object_handle,"clusternode", strlen("clusternode"), &find_handle2);
- if (objdb->object_find(object_handle,
- "clusternode", strlen("clusternode"),
- &nodes_handle) == 0)
+ if (corosync->object_find_next(find_handle2, &nodes_handle) == 0)
{
- *parent_handle = object_handle;
+ *find_handle = find_handle2;
return nodes_handle;
}
}
return 0;
}
-static unsigned int nodeslist_next(struct objdb_iface_ver0 *objdb, unsigned int parent_handle)
+static inline unsigned int nodeslist_next(OBJDB_API *corosync, unsigned int find_handle)
{
unsigned int nodes_handle;
- if (objdb->object_find(parent_handle,
- "clusternode", strlen("clusternode"),
- &nodes_handle) == 0)
+ if (corosync->object_find_next(find_handle, &nodes_handle) == 0)
return nodes_handle;
else
return 0;
}
-static unsigned int nodelist_byname(struct objdb_iface_ver0 *objdb,
- unsigned int cluster_parent_handle,
- char *name)
+static inline unsigned int nodelist_byname(OBJDB_API *corosync,
+ unsigned int cluster_parent_handle,
+ char *name)
{
char *nodename;
unsigned int nodes_handle;
- unsigned int parent_handle;
+ unsigned int find_handle;
- nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &parent_handle);
+ nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
while (nodes_handle) {
- if (objdb_get_string(objdb, nodes_handle, "name", &nodename)) {
+ if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) {
break;
}
if (strcmp(nodename, name) == 0)
return nodes_handle;
- nodes_handle = nodeslist_next(objdb, parent_handle);
+ nodes_handle = nodeslist_next(corosync, find_handle);
}
+ corosync->object_find_destroy(find_handle);
return 0;
}
diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8
index 5813181..06d264a 100644
--- a/cman/man/cman_tool.8
+++ b/cman/man/cman_tool.8
@@ -316,6 +316,11 @@ X The node is not a member of the cluster
.br
d The node is known to the cluster but disallowed access to it.
.br
+.SH ENVIRONMENT VARIABLES
+cman_tool removes most environment variables before forking and running OpenAIS, as well as adding some of its own for setting up
+configuration parameters that were overridden on the command-line, the exception to this is that variable with names starting
+COROSYNC_ will be passed down intact as they are assumed to be used for configuring the daemon.
+
.SH DISALLOWED NODES
Occasionally (but very infrequently I hope) you may see nodes marked as "Disallowed" in cman_tool status or "d" in cman_tool nodes. This is a bit of a nasty hack to get around mismatch between what the upper layers expect of the cluster manager and OpenAIS.
.TP
diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
index 0edbd6b..cc6f90e 100644
--- a/cman/qdisk/daemon_init.c
+++ b/cman/qdisk/daemon_init.c
@@ -23,7 +23,7 @@
#include <sys/errno.h>
#include <libgen.h>
#include <signal.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
/*
* This should ultimately go in a header file.
diff --git a/cman/qdisk/disk.c b/cman/qdisk/disk.c
index ca03b81..f94f12c 100644
--- a/cman/qdisk/disk.c
+++ b/cman/qdisk/disk.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <time.h>
#include <linux/fs.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
static int diskRawRead(target_info_t *disk, char *buf, int len);
uint32_t clu_crc32(const char *data, size_t count);
diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c
index f53068a..36c315a 100644
--- a/cman/qdisk/disk_util.c
+++ b/cman/qdisk/disk_util.c
@@ -15,7 +15,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
inline void
_diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end)
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
index f0906d5..ef81081 100644
--- a/cman/qdisk/main.c
+++ b/cman/qdisk/main.c
@@ -21,7 +21,7 @@
#include <sched.h>
#include <signal.h>
#include <ccs.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "score.h"
#if (!defined(LIBCMAN_VERSION) || \
(defined(LIBCMAN_VERSION) && LIBCMAN_VERSION < 2))
diff --git a/cman/qdisk/mkqdisk.c b/cman/qdisk/mkqdisk.c
index dbb0d33..e140c42 100644
--- a/cman/qdisk/mkqdisk.c
+++ b/cman/qdisk/mkqdisk.c
@@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
int
main(int argc, char **argv)
diff --git a/cman/qdisk/proc.c b/cman/qdisk/proc.c
index 78ff82f..ae99216 100644
--- a/cman/qdisk/proc.c
+++ b/cman/qdisk/proc.c
@@ -9,7 +9,7 @@
#include <platform.h>
#include <stdlib.h>
#include <string.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "scandisk.h"
struct device_args {
diff --git a/cman/qdisk/score.c b/cman/qdisk/score.c
index 16ba39e..dc59553 100644
--- a/cman/qdisk/score.c
+++ b/cman/qdisk/score.c
@@ -11,7 +11,7 @@
#include <pthread.h>
#include <string.h>
#include <ccs.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include <sched.h>
#include <sys/mman.h>
#include "disk.h"
diff --git a/config/libs/libccsconfdb/libccs.c b/config/libs/libccsconfdb/libccs.c
index 3abebd6..7e7b2e2 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -12,7 +12,7 @@
#include <errno.h>
#include <limits.h>
#include <openais/saAis.h>
-#include <openais/confdb.h>
+#include <corosync/confdb.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -20,7 +20,6 @@
/* Callbacks are not supported - we will use them to update fullxml doc/ctx */
static confdb_callbacks_t callbacks = {
- .confdb_change_notify_fn = NULL,
};
static confdb_handle_t handle = 0;
@@ -338,8 +337,6 @@ static int path_dive(int tokens)
*/
char *start = NULL, *middle = NULL, *end = NULL;
- char data[PATH_MAX];
- int datalen;
/*
* those ones should be always good because
@@ -358,25 +355,7 @@ static int path_dive(int tokens)
memset(start, 0, 1);
memset(end, 0, 1);
- if (!strcmp(pos, "child::*")) {
- int val, i;
-
- val = atoi(middle);
-
- if(val < 1)
- goto fail;
-
- if(confdb_object_iter_start(handle, query_handle) != SA_AIS_OK)
- goto fail;
-
- for (i = 1; i <= val; i++) {
- if(confdb_object_iter(handle, query_handle, &new_obj_handle, data, &datalen) != SA_AIS_OK)
- goto fail;
- }
-
- query_handle = new_obj_handle;
-
- } else if (!strstr(middle, "@")) {
+ if (!strstr(middle, "@")) {
/* lookup something with index num = int */
int val, i;
@@ -394,7 +373,8 @@ static int path_dive(int tokens)
} else {
/* lookup something with obj foo = bar */
char *equal = NULL, *value = NULL, *tmp = NULL;
- int goout = 0;
+ char data[PATH_MAX];
+ int goout = 0, datalen;
equal=strstr(middle, "=");
if(!equal)
diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c
index 4ad8001..e5a571a 100644
--- a/config/plugins/ldap/configldap.c
+++ b/config/plugins/ldap/configldap.c
@@ -13,15 +13,16 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <arpa/inet.h>
// CC: temp until I tame SASL ... is this necessary?
#define LDAP_DEPRECATED 1
#include <ldap.h>
-/* openais headers */
-#include <openais/service/objdb.h>
-#include <openais/service/config.h>
-#include <openais/lcr/lcr_comp.h>
+/* corosync headers */
+#include <corosync/lcr/lcr_comp.h>
+#include <corosync/engine/objdb.h>
+#include <corosync/engine/config.h>
/* These are defaults. they can be overridden with environment variables
* LDAP_URL & LDAP_BASEDN
@@ -116,8 +117,7 @@ static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int s
int start=0, end=startdn;
unsigned int parent_handle = OBJECT_PARENT_HANDLE;
unsigned int object_handle=0;
-
-// fprintf(stderr, "CC: find parent: startdn=%d, parent=%s\n", startdn, parent);
+ unsigned int find_handle;
/*
* Find the start and end positions first.
@@ -125,7 +125,6 @@ static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int s
* end is the end of the list
*/
do {
-// fprintf(stderr, "CC: %d: seen %s\n", i,dn[i][0][0].la_value.bv_val);
if (!gotstart && dn[i][0][0].la_value.bv_len == 7 &&
!strncmp(parent, dn[i][0][0].la_value.bv_val, 7)) {
gotstart = 1;
@@ -136,16 +135,14 @@ static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int s
if (start <= 0)
return parent_handle;
-// fprintf(stderr, "CC: find parent: start=%d, end=%d\n", start, end);
-
for (i=start; i>=end; i--) {
- objdb->object_find_reset(parent_handle);
-// fprintf(stderr, "CC: %d: looking for %s\n", i,dn[i][0][0].la_value.bv_val);
- if (!objdb->object_find(parent_handle,
- dn[i][0][0].la_value.bv_val, dn[i][0][0].la_value.bv_len,
- &object_handle)) {
+ objdb->object_find_create(parent_handle,
+ dn[i][0][0].la_value.bv_val, dn[i][0][0].la_value.bv_len,
+ &find_handle);
+ if (!objdb->object_find_next(find_handle, &object_handle)) {
parent_handle = object_handle;
}
+ objdb->object_find_destroy(find_handle);
}
return object_handle;
}
@@ -195,7 +192,6 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in
convert_dn_underscores(parsed_dn);
/* Create a new object if the top-level is NOT name= */
-// printf("CC: dn: %s\n", dn);
if (strncmp(parsed_dn[0][0][0].la_attr.bv_val, "name", 4)) {
parent_handle = find_parent(objdb, parsed_dn, 0, object);
diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index f8d2898..8771007 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -1,14 +1,16 @@
#include <string.h>
#include <limits.h>
+#include <syslog.h>
+#include <arpa/inet.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <openais/service/objdb.h>
-#include <openais/service/config.h>
-#include <openais/lcr/lcr_comp.h>
+#include <corosync/lcr/lcr_comp.h>
+#include <corosync/engine/objdb.h>
+#include <corosync/engine/config.h>
#include "logging.h"
@@ -243,7 +245,7 @@ static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
char *configfile = DEFAULT_CONFIG;
/* We need to set this up to internal defaults too early */
- openlog("openais", LOG_CONS|LOG_PID, SYSLOGFACILITY);
+ openlog("corosync", LOG_CONS|LOG_PID, SYSLOGFACILITY);
if(getenv("COROSYNC_CLUSTER_CONFIG_FILE"))
configfile = getenv("COROSYNC_CLUSTER_CONFIG_FILE");
diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
index ab80dae..4bd00a0 100644
--- a/config/tools/ldap/confdb2ldif.c
+++ b/config/tools/ldap/confdb2ldif.c
@@ -17,10 +17,9 @@
#include <sys/un.h>
#include <openais/saAis.h>
-#include <openais/confdb.h>
+#include <corosync/confdb.h>
confdb_callbacks_t callbacks = {
- .confdb_change_notify_fn = NULL,
};
/* This structure maps object parent names to object classes */
diff --git a/configure b/configure
index b4588ec..af97344 100755
--- a/configure
+++ b/configure
@@ -245,7 +245,7 @@ if ($help || !$err) {
print "--readlinelibdir=\tthe base directory for readline libraries. (Default: {libdir})\n";
print "--openaisincdir=\tthe base directory for openais include files. (Default: {incdir})\n";
print "--openaislibdir=\tthe base directory for openais libraries. (Default: {libdir}/openais)\n";
- print "--aisexecbin=\tlocation of aisexec executable file. (Default: /usr/sbin/aisexec)\n";
+ print "--aisexecbin=\tlocation of aisexec executable file. (Default: /usr/sbin/corosync)\n";
print "--nssincdir=\tthe base directory for libnss include files. (Default: {incdir}/nss3)\n";
print "--nsslibdir=\tthe base directory for libnss libraries. (Default: {libdir})\n";
print "--nsprincdir=\tthe base directory for libnspr include files. (Default: {incdir}/nspr4)\n";
@@ -494,7 +494,7 @@ if (!$openaislibdir) {
$openaislibdir="${libdir}/openais";
}
if (!$aisexecbin) {
- $aisexecbin="/usr/sbin/aisexec";
+ $aisexecbin="/usr/sbin/corosync";
}
if (!$nssincdir) {
$nssincdir="${incdir}/nss3";
diff --git a/fence/agents/xvm/debug.h b/fence/agents/xvm/debug.h
index 419bd73..d82b6ff 100644
--- a/fence/agents/xvm/debug.h
+++ b/fence/agents/xvm/debug.h
@@ -1,7 +1,7 @@
#ifndef _DBG_H
#define _DBG_H
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
inline void dset(int);
inline int dget(void);
diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c
index d4f3ef6..32fa229 100644
--- a/fence/fence_node/fence_node.c
+++ b/fence/fence_node/fence_node.c
@@ -3,7 +3,7 @@
#include <unistd.h>
#include <stdint.h>
#include <string.h>
-#include <openais/service/logsys.h>
+#include <corosync/engine/logsys.h>
#include "libfence.h"
#include "libfenced.h"
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
index 161d8f0..96c8a1d 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -23,8 +23,8 @@
#include <sys/time.h>
#include <openais/saAis.h>
-#include <openais/cpg.h>
-#include <openais/service/logsys.h>
+#include <corosync/cpg.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "linux_endian.h"
diff --git a/group/daemon/cman.c b/group/daemon/cman.c
index 12dcd1c..a5ae333 100644
--- a/group/daemon/cman.c
+++ b/group/daemon/cman.c
@@ -1,5 +1,5 @@
-/* Interface with openais's cman API */
+/* Interface with corosync's cman API */
#include <libcman.h>
#include "gd_internal.h"
diff --git a/group/daemon/cpg.c b/group/daemon/cpg.c
index cbfe313..aa3974b 100644
--- a/group/daemon/cpg.c
+++ b/group/daemon/cpg.c
@@ -1,5 +1,5 @@
-/* Interface with openais's closed-process-group (cpg) API */
+/* Interface with corosync's closed-process-group (cpg) API */
#include "gd_internal.h"
diff --git a/group/daemon/gd_internal.h b/group/daemon/gd_internal.h
index ed29457..3537f82 100644
--- a/group/daemon/gd_internal.h
+++ b/group/daemon/gd_internal.h
@@ -21,8 +21,8 @@
#include <sys/poll.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <openais/cpg.h>
-#include <openais/service/logsys.h>
+#include <corosync/cpg.h>
+#include <corosync/engine/logsys.h>
#include "list.h"
#include "linux_endian.h"
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index 1af4256..bcd94a3 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -32,8 +32,8 @@
#include <dirent.h>
#include <openais/saAis.h>
#include <openais/saCkpt.h>
-#include <openais/cpg.h>
-#include <openais/service/logsys.h>
+#include <corosync/cpg.h>
+#include <corosync/engine/logsys.h>
#include <linux/dlmconstants.h>
#include "libdlmcontrol.h"
@@ -46,13 +46,13 @@
The libcpg limit is larger at CPG_MAX_NAME_LENGTH 128. Our cpg name includes
a "dlm:" prefix before the lockspace name. */
-/* Maximum members of a lockspace, should match CPG_MEMBERS_MAX in openais/cpg.h.
+/* Maximum members of a lockspace, should match CPG_MEMBERS_MAX in corosync/cpg.h.
There are no max defines in dlm-kernel for lockspace members. */
#define MAX_NODES 128
/* Maximum number of IP addresses per node, when using SCTP and multi-ring in
- openais. In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+ corosync In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
#define MAX_NODE_ADDRESSES 4
diff --git a/group/gfs_controld/gfs_daemon.h b/group/gfs_controld/gfs_daemon.h
index e16aeca..8d5c2bd 100644
--- a/group/gfs_controld/gfs_daemon.h
+++ b/group/gfs_controld/gfs_daemon.h
@@ -33,8 +33,8 @@
#include <dirent.h>
#include <openais/saAis.h>
#include <openais/saCkpt.h>
-#include <openais/cpg.h>
-#include <openais/service/logsys.h>
+#include <corosync/cpg.h>
+#include <corosync/engine/logsys.h>
#include <linux/dlmconstants.h>
#include "libgfscontrol.h"
@@ -48,7 +48,7 @@
*/
/* Maximum members of a mountgroup, should match CPG_MEMBERS_MAX in
- openais/cpg.h. There are no max defines in gfs-kernel for
+ corosync/cpg.h. There are no max defines in gfs-kernel for
mountgroup members. (FIXME verify gfs-kernel/lock_dlm) */
#define MAX_NODES 128
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-12 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-12 11:34 master - cman (mainly): use corosync Christine Caulfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).