cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] cmannotifyd: deliver cluster status at startup and fix daemon init
Date: Tue,  8 May 2012 14:29:15 +0200	[thread overview]
Message-ID: <1336480155-6230-1-git-send-email-fdinitto@redhat.com> (raw)

From: "Fabio M. Di Nitto" <fdinitto@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 <fdinitto@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	other threads:[~2012-05-08 12:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1336480155-6230-1-git-send-email-fdinitto@redhat.com \
    --to=fdinitto@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).