summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2009-11-20 13:32:09 -0600
committerDavid Teigland <teigland@redhat.com>2009-11-20 13:32:09 -0600
commit9f2d0e1f6615d44c1e7a5ca9b65f6c23d2ac1368 (patch)
treeb28e9b906c1cc402fc8505f96deae8f1120e6f8b
parent4ddfd17c1e67e603c049c6f64684ea795eb6fcf5 (diff)
downloaddct-stuff-9f2d0e1f6615d44c1e7a5ca9b65f6c23d2ac1368.tar.gz
dct-stuff-9f2d0e1f6615d44c1e7a5ca9b65f6c23d2ac1368.tar.xz
dct-stuff-9f2d0e1f6615d44c1e7a5ca9b65f6c23d2ac1368.zip
cpgx: define MAX_NODES 8, 16, 32, 64
can build cpgx to support any of them Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--cpgx/cpgx.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/cpgx/cpgx.c b/cpgx/cpgx.c
index cf228eb..2f70c6c 100644
--- a/cpgx/cpgx.c
+++ b/cpgx/cpgx.c
@@ -48,14 +48,19 @@ static char *exec_name = "aisexec";
static char *exec_name = "corosync";
#endif
-#define NODES16
+#define MAX_NODES 64 /* options 8, 16, 32, 64 */
-#ifdef NODES16
-#define MAX_NODES 16
-#define EVENT_BUF_LEN 60 /* + 4 = 64 */
-#else
-#define MAX_NODES 8
-#define EVENT_BUF_LEN 28 /* + 4 = 32 */
+#if MAX_NODES == 8
+#define EVENT_BUF_LEN 28 /* + 4 = 32 */
+#endif
+#if MAX_NODES == 16
+#define EVENT_BUF_LEN 60 /* + 4 = 64 */
+#endif
+#if MAX_NODES == 32
+#define EVENT_BUF_LEN 124 /* + 4 = 128 */
+#endif
+#if MAX_NODES == 64
+#define EVENT_BUF_LEN 252 /* + 4 = 256 */
#endif
#define CLIENT_NALLOC 2
@@ -92,17 +97,17 @@ struct dct_header {
uint32_t tv_usec;
uint32_t last_config; /* last config eventid we've seen */
uint32_t event_count; /* this many events after header */
-}; /* 28 bytes, 36 bytes */
+}; /* 28 bytes, 36 bytes, 53 bytes, 84 bytes */
struct dct_config {
uint8_t type; /* EV_CONFCHG */
uint8_t memb_count;
uint8_t join_count;
uint8_t left_count;
- uint8_t memb[MAX_NODES];
- uint8_t join[MAX_NODES];
- uint8_t left[MAX_NODES];
-}; /* 28 bytes, 52 bytes */
+ uint8_t memb[MAX_NODES];
+ uint8_t join[MAX_NODES];
+ uint8_t left[MAX_NODES];
+}; /* 28 bytes, 52 bytes, 100 bytes, 196 bytes */
struct event {
uint32_t eventid;
@@ -111,7 +116,7 @@ struct event {
struct dct_config config;
char buf[EVENT_BUF_LEN];
};
-}; /* 32 bytes */
+}; /* 32 bytes, 64 bytes, 128 bytes, 256 bytes */
struct node {
struct list_head list;
@@ -230,9 +235,9 @@ do { \
static void _log_config(struct dct_config *c, uint32_t id, int error)
{
- char m_buf[64];
- char j_buf[64];
- char l_buf[64];
+ char m_buf[256];
+ char j_buf[256];
+ char l_buf[256];
int i, off;
memset(m_buf, 0, sizeof(m_buf));
@@ -1592,7 +1597,6 @@ void restart_cluster(void)
system("killall -9 aisexec");
else
system("killall -9 corosync");
- /* corosync-cfgtool -H would be better if it can work, to avoid ipc leaks */
/* others should see us fail before we rejoin, not sure 10s will
be enough for some people */