public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - rgmanager: Wait for fence domain join to complete
@ 2008-08-28 20:55 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2008-08-28 20:55 UTC (permalink / raw)
  To: cluster-cvs-relay

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.
  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-28 20:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 20:55 RHEL5 - rgmanager: Wait for fence domain join to complete Lon Hohberger

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).