Skip to contentSkip to conversation

cluster/rgmanager ChangeLog include/cman-priva ...

Cluster-devel [email protected] 1 participant 1 message Aug 7, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2006-08-07 22:05:02

Modified files:
rgmanager : ChangeLog
rgmanager/include: cman-private.h message.h rgmanager/src/clulib: alloc.c cman.c message.c msg_cluster.c
msgtest.c vft.c
rgmanager/src/daemons: main.c rg_forward.c rg_state.c rgmanager/src/utils: clustat.c
Added files:
rgmanager/src/clulib: ckpt_state.c

Log message:
* src/clulib/ckpt_state.c: Preliminary implementation of replacement for VF using AIS CKPT B.02.01 (w/ built-in test program)
* include/cman-private.h: Clean up APIs (cman APIs return cman_handle_t, which is void*, should be using void ** all over)
* include/message.h: Bump context count to 128, add destination node ID in header of packets.
* src/clulib/alloc.c: If we alloc the same size, return the same block
* src/clulib/cman.c: API cleanups
* src/clulib/message.c: Add error checking to msg_print
* src/clulib/msg_cluster.c: Check destination in header before processing message remove dup #define for MAX_CONTEXTS, add proto_error() macro for displaying protocol errors. Use 'max' instead of 'fd' for select(). Use correct var when assigning contexts. Fix CMAN handles. Return correct size from msg_send() requests.
* src/clulib/msgtest.c: Fix CMAN handles
* src/clulib/vft.c: Don't handle VF_CURRENT inside comms thread
* src/daemons/main.c: Check to see if nodes are listening on our port before we consider them running. Handle VF_CURRENT requests from other nodes. Fail if we can't determine local node ID
* src/daemons/rg_forward.c: Give 10 minutes for responses to forwarded requests.
* src/daemons/rg_state.c: Shorten RG state names. Fix 'Uncertain' output line.
* src/utils/clustat.c: Fix ccs_member_list() function.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/cman-private.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/message.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/ckpt_state.c.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/alloc.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/cman.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/message.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/msg_cluster.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/msgtest.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/vft.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_forward.c.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_state.c.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&r1=1.18&r2=1.19

rgmanager/ChangeLog +28 -0
@@ -1,3 +1,31 @@
+2006-08-07 Lon Hohberger <[email protected]>
+	* src/clulib/ckpt_state.c: Preliminary implementation of replacement
+	for VF using AIS CKPT B.02.01 (w/ built-in test program)
+	* include/cman-private.h: Clean up APIs (cman APIs return
+	cman_handle_t, which is void*, should be using void ** all over)
+	* include/message.h: Bump context count to 128, add destination
+	node ID in header of packets.
+	* src/clulib/alloc.c: If we alloc the same size, return the same
+	block
+	* src/clulib/cman.c: API cleanups
+	* src/clulib/message.c: Add error checking to msg_print
+	* src/clulib/msg_cluster.c: Check destination in header before 
+        processing message remove dup #define for MAX_CONTEXTS, add
+	proto_error() macro for displaying protocol errors.  Use 'max' 
+	instead of 'fd' for select().  Use correct var when assigning
+	contexts.  Fix CMAN handles.  Return correct size from msg_send()
+	requests.
+	* src/clulib/msgtest.c: Fix CMAN handles
+	* src/clulib/vft.c: Don't handle VF_CURRENT inside comms thread
+	* src/daemons/main.c: Check to see if nodes are listening on our
+	port before we consider them running.  Handle VF_CURRENT requests
+	from other nodes.  Fail if we can't determine local node ID
+	* src/daemons/rg_forward.c: Give 10 minutes for responses to
+	forwarded requests.
+	* src/daemons/rg_state.c: Shorten RG state names.  Fix 'Uncertain'
+	output line.
+	* src/utils/clustat.c: Fix ccs_member_list() function.
+
 2006-05-23 Lon Hohberger <[email protected]>
 	* src/daemons/members.c: Zap pad fields on copy-out
 	* src/daemons/main.c: Give notice if skipping an event because of
rgmanager/include/cman-private.h +4 -4
@@ -3,11 +3,11 @@
 
 #include <libcman.h>
 
-int cman_init_subsys(cman_handle_t *ch);
-cman_handle_t *cman_lock(int block, int sig);
-cman_handle_t *cman_lock_preemptible(int block, int *fd);
+int cman_init_subsys(cman_handle_t ch);
+cman_handle_t cman_lock(int block, int sig);
+cman_handle_t cman_lock_preemptible(int block, int *fd);
 int cman_cleanup_subsys(void);
-int cman_unlock(cman_handle_t *ch);
+int cman_unlock(cman_handle_t ch);
 int cman_send_data_unlocked(void *buf, int len, int flags,
 			    uint8_t port, int nodeid);
 
rgmanager/include/message.h +8 -4
@@ -30,14 +30,17 @@
 
 /* Header is never presented to applications */
 typedef struct {
-	uint32_t	dest_ctx;
 	uint32_t	src_ctx;
-	/* 8 */
 	uint32_t	src_nodeid;
+	/* 8 */
+	uint32_t	dest_ctx;
+	uint32_t	dest_nodeid;
+	/* 16 */
 	uint8_t		msg_control;
 	uint8_t		msg_port;
 	uint8_t		pad[2];
-	/* 16 */
+	/* 20 */
+	uint8_t		msg_reserved[12];
 } cluster_msg_hdr_t;
 
 /* Header is never presented to applications */
@@ -62,6 +65,7 @@
 	swab32((ptr)->dest_ctx);\
 	swab32((ptr)->src_ctx);\
 	swab32((ptr)->src_nodeid);\
+	swab32((ptr)->dest_nodeid);\
 }
 
 
@@ -123,7 +127,7 @@
 
 
 /* Ripped from ccsd's setup_local_socket */
-#define MAX_CONTEXTS 32  /* Testing; production should be 1024-ish */
+#define MAX_CONTEXTS 128  /* Testing; production should be 1024-ish */
 
 #define SKF_LISTEN (1<<0)
 #define SKF_READ   (1<<1)

/cvs/cluster/cluster/rgmanager/src/clulib/ckpt_state.c,v --> standard output revision 1.1

- renamed from rgmanager/src/clulib/ckpt_state.c +550 -0

550 lines not on this page · raw message

rgmanager/src/clulib/alloc.c +6 -0
@@ -885,6 +885,12 @@
 #endif
 	void *newp;
 
+	if (oldp) {
+		oldb = block(oldp);
+		if (newsize <= oldb->mb_size)
+			return oldp;
+	}
+
 	newp = malloc(newsize);
 
 	if (!newp) {
rgmanager/src/clulib/cman.c +4 -4
@@ -32,7 +32,7 @@
 #include <sys/socket.h>
 #include <fcntl.h>
 
-static cman_handle_t *_chandle = NULL;
+static cman_handle_t _chandle = NULL;
 static pthread_mutex_t _chandle_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t _chandle_cond = PTHREAD_COND_INITIALIZER;
 static pthread_t _chandle_holder = 0;
@@ -60,7 +60,7 @@
   @return		NULL / errno on failure; the global CMAN handle
 			on success.
  */
-cman_handle_t *
+cman_handle_t 
 cman_lock(int block, int preempt)
 {
 	pthread_t tid;
@@ -110,7 +110,7 @@
   @return		NULL / errno on failure; the global CMAN handle
 			on success.
  */
-cman_handle_t *
+cman_handle_t
 cman_lock_preemptible(int block, int *preempt_fd)
 {
 	pthread_t tid;
@@ -160,7 +160,7 @@
   @return		-1 on failure, 0 on success
  */
 int
-cman_unlock(cman_handle_t *ch)
+cman_unlock(cman_handle_t ch)
 {
 	int ret = -1;
 	char c;
rgmanager/src/clulib/message.c +9 -0
@@ -251,8 +251,17 @@
 void
 msg_print(msgctx_t *ctx)
 {
+	if (!ctx) {
+		printf("Attempt to call %s on NULL\n", __FUNCTION__);
+		return;
+	}
+
 	if (ctx->ops && ctx->ops->mo_print)
 		return ctx->ops->mo_print(ctx);
+
+	printf("Warning: Attempt to call %s on uninitialized context %p\n",
+	       __FUNCTION__, ctx);
+	printf("  ctx->type = %d\n", ctx->type);
 }
 
 
rgmanager/src/clulib/msg_cluster.c +86 -19

244 lines not on this page · raw message

rgmanager/src/clulib/msgtest.c +19 -8
@@ -28,7 +28,7 @@
 #include <signal.h>
 #include <cman-private.h>
 
-#define MYPORT 190
+#define MYPORT 67
 
 int my_node_id = 0;
 int running = 1;
@@ -121,7 +121,7 @@
 
 
 void
-clu_initialize(cman_handle_t **ch)
+clu_initialize(cman_handle_t *ch)
 {
 	if (!ch)
 		exit(1);
@@ -198,23 +198,34 @@
 	pthread_t piggy, priv;
 	fd_set rfds;
 	int max = 0;
-	int port = MYPORT;
-	cman_handle_t *clu = NULL;
+	uint8_t port = MYPORT;
+	cman_handle_t clu = NULL;
 
 
 	clu_initialize(&clu);
 
+	if (clu == NULL) {
+		printf("Failed to connect to CMAN\n");
+	}
+
 	if (cman_init_subsys(clu) < 0) {
 		perror("cman_init_subsys");
 		return -1;
 	}
-        cman_get_node(clu, CMAN_NODEID_US, &me);
+
+	memset(&me, 0, sizeof(me));
+
+        if (cman_get_node(clu, CMAN_NODEID_US, &me) < 0) {
+		perror("cman_get_node");
+		return -1;
+	}
 
 	my_node_id = me.cn_nodeid;
+	printf("I am node ID %d\n", my_node_id);
 
-	if (msg_listen(MSG_CLUSTER, (void *)&port,
-	    me.cn_nodeid, &cluster_ctx) < 0) {
-		printf("Couldn't set up cluster message system\n");
+	if (msg_listen(MSG_CLUSTER, (void *)&port, me.cn_nodeid, &cluster_ctx) < 0) {
+		printf("Couldn't set up cluster message system: %s\n",
+			strerror(errno));
 		return -1;
 	}
 
rgmanager/src/clulib/vft.c +2 -1
@@ -819,7 +819,8 @@
 		}
 
 		swab_generic_msg_hdr(hdrp);
-		if (hdrp->gh_command == VF_MESSAGE) {
+		if (hdrp->gh_command == VF_MESSAGE &&
+		    hdrp->gh_arg1 != VF_CURRENT) {
 			if (vf_process_msg(ctx, 0, hdrp, n) == VFR_COMMIT) {
 #ifdef DEBUG
 				printf("VFT: View committed\n");
rgmanager/src/daemons/main.c +69 -9

157 lines not on this page · raw message

rgmanager/src/daemons/rg_forward.c +1 -1
@@ -91,7 +91,7 @@
 		pthread_exit(NULL);
 	}
 
-	if (msg_receive(&ctx, &msg, sizeof(msg),10) != sizeof(msg)) {
+	if (msg_receive(&ctx, &msg, sizeof(msg), 600) != sizeof(msg)) {
 		msg_close(&ctx);
 		msg_close(req->rr_resp_ctx);
 		msg_free_ctx(req->rr_resp_ctx);
rgmanager/src/daemons/rg_state.c +73 -16

190 lines not on this page · raw message

rgmanager/src/utils/clustat.c +12 -9
@@ -168,24 +168,31 @@
 	while ((ret = malloc(sizeof(*ret))) == NULL)
 		sleep(1);
 	
-	x = 1;
-	while (1) {
+	x = 0;
+	while (++x) {
+		name = NULL;
 		snprintf(buf, sizeof(buf),
 			"/cluster/clusternodes/clusternode[%d]/@name", x);
 
 		if (ccs_get(desc, buf, &name) != 0)
 			break;
 
+		if (!name)
+			break;
+		if (!strlen(name)) {
+			free(name);
+			continue;
+		}
+
 		if (!nodes) {
 			nodes = malloc(x * sizeof(cman_node_t));
-			if (!nodes ) {
+			if (!nodes) {
 				perror("malloc");
 				ccs_disconnect(desc);
 				exit(1);
 			}
-			memset(nodes, 0, x * sizeof(cman_node_t));
 		} else {
-			nodes = realloc(ret, x * sizeof(cman_node_t));
+			nodes = realloc(nodes, x * sizeof(cman_node_t));
 			if (!nodes) {
 				perror("realloc");
 				ccs_disconnect(desc);
@@ -207,14 +214,11 @@
 		}
 
 		ret->cml_count = x;
-		++x;
 	}
 
 	ccs_disconnect(desc);
-
 	ret->cml_members = nodes;
 
-
 	return ret;
 }
 
@@ -615,7 +619,6 @@
 
 		/* Flag online nodes */
 		flag_nodes(all, part, FLAG_UP);
-
 		free_member_list(part);
 	} else {
 		/* not root - keep it simple for the next block */