All of lore.kernel.org
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager ChangeLog errors.txt init.d/ ...
Date: 7 Sep 2006 18:39:47 -0000	[thread overview]
Message-ID: <20060907183947.27727.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh at sourceware.org	2006-09-07 18:39:45

Modified files:
	rgmanager      : ChangeLog errors.txt 
	rgmanager/init.d: rgmanager 
	rgmanager/src/daemons: main.c 
	rgmanager/src/utils: clustat.c 

Log message:
	2006-09-07 Lon Hohberger <lhh@redhat.com>
	* src/daemons/main.c, init.d/rgmanager: Make rgmanager init script
	report failure correctly in most cases. (#193603)
	* src/utils/clustat.c: Fix #146924 - segfault if cman is not
	in a state to give out member lists

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.20&r2=1.5.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/errors.txt.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.2&r2=1.3.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.17&r2=1.9.2.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/clustat.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.13&r2=1.5.2.14

--- cluster/rgmanager/ChangeLog	2006/06/21 18:34:19	1.5.2.20
+++ cluster/rgmanager/ChangeLog	2006/09/07 18:39:45	1.5.2.21
@@ -1,3 +1,9 @@
+2006-09-07 Lon Hohberger <lhh@redhat.com>
+	* src/daemons/main.c, init.d/rgmanager: Make rgmanager init script
+	report failure correctly in most cases. (#193603)
+	* src/utils/clustat.c: Fix #146924 - segfault if cman is not
+	in a state to give out member lists
+
 2006-06-21 Lon Hohberger <lhh@redhat.com>
 	* src/daemons/nodeevent.c: Don't use the rg thread refcount in
 	node event handling (#194491)
--- cluster/rgmanager/errors.txt	2005/03/21 22:01:30	1.1.2.4
+++ cluster/rgmanager/errors.txt	2006/09/07 18:39:45	1.1.2.5
@@ -76,7 +76,9 @@
 The resource group manager was unable to find a plugin which was able to
 talk to the cluster infrastructure.  Generally, this occurs when no cluster
 infrastruture is running.  Try starting the preferred cluster infrastructure
-for your configuration (e.g. CMAN+DLM, GuLM) and restarting rgmanager.
+for your configuration (e.g. CMAN+DLM, GuLM) and restarting rgmanager.  This
+can also occur if CMAN is loaded, while DLM is not.  Rgmanager (really,
+the SM magma plugin) requires that the DLM be loaded prior to starting.
 
 #10: Couldn't set up listen socket
 
--- cluster/rgmanager/init.d/rgmanager	2006/05/12 21:28:30	1.3.2.2
+++ cluster/rgmanager/init.d/rgmanager	2006/09/07 18:39:45	1.3.2.3
@@ -93,6 +93,7 @@
 
 case $1 in
 	start)
+		[ -z "$RGMGR_OPTS" ] && RGMGR_OPTS="-t 30"
 		echo -n $"Starting $ID: "
 		daemon $RGMGRD $RGMGR_OPTS
 		echo
--- cluster/rgmanager/src/daemons/main.c	2006/05/26 17:39:32	1.9.2.17
+++ cluster/rgmanager/src/daemons/main.c	2006/09/07 18:39:45	1.9.2.18
@@ -706,22 +706,60 @@
 }
 
 
+void
+wait_for_status(int pid, int fd, int timeout)
+{
+	struct timeval tv;
+	fd_set rfds;
+	int err;
+	
+	FD_ZERO(&rfds);
+	FD_SET(fd, &rfds);
+	tv.tv_sec = timeout;
+	tv.tv_usec = 0;
+
+	if (select(fd + 1, &rfds, NULL, NULL, &tv) == 1) {
+		err = 0;
+		read(fd, &err, sizeof(err));
+		exit(!!err);
+		/* could put in messages for waiting */
+	}
+	exit(1);
+}
+
+
+#define notify_status(value) \
+do { \
+	if (waittime) { \
+		waiter = value; \
+		write(waitpipe[1], &waiter, sizeof(waiter)); \
+		close(waitpipe[0]); \
+		close(waitpipe[1]); \
+	} \
+} while(0)
+
+
 int
 main(int argc, char **argv)
 {
 	int cluster_fd, rv;
 	char foreground = 0;
 	int quorate;
-	int listen_fds[2], listeners;
+	int listen_fds[2], listeners, waittime = 0, waitpipe[2];
+	int waiter;
 	uint64_t myNodeID;
 
-	while ((rv = getopt(argc, argv, "fd")) != EOF) {
+	while ((rv = getopt(argc, argv, "fdt:")) != EOF) {
 		switch (rv) {
 		case 'd':
 			debug = 1;
 			break;
 		case 'f':
 			foreground = 1;
+		case 't':
+			waittime = atoi(optarg);
+			if (waittime < 0)
+				waittime = 0;
 		default:
 			break;
 		}
@@ -736,6 +774,16 @@
 		clu_log_console(1);
 
 	if (!foreground && (geteuid() == 0)) {
+		if (waittime) {
+			waitpipe[0] = -1;
+			waitpipe[1] = -1;
+			pipe(waitpipe);
+			waiter = fork();
+			if (waiter > 0)
+				wait_for_status(waiter, waitpipe[0], waittime);
+			/* notreached by parent */
+		}
+			
 		daemon_init(argv[0]);
 		if (!debug && !watchdog_init())
 			clulog(LOG_NOTICE, "Failed to start watchdog\n");
@@ -756,6 +804,7 @@
 
 	if (init_resource_groups(0) != 0) {
 		clulog(LOG_CRIT, "#8: Couldn't initialize services\n");
+		notify_status(1);
 		return -1;
 	}
 
@@ -766,6 +815,7 @@
 	if (cluster_fd < 0) {
 		clu_log_console(1);
 		clulog(LOG_CRIT, "#9: Couldn't connect to cluster\n");
+		notify_status(2);
 		return -1;
 	}
    	msg_set_purpose(cluster_fd, MSGP_CLUSTER);
@@ -786,6 +836,7 @@
 	if ((listeners = msg_listen(RG_PORT, RG_PURPOSE,
 				    listen_fds, 2)) <= 0) {
 		clulog(LOG_CRIT, "#10: Couldn't set up listen socket\n");
+		notify_status(3);
 		return -1;
 	}
 
@@ -810,6 +861,7 @@
 	 */
 	if (vf_init(myNodeID, RG_VF_PORT, NULL, NULL) != 0) {
 		clulog(LOG_CRIT, "#11: Couldn't set up VF listen socket\n");
+		notify_status(4);
 		return -1;
 	}
 
@@ -839,6 +891,8 @@
 	/*
 	   Do everything useful
 	 */
+	notify_status(0);
+
 	while (running)
 		event_loop(cluster_fd);
 
--- cluster/rgmanager/src/utils/clustat.c	2006/05/26 15:32:00	1.5.2.13
+++ cluster/rgmanager/src/utils/clustat.c	2006/09/07 18:39:45	1.5.2.14
@@ -486,6 +486,11 @@
 {
 	int x;
 
+	if (!membership) {
+		printf("Membership information not available\n");
+		return;
+	}
+
 	printf("  %-40.40s %s\n", "Member Name", "Status");
 	printf("  %-40.40s %s\n", "------ ----", "------");
 
@@ -504,8 +509,10 @@
 {
 	int x;
 
-	if (!membership)
+	if (!membership) {
+		printf("  <nodes/>\n");
 		return;
+	}
 
 	printf("  <nodes>\n");
 	for (x = 0; x < membership->cml_count; x++) {
@@ -608,6 +615,10 @@
 	/* Grab the local node ID and flag it from the list of reported
 	   online nodes */
 	clu_local_nodeid(NULL, lid);
+
+	if (!all)
+		return NULL;
+
 	for (x=0; x<all->cml_count; x++) {
 		if (all->cml_members[x].cm_id == *lid) {
 			m = &all->cml_members[x];



             reply	other threads:[~2006-09-07 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-07 18:39 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-03 16:30 [Cluster-devel] cluster/rgmanager ChangeLog errors.txt init.d/ lhh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060907183947.27727.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.