Skip to contentSkip to conversation

cmannotifyd: deliver cluster status at startup and fix daemon init

PATCH New Fabio M. Di Nitto 1 participant 1 message May 8, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmannotifyd: deliver cluster status at startup and fix daemon init

From: "Fabio M. Di Nitto" <[email protected]>

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#819787

---
 cman/notifyd/main.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
cman/notifyd/main.c +14 -0
index 3091d2f..4a9f868 100644
@@ -189,6 +189,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)
@@ -311,6 +315,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);
@@ -346,6 +352,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:
Signature · 1 line
1.7.7.6