This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cluster Project branch, master, updated. cluster-2.99.00-3-g10e2bab


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=10e2bab755c36ffa73988e6e731b667dafa9c169

The branch, master has been updated
       via  10e2bab755c36ffa73988e6e731b667dafa9c169 (commit)
      from  1fece51155f0df4e1524dc073a14e641392b0b7b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 10e2bab755c36ffa73988e6e731b667dafa9c169
Author: David Teigland <teigland@redhat.com>
Date:   Tue Apr 29 12:18:27 2008 -0500

    fence_tool: fix list command
    
    Signed-off-by: David Teigland <teigland@redhat.com>

-----------------------------------------------------------------------

Summary of changes:
 fence/fence_tool/fence_tool.c |   31 ++++++++++++++++---------------
 fence/fenced/main.c           |   14 ++++++++------
 fence/libfenced/main.c        |   22 ++++++++++++++--------
 3 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c
index 0152948..5be3680 100644
--- a/fence/fence_tool/fence_tool.c
+++ b/fence/fence_tool/fence_tool.c
@@ -288,16 +288,25 @@ static int do_list(void)
 {
 	struct fenced_domain d;
 	struct fenced_node *nodes, *np;
-	int node_count = 0;
+	int node_count;
 	int rv, i;
 
+
 	rv = fenced_domain_info(&d);
-	if (rv < 0)
-		die("can't communicate with fenced");
+	if (rv < 0) {
+		fprintf(stderr, "fenced_domain_info error %d\n", rv);
+		return rv;
+	}
+
+	printf("fence domain info\n");
+	printf("member_count %d master_nodeid %d victim_count %d current_victim %d state %d\n",
+		d.member_count, d.master_nodeid, d.victim_count, d.current_victim, d.state);
 
 	nodes = malloc(MAX_NODES * sizeof(struct fenced_node));
 	if (!nodes)
 		return -ENOMEM;
+	memset(nodes, 0, sizeof(*nodes));
+	node_count = 0;
 
 	rv = fenced_domain_nodes(FENCED_NODES_MEMBERS, MAX_NODES,
 				 &node_count, nodes);
@@ -305,20 +314,11 @@ static int do_list(void)
 		fprintf(stderr, "fenced_domain_nodes error %d\n", rv);
 		return rv;
 	}
-
-	printf("default fence domain\n");
-
-	if (verbose > 0)
-		printf("member_count %d victim_count %d master_nodeid %d current_victim %d state %d\n",
-			d.member_count, d.victim_count, d.master_nodeid, d.current_victim, d.state);
-
-	/*
 	qsort(&nodes, node_count, sizeof(struct fenced_node), node_compare);
-	*/
 
-	printf("domain_nodes node_count %d\n", node_count);
-	np = nodes;
+	printf("fence domain members\n");
 
+	np = nodes;
 	printf("[");
 	for (i = 0; i < node_count; i++) {
 		if (i != 0)
@@ -328,8 +328,9 @@ static int do_list(void)
 	}
 	printf("]\n");
 
-	free(nodes);
+	/* if verbose, query all nodes and print all info for each */
 
+	free(nodes);
 	return 0;
 }
 
diff --git a/fence/fenced/main.c b/fence/fenced/main.c
index bdd0f8b..439b9d3 100644
--- a/fence/fenced/main.c
+++ b/fence/fenced/main.c
@@ -363,20 +363,22 @@ static void query_domain_nodes(int f, int option, int max)
 	struct fd *fd;
 	int node_count = 0;
 	struct fenced_node *nodes = NULL;
-	int rv;
+	int rv, result;
 
 	fd = find_fd("default");
 	if (!fd) {
-		rv = -ENOENT;
+		result = -ENOENT;
+		node_count = 0;
 		goto out;
 	}
 
 	if (group_mode == GROUP_LIBGROUP)
-		rv = set_domain_nodes(fd, option, &node_count, &nodes);
+		rv = set_domain_nodes_group(fd, option, &node_count, &nodes);
 	else
 		rv = set_domain_nodes(fd, option, &node_count, &nodes);
 
 	if (rv < 0) {
+		result = rv;
 		node_count = 0;
 		goto out;
 	}
@@ -386,13 +388,13 @@ static void query_domain_nodes(int f, int option, int max)
 	   asked for and return -E2BIG */
 
 	if (node_count > max) {
-		rv = -E2BIG;
+		result = -E2BIG;
 		node_count = max;
 	} else {
-		rv = node_count;
+		result = node_count;
 	}
  out:
-	do_reply(f, FENCED_CMD_DOMAIN_NODES, rv,
+	do_reply(f, FENCED_CMD_DOMAIN_NODES, result,
 	         (char *)nodes, node_count * sizeof(struct fenced_node));
 
 	if (nodes)
diff --git a/fence/libfenced/main.c b/fence/libfenced/main.c
index 17dd37e..4f2a310 100644
--- a/fence/libfenced/main.c
+++ b/fence/libfenced/main.c
@@ -281,7 +281,7 @@ int fenced_domain_nodes(int type, int max, int *count, struct fenced_node *nodes
 	struct fenced_header h, *rh;
 	char *reply;
 	int reply_len;
-	int fd, rv;
+	int fd, rv, result, node_count;
 
 	init_header(&h, FENCED_CMD_DOMAIN_NODES, sizeof(h));
 	h.option = type;
@@ -309,17 +309,23 @@ int fenced_domain_nodes(int type, int max, int *count, struct fenced_node *nodes
 	do_read(fd, reply, reply_len);
 
 	rh = (struct fenced_header *)reply;
-	rv = rh->data;
-	if (rv < 0 && rv != -E2BIG)
+	result = rh->data;
+	if (result < 0 && result != -E2BIG) {
+		rv = result;
 		goto out_close;
+	}
 
-	if (rv == -E2BIG)
-		*count = max;
-	else
-		*count = rv;
+	if (result == -E2BIG) {
+		*count = -E2BIG;
+		node_count = max;
+	} else {
+		*count = result;
+		node_count = result;
+	}
+	rv = 0;
 
 	memcpy(nodes, (char *)reply + sizeof(struct fenced_header),
-	       *count * sizeof(struct fenced_node));
+	       node_count * sizeof(struct fenced_node));
  out_close:
 	close(fd);
  out:


hooks/post-receive
--
Cluster Project


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]