From: "Fabio M. Di Nitto" <fdini...@redhat.com>

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 <fdini...@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:
-- 
1.7.7.6

Reply via email to