public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: RHEL5 - rgmanager: Wait for fence domain join to complete
Date: Thu, 28 Aug 2008 20:55:00 -0000	[thread overview]
Message-ID: <20080828205408.BD43912037A@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=6417845e62ce91d9e5d188ef0be4b605b64007ea
Commit:        6417845e62ce91d9e5d188ef0be4b605b64007ea
Parent:        f92fd23fde054edc4585145e5b7122c1addb95b4
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Aug 28 16:53:11 2008 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Thu Aug 28 16:53:54 2008 -0400

rgmanager: Wait for fence domain join to complete

rhbz 459754, take 3
---
 rgmanager/src/daemons/main.c     |   25 ++++++++++++++++++++++++-
 rgmanager/src/daemons/rg_event.c |   14 ++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 8401bca..b722ab2 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -60,6 +60,9 @@ int svc_exists(char *);
 int watchdog_init(void);
 int32_t master_event_callback(char *key, uint64_t viewno, void *data, uint32_t datalen);
 
+int node_has_fencing(int nodeid);
+int fence_domain_joined(void);
+
 int shutdown_pending = 0, running = 1, need_reconfigure = 0;
 char debug = 0; /* XXX* */
 static int signalled = 0;
@@ -909,7 +912,25 @@ clu_initialize(cman_handle_t *ch)
 		while (cman_is_quorate(*ch) == 0) {
 			sleep(1);
 		}
-		clulog(LOG_NOTICE, "Quorum formed, starting\n");
+		clulog(LOG_NOTICE, "Quorum formed\n");
+	}
+
+}
+
+
+void
+wait_for_fencing(void)
+{
+        if (node_has_fencing(my_id()) && !fence_domain_joined()) {
+		clulog(LOG_INFO, "Waiting for fence domain join operation "
+		       "to complete\n");
+
+		while (fence_domain_joined() == 0)
+			sleep(1);
+		clulog(LOG_INFO, "Fence domain joined\n");
+	} else {
+		clulog(LOG_DEBUG, "Fence domain already joined "
+		       "or no fencing configured\n");
 	}
 }
 
@@ -1018,6 +1039,8 @@ main(int argc, char **argv)
 
 	clulog(LOG_INFO, "I am node #%d\n", my_id());
 
+	wait_for_fencing();
+
 	/*
 	   We know we're quorate.  At this point, we need to
 	   read the resource group trees from ccsd.
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
index f614668..7df0e6c 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -174,6 +174,20 @@ node_has_fencing(int nodeid)
 }
 
 
+/* Since the API for groupd is private, use group_tool to find
+   out if we've joined the fence domain */ 
+int
+fence_domain_joined(void)
+{
+	int rv;
+
+	rv = system("group_tool ls fence default &> /dev/null");	
+	if (rv == 0)
+		return 1;
+	return 0;
+}
+
+
 /**
    Quick query to cman to see if a node has been fenced.
  */


                 reply	other threads:[~2008-08-28 20:55 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=20080828205408.BD43912037A@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@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 read-only IMAP folder(s) and NNTP newsgroup(s).