public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - fenced/fence_tool: improve list info
@ 2008-09-26  8:39 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2008-09-26  8:39 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=20b4a54a7518aff0132c0692c4a2a15c7dd99109
Commit:        20b4a54a7518aff0132c0692c4a2a15c7dd99109
Parent:        66373d911c63c3077d3b00b57cf0e76a78844961
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Thu Sep 25 16:18:17 2008 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu Sep 25 16:20:16 2008 -0500

fenced/fence_tool: improve list info

Add wait condition to the output, and make the current victim
visible for the full duration of fencing.

Signed-off-by: David Teigland <teigland@redhat.com>
---
 fence/fence_tool/fence_tool.c |   17 +++++++++++++++++
 fence/fenced/cpg.c            |    9 +++++++--
 fence/fenced/recover.c        |   10 +++++-----
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c
index 1c44b54..ec470c1 100644
--- a/fence/fence_tool/fence_tool.c
+++ b/fence/fence_tool/fence_tool.c
@@ -371,6 +371,22 @@ static int node_compare(const void *va, const void *vb)
 	return a->nodeid - b->nodeid;
 }
 
+#define CGST_WAIT_CONDITIONS    1
+#define CGST_WAIT_MESSAGES      2
+
+static char *wait_str(int state)
+{
+	switch (state) {
+	case 0:
+		return "none";
+	case CGST_WAIT_CONDITIONS:
+		return "quorum";
+	case CGST_WAIT_MESSAGES:
+		return "messages";
+	}
+	return "unknown";
+}
+
 static int do_list(void)
 {
 	struct fenced_domain d;
@@ -387,6 +403,7 @@ static int do_list(void)
 	printf("victim count  %d\n", d.victim_count);
 	printf("victim now    %d\n", d.current_victim);
 	printf("master nodeid %d\n", d.master_nodeid);
+	printf("wait state    %s\n", wait_str(d.state));
 	printf("members       ");
 
 	node_count = 0;
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 05308a6..936f787 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -1897,12 +1897,17 @@ int set_node_info(struct fd *fd, int nodeid, struct fenced_node *nodeinfo)
 
 int set_domain_info(struct fd *fd, struct fenced_domain *domain)
 {
-	struct change *cg = fd->started_change;
+	struct change *cg;
 
-	if (cg) {
+	if (list_empty(&fd->changes)) {
+		if (fd->started_change)
+			domain->member_count = fd->started_change->member_count;
+	} else {
+		cg = list_first_entry(&fd->changes, struct change, list);
 		domain->member_count = cg->member_count;
 		domain->state = cg->state;
 	}
+
 	domain->master_nodeid = fd->master;
 	domain->victim_count = list_count(&fd->victims);
 	domain->current_victim = fd->current_victim;
diff --git a/fence/fenced/recover.c b/fence/fenced/recover.c
index ecb13d5..1c8eaa6 100644
--- a/fence/fenced/recover.c
+++ b/fence/fenced/recover.c
@@ -241,6 +241,9 @@ void fence_victims(struct fd *fd)
 	while (!list_empty(&fd->victims)) {
 		node = list_entry(fd->victims.next, struct node, list);
 
+		/* for queries */
+		fd->current_victim = node->nodeid;
+
 		cman_member = is_cman_member(node->nodeid);
 		cpg_member = in_daemon_member_list(node->nodeid);
 		if (group_mode == GROUP_LIBCPG)
@@ -261,15 +264,10 @@ void fence_victims(struct fd *fd)
 
 		log_level(LOG_INFO, "fencing node \"%s\"", node->name);
 
-		/* for queries */
-		fd->current_victim = node->nodeid;
-
 		query_unlock();
 		error = fence_node(node->name);
 		query_lock();
 
-		fd->current_victim = 0;
-
 		log_level(LOG_INFO, "fence \"%s\" %s", node->name,
 			  error ? "failed" : "success");
 
@@ -301,5 +299,7 @@ void fence_victims(struct fd *fd)
 		close_override(&override, cfgd_override_path);
 		query_lock();
 	}
+
+	fd->current_victim = 0;
 }
 


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

only message in thread, other threads:[~2008-09-25 21:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-26  8:39 master - fenced/fence_tool: improve list info 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).