public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - fenced: kill the cluster on misbehaving nodes
@ 2008-08-19 21:28 David Teigland
0 siblings, 0 replies; only message in thread
From: David Teigland @ 2008-08-19 21:28 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=55e768917ecd4e3e252d5606c10f9cf0dda54d94
Commit: 55e768917ecd4e3e252d5606c10f9cf0dda54d94
Parent: 34679f895b267f6efdfa83a63aa65d09e631d5ed
Author: David Teigland <teigland@redhat.com>
AuthorDate: Tue Aug 19 16:09:18 2008 -0500
Committer: David Teigland <teigland@redhat.com>
CommitterDate: Tue Aug 19 16:09:18 2008 -0500
fenced: kill the cluster on misbehaving nodes
Kill cman on other nodes where the fenced process fails.
Signed-off-by: David Teigland <teigland@redhat.com>
---
fence/fenced/cpg.c | 3 +++
fence/fenced/fd.h | 1 +
fence/fenced/member_cman.c | 22 ++++++++++++++++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 1a0ff17..ccebbd9 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -1069,6 +1069,9 @@ static int add_change(struct fd *fd,
log_debug("add_change %u nodeid %d remove reason %d",
cg->seq, memb->nodeid, left_list[i].reason);
+
+ if (left_list[i].reason == CPG_REASON_PROCDOWN)
+ kick_node_from_cluster(memb->nodeid);
}
for (i = 0; i < joined_list_entries; i++) {
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
index 96c8a1d..21cac39 100644
--- a/fence/fenced/fd.h
+++ b/fence/fenced/fd.h
@@ -249,6 +249,7 @@ int is_cman_member(int nodeid);
char *nodeid_to_name(int nodeid);
int name_to_nodeid(char *name);
struct node *get_new_node(struct fd *fd, int nodeid);
+void kick_node_from_cluster(int nodeid);
/* recover.c */
diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c
index 7820d64..16e08a8 100644
--- a/fence/fenced/member_cman.c
+++ b/fence/fenced/member_cman.c
@@ -5,9 +5,21 @@
#define BUFLEN MAX_NODENAME_LEN+1
static cman_handle_t ch;
+static cman_handle_t ch_admin;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+void kick_node_from_cluster(int nodeid)
+{
+ if (!nodeid) {
+ log_error("telling cman to shut down cluster locally");
+ cman_shutdown(ch_admin, CMAN_SHUTDOWN_ANYWAY);
+ } else {
+ log_error("telling cman to remove nodeid %d from cluster",
+ nodeid);
+ cman_kill_node(ch_admin, nodeid);
+ }
+}
static int name_equal(char *name1, char *name2)
{
@@ -146,12 +158,18 @@ int setup_cman(void)
int init = 0, active = 0;
retry_init:
- ch = cman_init(NULL);
- if (!ch) {
+ ch_admin = cman_admin_init(NULL);
+ if (!ch_admin) {
if (init++ < 2) {
sleep(1);
goto retry_init;
}
+ log_error("cman_admin_init error %d", errno);
+ return -ENOTCONN;
+ }
+
+ ch = cman_init(NULL);
+ if (!ch) {
log_error("cman_init error %d", errno);
return -ENOTCONN;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-19 21:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-19 21:28 master - fenced: kill the cluster on misbehaving nodes David Teigland
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).