[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/rgmanager ChangeLog include/resgroup.h ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh sourceware org	2006-10-06 21:22:28

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/include: resgroup.h 
	rgmanager/src/daemons: groups.c main.c 
	rgmanager/src/utils: clustat.c 

Log message:
	Fix #202497

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/resgroup.h.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&r1=1.23&r2=1.24

--- cluster/rgmanager/ChangeLog	2006/09/27 18:58:53	1.27
+++ cluster/rgmanager/ChangeLog	2006/10/06 21:22:27	1.28
@@ -1,3 +1,13 @@
+2006-10-06 Lon Hohberger <lhh at redhat.com>
+	* src/daemons/main.c: Fix #202497: provide rgmanager's view of
+	who is running rgmanager to clustat.
+	* src/daemons/groups.c: Fix tiny memory leak during configuration
+	changes
+	* include/resgroup.h: #202497: Flip unused RG_STATUS_INQUIRY to
+	RG_STATUS_NODE.
+	* src/utils/clustat.c: #202497: Send RG_STATUS_NODE to clurgmgrd
+	in order to obtain rgmanager "group" status information
+
 2006-09-27 Lon Hohberger <lhh at redhat.com>
 	* src/daemons/rg_state.c: Fix #208011 - failed->disabled state 
 	transition.  Fix node ID type.
--- cluster/rgmanager/include/resgroup.h	2006/09/01 19:02:21	1.14
+++ cluster/rgmanager/include/resgroup.h	2006/10/06 21:22:27	1.15
@@ -68,7 +68,7 @@
 #define RG_EXITING	  9 
 #define RG_INIT		  10
 #define RG_ENABLE	  11
-#define RG_STATUS_INQUIRY 12
+#define RG_STATUS_NODE	  12
 #define RG_RELOCATE	  13
 #define RG_CONDSTOP	  14
 #define RG_CONDSTART	  15
--- cluster/rgmanager/src/daemons/groups.c	2006/09/27 16:28:41	1.23
+++ cluster/rgmanager/src/daemons/groups.c	2006/10/06 21:22:27	1.24
@@ -1228,6 +1228,7 @@
 		pthread_mutex_lock(&config_mutex);
 		config_version = atoi(val);
 		pthread_mutex_unlock(&config_mutex);
+		free(val);
 	}
 
 	clulog(LOG_DEBUG, "Building Resource Trees\n");
--- cluster/rgmanager/src/daemons/main.c	2006/09/27 16:28:41	1.32
+++ cluster/rgmanager/src/daemons/main.c	2006/10/06 21:22:27	1.33
@@ -87,6 +87,26 @@
 
 
 void
+send_node_states(msgctx_t *ctx)
+{
+	int x;
+	generic_msg_hdr hdr;
+	cluster_member_list_t *ml = member_list();
+
+	for (x = 0; x < ml->cml_count; x++) {
+		if (ml->cml_members[x].cn_member == 1) {
+			msg_send_simple(ctx, RG_STATUS_NODE,
+					ml->cml_members[x].cn_nodeid, 0);
+		}
+	}
+	msg_send_simple(ctx, RG_SUCCESS,
+			ml->cml_members[x].cn_nodeid, 0);
+	msg_receive(ctx, &hdr, sizeof(hdr), 10);
+	free_member_list(ml);
+}
+
+
+void
 flag_reconfigure(int sig)
 {
 	need_reconfigure++;
@@ -417,8 +437,13 @@
 	switch (msg_hdr->gh_command) {
 	case RG_STATUS:
 		clulog(LOG_DEBUG, "Sending service states to CTX%p\n",ctx);
-		send_rg_states(ctx, msg_hdr->gh_arg1);
-		need_close = 0;
+		if (send_rg_states(ctx, msg_hdr->gh_arg1) == 0)
+			need_close = 0;
+		break;
+
+	case RG_STATUS_NODE:
+		clulog(LOG_DEBUG, "Sending node states to CTX%p\n",ctx);
+		send_node_states(ctx);
 		break;
 
 	case RG_LOCK:
--- cluster/rgmanager/src/utils/clustat.c	2006/09/27 16:43:39	1.23
+++ cluster/rgmanager/src/utils/clustat.c	2006/10/06 21:22:28	1.24
@@ -43,6 +43,94 @@
 } rg_state_list_t;
 
 
+void
+flag_rgmanager_nodes(cluster_member_list_t *cml)
+{
+	msgctx_t ctx;
+	int max = 0, n;
+	generic_msg_hdr *msgp;
+	fd_set rfds;
+
+	struct timeval tv;
+
+	if (msg_open(MSG_SOCKET, 0, 0, &ctx, 10) < 0)
+		return;
+
+	msg_send_simple(&ctx, RG_STATUS_NODE, 0, 0);
+
+	while (1) {
+		FD_ZERO(&rfds);
+		msg_fd_set(&ctx, &rfds, &max);
+		tv.tv_sec = 10;
+		tv.tv_usec = 0;
+
+		n = select(max+1, &rfds, NULL, NULL, &tv);
+		if (n == 0) {
+			fprintf(stderr, "Timed out waiting for a response "
+				"from Resource Group Manager\n");
+			break;
+		}
+
+		if (n < 0) {
+			if (errno == EAGAIN ||
+			    errno == EINTR)
+				continue;
+			fprintf(stderr, "Failed to receive "
+				"service data: select: %s\n",
+				strerror(errno));
+			break;
+		}
+
+		n = msg_receive_simple(&ctx, &msgp, tv.tv_sec);
+
+		if (n < 0) {
+			if (errno == EAGAIN)
+				continue;
+			perror("msg_receive_simple");
+			break;
+		}
+	        if (n < sizeof(generic_msg_hdr)) {
+			printf("Error: Malformed message\n");
+			break;
+		}
+
+		if (!msgp) {
+			printf("Error: no message?!\n");
+			break;
+		}
+
+		swab_generic_msg_hdr(msgp);
+
+		if (msgp->gh_command == RG_FAIL) {
+			printf("Member states unavailable: %s\n", 
+			       rg_strerror(msgp->gh_arg1));
+			free(msgp);
+			msg_close(&ctx);
+			return;
+		}	
+
+		if (msgp->gh_command == RG_SUCCESS) {
+			free(msgp);
+			break;
+		}
+
+		for (n = 0; n < cml->cml_count; n++) {
+			if (cml->cml_members[n].cn_nodeid != msgp->gh_arg1)
+				continue;
+			cml->cml_members[n].cn_member |= FLAG_RGMGR;
+		}
+
+		free(msgp);
+		msgp = NULL;
+	}
+
+	msg_send_simple(&ctx, RG_SUCCESS, 0, 0);
+	msg_close(&ctx);
+
+	return;
+}
+
+
 rg_state_list_t *
 rg_state_list(int local_node_id, int fast)
 {
@@ -791,6 +879,9 @@
 		membership = build_member_list(ch, &local_node_id);
 		
 		rgs = rg_state_list(local_node_id, fast);
+		if (rgs) {
+			flag_rgmanager_nodes(membership);
+		}
 
 		if (refresh_sec) {
 			setupterm((char *) 0, STDOUT_FILENO, (int *) 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]