From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6645 invoked by alias); 29 Apr 2008 17:24:32 -0000 Received: (qmail 6611 invoked by uid 9453); 29 Apr 2008 17:24:30 -0000 Date: Tue, 29 Apr 2008 17:24:00 -0000 Message-ID: <20080429172430.6595.qmail@sourceware.org> From: teigland@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.00-3-g10e2bab X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 1fece51155f0df4e1524dc073a14e641392b0b7b X-Git-Newrev: 10e2bab755c36ffa73988e6e731b667dafa9c169 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00225.txt.bz2 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 Date: Tue Apr 29 12:18:27 2008 -0500 fence_tool: fix list command Signed-off-by: David Teigland ----------------------------------------------------------------------- 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