Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=63…
Commit: 6329b3688fca66f5821dedb3f98268c06d2ef122
Parent: dcdb07c5d999d5f4b567a253268c71a14c5475cb
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue May 8 14:22:25 2012 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue May 8 14:22:25 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#819787
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)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 3091d2f..4a9f868 100644
--- a/cman/notifyd/main.c
+++ b/cman/notifyd/main.c
@@ -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: