FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 05-08-2008, 07:04 PM
 
Default Cluster Project branch, master, updated. cluster-2.99.00-30-g6326fb0

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=6326fb0743 3e0e8222c1a8946400d16b6a7b6337

The branch, master has been updated
via 6326fb07433e0e8222c1a8946400d16b6a7b6337 (commit)
from 3ccd6793aa2973ab5d6b5642192eabbfcf247096 (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 6326fb07433e0e8222c1a8946400d16b6a7b6337
Author: David Teigland <teigland@redhat.com>
Date: Thu May 8 14:03:22 2008 -0500

daemons: queries

Completing list command for fence_tool and dlm_tool.

Signed-off-by: David Teigland <teigland@redhat.com>

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

Summary of changes:
dlm/tool/main.c | 113 ++++++++++++++++++++++++++++++++--------
fence/fence_tool/fence_tool.c | 65 ++++++++++++++---------
fence/fenced/cpg.c | 39 ++++++++++----
group/dlm_controld/cpg.c | 1 -
4 files changed, 157 insertions(+), 61 deletions(-)

diff --git a/dlm/tool/main.c b/dlm/tool/main.c
index 15646e6..3fcf57b 100644
--- a/dlm/tool/main.c
+++ b/dlm/tool/main.c
@@ -423,7 +423,7 @@ void do_lockdump(char *name)
fclose(file);
}

-char *lockspace_flags_str(uint32_t flags)
+char *dlmc_lf_str(uint32_t flags)
{
static char str[128];

@@ -445,28 +445,70 @@ char *lockspace_flags_str(uint32_t flags)
return str;
}

+char *dlmc_nf_str(uint32_t flags)
+{
+ static char str[128];
+
+ memset(str, 0, sizeof(str));
+
+ if (flags & DLMC_NF_MEMBER)
+ strcat(str, "member ");
+ if (flags & DLMC_NF_START)
+ strcat(str, "start ");
+ if (flags & DLMC_NF_DISALLOWED)
+ strcat(str, "disallowed ");
+ if (flags & DLMC_NF_CHECK_FENCING)
+ strcat(str, "check_fencing ");
+ if (flags & DLMC_NF_CHECK_QUORUM)
+ strcat(str, "check_quorum ");
+ if (flags & DLMC_NF_CHECK_FS)
+ strcat(str, "check_fs ");
+ if (flags & DLMC_NF_FS_NOTIFIED)
+ strcat(str, "fs_notified");
+
+ return str;
+}
+
+char *condition_str(int cond)
+{
+ switch (cond) {
+ case 0:
+ return "";
+ case 1:
+ return "fencing";
+ case 2:
+ return "quorum";
+ case 3:
+ return "fs";
+ case 4:
+ return "pending";
+ default:
+ return "unknown";
+ }
+}
+
static void show_ls(struct dlmc_lockspace *ls)
{
printf("dlm lockspace "%s"
", ls->name);
printf("global_id 0x%x flags 0x%x %s
", ls->global_id, ls->flags,
- lockspace_flags_str(ls->flags));
+ dlmc_lf_str(ls->flags));

- printf("prev change member_count %d joined_count %d remove_count %d "
- "failed_count %d
",
+ printf("prev seq %u-%u counts member %d joined %d remove %d failed %d
",
+ ls->cg_prev.combined_seq, ls->cg_prev.seq,
ls->cg_prev.member_count, ls->cg_prev.joined_count,
ls->cg_prev.remove_count, ls->cg_prev.failed_count);
- printf("prev change seq %x - %x
",
- ls->cg_prev.combined_seq, ls->cg_prev.seq);

- printf("next change member_count %d joined_count %d remove_count %d "
- "failed_count %d
",
+ if (!ls->cg_next.seq)
+ return;
+
+ printf("next seq %u-%u counts member %d joined %d remove %d failed %d
",
+ ls->cg_next.combined_seq, ls->cg_next.seq,
ls->cg_next.member_count, ls->cg_next.joined_count,
ls->cg_next.remove_count, ls->cg_next.failed_count);
- printf("next change seq %x - %x
",
- ls->cg_next.combined_seq, ls->cg_next.seq);

- printf("next change wait_messages %d wait_condition %d
",
- ls->cg_next.wait_messages, ls->cg_next.wait_condition);
+ printf("next wait_messages %d wait_condition %d %s
",
+ ls->cg_next.wait_messages, ls->cg_next.wait_condition,
+ condition_str(ls->cg_next.wait_condition));
}

static void show_all_nodes(int count, struct dlmc_node *nodes)
@@ -475,9 +517,9 @@ static void show_all_nodes(int count, struct dlmc_node *nodes)
int i;

for (i = 0; i < count; i++) {
- printf("%d added_seq 0x%x removed_seq 0x%x failed_reason %d flags 0x%x
",
+ printf("nodeid %d add_seq %u rem_seq %u failed %d flags 0x%x %s
",
n->nodeid, n->added_seq, n->removed_seq,
- n->failed_reason, n->flags);
+ n->failed_reason, n->flags, dlmc_nf_str(n->flags));
n++;
}
}
@@ -494,6 +536,14 @@ static void show_nodeids(int count, struct dlmc_node *nodes)
printf("
");
}

+static int node_compare(const void *va, const void *vb)
+{
+ const struct dlmc_node *a = va;
+ const struct dlmc_node *b = vb;
+
+ return a->nodeid - b->nodeid;
+}
+
#define MAX_LS 128
#define MAX_NODES 128

@@ -514,15 +564,13 @@ static void do_list(char *name)
rv = dlmc_lockspace_info(name, lss);
if (rv < 0)
goto out;
-
- show_ls(lss);
- return;
+ ls_count = 1;
+ } else {
+ rv = dlmc_lockspaces(MAX_LS, &ls_count, lss);
+ if (rv < 0)
+ goto out;
}

- rv = dlmc_lockspaces(MAX_LS, &ls_count, lss);
- if (rv < 0)
- goto out;
-
for (i = 0; i < ls_count; i++) {
ls = &lss[i];

@@ -533,31 +581,49 @@ static void do_list(char *name)

rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_MEMBERS,
MAX_NODES, &node_count, nodes);
+ if (rv < 0)
+ goto out;
+
+ qsort(nodes, node_count, sizeof(struct dlmc_node),node_compare);
+
printf("prev members ");
show_nodeids(node_count, nodes);

+ if (!ls->cg_next.seq && verbose)
+ goto show_all;
+
node_count = 0;
memset(&nodes, 0, sizeof(nodes));

rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_NEXT,
MAX_NODES, &node_count, nodes);
+ if (rv < 0)
+ goto out;
+
+ qsort(nodes, node_count, sizeof(struct dlmc_node),node_compare);
+
printf("next members ");
show_nodeids(node_count, nodes);

if (!verbose)
continue;
-
+ show_all:
node_count = 0;
memset(&nodes, 0, sizeof(nodes));

rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_ALL,
MAX_NODES, &node_count, nodes);
+ if (rv < 0)
+ goto out;
+
+ qsort(nodes, node_count, sizeof(struct dlmc_node),node_compare);
+
printf("all nodes
");
show_all_nodes(node_count, nodes);
}
return;
out:
- fprintf(stderr, "dlm_controld lockspace query error %d
", rv);
+ fprintf(stderr, "dlm_controld query error %d
", rv);

}

@@ -611,6 +677,7 @@ int main(int argc, char **argv)
break;

/* calls to libdlmcontrol; pass a command/query to dlm_controld */
+
case OP_LIST:
do_list(lsname);
break;
diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c
index 5be3680..9629b70 100644
--- a/fence/fence_tool/fence_tool.c
+++ b/fence/fence_tool/fence_tool.c
@@ -284,54 +284,71 @@ static int node_compare(const void *va, const void *vb)

#define MAX_NODES 128

+struct fenced_node nodes[MAX_NODES];
+
static int do_list(void)
{
struct fenced_domain d;
- struct fenced_node *nodes, *np;
+ struct fenced_node *np;
int node_count;
int rv, i;

-
rv = fenced_domain_info(&d);
- if (rv < 0) {
- fprintf(stderr, "fenced_domain_info error %d
", rv);
- return rv;
- }
+ if (rv < 0)
+ goto out;

- printf("fence domain info
");
+ printf("fence domain "default"
");
printf("member_count %d master_nodeid %d victim_count %d current_victim %d state %d
",
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;
+ memset(&nodes, 0, sizeof(nodes));

rv = fenced_domain_nodes(FENCED_NODES_MEMBERS, MAX_NODES,
&node_count, nodes);
- if (rv < 0) {
- fprintf(stderr, "fenced_domain_nodes error %d
", rv);
- return rv;
- }
+ if (rv < 0)
+ goto out;
+
qsort(&nodes, node_count, sizeof(struct fenced_node), node_compare);

- printf("fence domain members
");
+ printf("members ");

np = nodes;
- printf("[");
for (i = 0; i < node_count; i++) {
- if (i != 0)
- printf(" ");
- printf("%d", np->nodeid);
+ printf("%d ", np->nodeid);
np++;
}
- printf("]
");
+ printf("
");
+
+ if (!verbose)
+ return 0;

- /* if verbose, query all nodes and print all info for each */
+ node_count = 0;
+ memset(&nodes, 0, sizeof(nodes));
+
+ rv = fenced_domain_nodes(FENCED_NODES_ALL, MAX_NODES,
+ &node_count, nodes);
+ if (rv < 0)
+ goto out;
+
+ qsort(&nodes, node_count, sizeof(struct fenced_node), node_compare);

- free(nodes);
+ printf("all nodes
");
+
+ np = nodes;
+ for (i = 0; i < node_count; i++) {
+ printf("nodeid %d member %d victim %d last fence master %d how %d
",
+ np->nodeid,
+ np->member,
+ np->victim,
+ np->last_fenced_master,
+ np->last_fenced_how);
+ np++;
+ }
return 0;
+ out:
+ fprintf(stderr, "fenced query error %d
", rv);
+ return rv;
}

static void print_usage(void)
@@ -417,8 +434,6 @@ static void decode_arguments(int argc, char *argv[])
operation = OP_LEAVE;
} else if (strcmp(argv[optind], "dump") == 0) {
operation = OP_DUMP;
- } else if (strcmp(argv[optind], "list") == 0) {
- operation = OP_LIST;
} else if (strcmp(argv[optind], "ls") == 0) {
operation = OP_LIST;
} else
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 5f84220..5f01e4d 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -1281,24 +1281,39 @@ int set_domain_nodes(struct fd *fd, int option, int *node_count,
struct fenced_node **nodes_out)
{
struct change *cg = fd->started_change;
- struct fenced_node *nodes, *nodep;
+ struct fenced_node *nodes = NULL, *n;
+ struct node_history *nh;
struct member *memb;
+ int count = 0;

- if (!cg) {
- *node_count = 0;
- return 0;
- }
+ if (option == FENCED_NODES_MEMBERS) {
+ if (!cg)
+ goto out;
+ count = cg->member_count;

- nodes = malloc(cg->member_count * sizeof(struct fenced_node));
- if (!nodes)
- return -ENOMEM;
+ nodes = malloc(count * sizeof(struct fenced_node));
+ if (!nodes)
+ return -ENOMEM;

- nodep = nodes;
- list_for_each_entry(memb, &cg->members, list) {
- set_node_info(fd, memb->nodeid, nodep++);
+ n = nodes;
+ list_for_each_entry(memb, &cg->members, list)
+ set_node_info(fd, memb->nodeid, n++);
}

- *node_count = cg->member_count;
+ else if (option == FENCED_NODES_ALL) {
+ list_for_each_entry(nh, &fd->node_history, list)
+ count++;
+
+ nodes = malloc(count * sizeof(struct fenced_node));
+ if (!nodes)
+ return -ENOMEM;
+
+ n = nodes;
+ list_for_each_entry(nh, &fd->node_history, list)
+ set_node_info(fd, nh->nodeid, n++);
+ }
+ out:
+ *node_count = count;
*nodes_out = nodes;
return 0;
}
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index 03644eb..1765a69 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1690,7 +1690,6 @@ int set_lockspace_nodes(struct lockspace *ls, int option, int *node_count,
list_for_each_entry(memb, &cg->members, list)
_set_node_info(ls, cg, memb->nodeid, nodep++);
}
-
out:
*node_count = count;
*nodes_out = nodes;


hooks/post-receive
--
Cluster Project
 

Thread Tools




All times are GMT. The time now is 04:13 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org