This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
STABLE2 - rgmanager: Wait for fence domain join to complete
- From: Lon Hohberger <lon at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Mon, 22 Sep 2008 15:47:31 +0000 (UTC)
- Subject: STABLE2 - rgmanager: Wait for fence domain join to complete
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=573ebbb8ff9839a353d98fbbfbd306b43c49f623
Commit: 573ebbb8ff9839a353d98fbbfbd306b43c49f623
Parent: 48a7f1f03296474e017e970af02463d2aae52983
Author: Lon Hohberger <lhh@redhat.com>
AuthorDate: Thu Aug 28 16:53:11 2008 -0400
Committer: Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Sep 22 11:17:42 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 89bdcd1..0c168f5 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -42,6 +42,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;
@@ -892,7 +895,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");
}
}
@@ -1001,6 +1022,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 af3bf08..fc5b1cb 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -157,6 +157,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.
*/