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, RHEL5, updated. cmirror_1_1_15-57-g38c7b17


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=38c7b171fee73837a539a441b9a408860c07f1d6

The branch, RHEL5 has been updated
       via  38c7b171fee73837a539a441b9a408860c07f1d6 (commit)
      from  4cd89a0d7eef3c0a8f02517957b393a5be736f46 (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 38c7b171fee73837a539a441b9a408860c07f1d6
Author: Christine Caulfield <ccaulfie@redhat.com>
Date:   Mon Apr 28 16:10:09 2008 +0100

    Display qurum device info in cman_tool status.
    
    bz#318361
    
    Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>

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

Summary of changes:
 cman/cman_tool/main.c       |    4 ++++
 cman/daemon/cnxman-socket.h |    5 ++++-
 cman/daemon/commands.c      |   20 ++++++++++++++------
 cman/lib/libcman.c          |   19 ++++++++++++++++++-
 cman/lib/libcman.h          |    9 ++++++++-
 5 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index a626714..c7c488f 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -197,6 +197,7 @@ static void show_status(void)
 	cman_version_t v;
 	cman_handle_t h;
 	cman_node_t node;
+	cman_qdev_info qinfo;
 	char info_buf[PIPE_BUF];
 	char tmpbuf[1024];
 	cman_extra_info_t *einfo = (cman_extra_info_t *)info_buf;
@@ -226,7 +227,10 @@ static void show_status(void)
 							  einfo->ei_node_state));
 	printf("Nodes: %d\n", einfo->ei_members);
 	printf("Expected votes: %d\n", einfo->ei_expected_votes);
+	if (cman_get_quorum_device(h, &qinfo) == 0 && qinfo.qi_state == 2)
+		printf("Quorum device votes: %d\n", qinfo.qi_votes);
 	printf("Total votes: %d\n", einfo->ei_total_votes);
+
 	printf("Quorum: %d %s\n", einfo->ei_quorum, quorate?" ":"Activity blocked");
 	printf("Active subsystems: %d\n", cman_get_subsys_count(h));
 	printf("Flags:");
diff --git a/cman/daemon/cnxman-socket.h b/cman/daemon/cnxman-socket.h
index b12c6fd..cc1de6a 100644
--- a/cman/daemon/cnxman-socket.h
+++ b/cman/daemon/cnxman-socket.h
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -83,6 +83,9 @@
  * transition */
 #define HIGH_PROTECTED_PORT      9
 
+/* Nodeid passed to CMD_GETNODE to return the quorum device info */
+#define CLUSTER_GETNODE_QUORUMDEV -1
+
 /* Reasons for leaving the cluster */
 #define CLUSTER_LEAVEFLAG_DOWN     0	/* Normal shutdown */
 #define CLUSTER_LEAVEFLAG_KILLED   1
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 71089d9..3fcfbf2 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -597,13 +597,21 @@ static int do_cmd_get_node(char *cmdbuf, char *retbuf, int *retlen)
 	if (!we_are_a_cluster_member)
 		return -ENOENT;
 
-	if (!u_node->name[0]) {
-		if (u_node->node_id == 0)
-			u_node->node_id = us->node_id;
-		node = find_node_by_nodeid(u_node->node_id);
+	if (u_node->node_id == CLUSTER_GETNODE_QUORUMDEV) {
+		if (quorum_device)
+			node = quorum_device;
+		else
+			return -ENOENT;
+	}
+	else {
+		if (!u_node->name[0]) {
+			if (u_node->node_id == 0)
+				u_node->node_id = us->node_id;
+			node = find_node_by_nodeid(u_node->node_id);
+		}
+		else
+			node = find_node_by_name(u_node->name);
 	}
-	else
-		node = find_node_by_name(u_node->name);
 
 	if (!node) {
 		P_MEMB("cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index fa771ce..1c74748 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This library is free software; you can redistribute it and/or
 **  modify it under the terms of the GNU Lesser General Public
@@ -1037,6 +1037,23 @@ int cman_poll_quorum_device(cman_handle_t handle, int isavailable)
 	return info_call(h, CMAN_CMD_POLL_QUORUMDEV, &isavailable, sizeof(int), NULL, 0);
 }
 
+int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info)
+{
+	struct cman_handle *h = (struct cman_handle *)handle;
+	int ret;
+	struct cl_cluster_node cman_node;
+	VALIDATE_HANDLE(h);
+
+	cman_node.node_id = CLUSTER_GETNODE_QUORUMDEV;
+	ret = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(cman_node), &cman_node, sizeof(cman_node));
+	if (!ret) {
+		strcpy(info->qi_name, cman_node.name);
+		info->qi_state = cman_node.state;
+		info->qi_votes = cman_node.votes;
+	}
+	return ret;
+}
+
 int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *time, int *fenced, char *agent)
 {
 	struct cman_handle *h = (struct cman_handle *)handle;
diff --git a/cman/lib/libcman.h b/cman/lib/libcman.h
index 2f10d2c..857ba33 100644
--- a/cman/lib/libcman.h
+++ b/cman/lib/libcman.h
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This library is free software; you can redistribute it and/or
 **  modify it under the terms of the GNU Lesser General Public
@@ -170,6 +170,13 @@ typedef struct cman_extra_info {
 					  First batch is the multicast address list */
 } cman_extra_info_t;
 
+/* Quorum device info, returned from cman_get_quorum_device() */
+typedef struct cman_qdev_info {
+	char qi_name[CMAN_MAX_NODENAME_LEN+1];
+	int  qi_state;
+	int  qi_votes;
+} cman_qdev_info;
+
 /*
  * NOTE: Apart from cman_replyto_shutdown(), you must not
  * call other cman_* functions while in these two callbacks:


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]