cluster: RHEL62 - cmannotifyd: deliver cluster status at startup and fix daemon init

Fabio M. Di Nitto fabbione at fedoraproject.org
Wed May 9 18:30:34 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=188a980e506b14cfdf94de9129360dd10f5a53d6
Commit:        188a980e506b14cfdf94de9129360dd10f5a53d6
Parent:        17bacf59aea4f2d021ba8127f71e9d840703b692
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Tue May 8 14:22:25 2012 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Wed May 9 20:30:14 2012 +0200

cmannotifyd: deliver cluster status at startup and fix daemon init

cmannotifyd is very often (if not always) started _after_ cman is
completely settled. That means cmannotifyd does not receive/dispatch
any notifications on the current cluster status at startup.

change cman connection loop to generate a fake notification that
config and membership have changed (we can't poll if they did)
and use those information internally too, to reinit logging with
new cman connection.

Resolves: rhbz#820357

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
Reviewed-by: Lon Hohberger <lhh at redhat.com>
---
 cman/notifyd/main.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/cman/notifyd/main.c b/cman/notifyd/main.c
index d5c90c5..a5fe323 100644
--- a/cman/notifyd/main.c
+++ b/cman/notifyd/main.c
@@ -201,6 +201,10 @@ static void init_logging(int reconf)
 		ccs_read_logging(ccs_handle, "cmannotifyd", &debug, &mode,
 				 &syslog_facility, &syslog_priority, &logfile_priority, logfile);
 		ccs_disconnect(ccs_handle);
+	} else {
+		if (debug) {
+			logfile_priority = LOG_DEBUG;
+		}
 	}
 
 	if (!daemonize)
@@ -320,6 +324,8 @@ static void byebye_cman(void)
 static void setup_cman(int forever)
 {
 	int init = 0, active = 0;
+	int quorate;
+	const char *str = NULL;
 
 retry_init:
 	cman_handle = cman_init(NULL);
@@ -355,6 +361,14 @@ retry_active:
 		exit(EXIT_FAILURE);
 	}
 
+	logt_print(LOG_DEBUG, "Dispatching first cluster status\n");
+	init_logging(1);
+	str = "CMAN_REASON_CONFIG_UPDATE";
+	dispatch_notification(str, 0);
+	str = "CMAN_REASON_STATECHANGE";
+	quorate = cman_is_quorate(cman_handle);
+	dispatch_notification(str, &quorate);
+
 	return;
 
 out:


More information about the cluster-commits mailing list