From: pcaulfield@sourceware.org <pcaulfield@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...
Date: 5 Dec 2007 14:28:59 -0000 [thread overview]
Message-ID: <20071205142859.23435.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: pcaulfield at sourceware.org 2007-12-05 14:28:58
Modified files:
cman/cman_tool : main.c
cman/daemon : cnxman-socket.h commands.c
cman/lib : libcman.c libcman.h
Log message:
Print votes of quorum device in cman_tool status
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.37&r2=1.38
--- cluster/cman/cman_tool/main.c 2007/11/29 11:19:12 1.60
+++ cluster/cman/cman_tool/main.c 2007/12/05 14:28:58 1.61
@@ -201,6 +201,7 @@
char info_buf[PIPE_BUF];
char tmpbuf[1024];
cman_extra_info_t *einfo = (cman_extra_info_t *)info_buf;
+ cman_qdev_info qinfo;
int quorate;
int i;
int j;
@@ -228,6 +229,8 @@
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 == 1)
+ 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");
@@ -456,7 +459,6 @@
int format[MAX_FORMAT_OPTS];
cman_node_t *dis_nodes;
cman_node_t *nodes;
- cman_node_t qdev_node;
h = open_cman_handle(0);
@@ -508,12 +510,7 @@
printf("Node Sts Inc Joined Name\n");
}
- /* Get quorum device & print it. */
- memset(&qdev_node, 0, sizeof(qdev_node));
- if (!cman_get_node(h, CMAN_NODEID_QDISK, &qdev_node))
- print_node(comline, h, format, &qdev_node);
-
- /* Print 'real' nodes */
+ /* Print nodes */
for (i = 0; i < numnodes; i++) {
print_node(comline, h, format, &nodes[i]);
}
--- cluster/cman/daemon/cnxman-socket.h 2007/11/05 15:15:53 1.20
+++ cluster/cman/daemon/cnxman-socket.h 2007/12/05 14:28:58 1.21
@@ -54,6 +54,7 @@
#define CMAN_CMD_STOP_CONFCHG 0x000000c1
#define CMAN_CMD_SET_DIRTY 0x800000c2
#define CMAN_CMD_SET_DEBUGLOG 0x800000c3
+#define CMAN_CMD_GET_QUORUMDEV 0x000000c4
#define CMAN_CMD_DATA 0x00000100
#define CMAN_CMD_BIND 0x00000101
@@ -256,6 +257,12 @@
char fence_agent[MAX_FENCE_AGENT_NAME_LEN];
};
+struct cl_qdev_info {
+ char name[MAX_CLUSTER_MEMBER_NAME_LEN];
+ int state;
+ int votes;
+};
+
/* Commands to the barrier cmd */
#define BARRIER_CMD_REGISTER 1
#define BARRIER_CMD_CHANGE 2
--- cluster/cman/daemon/commands.c 2007/11/29 11:19:12 1.76
+++ cluster/cman/daemon/commands.c 2007/12/05 14:28:58 1.77
@@ -1024,6 +1024,21 @@
return 0;
}
+static int do_cmd_get_quorum_device(char *cmdbuf, char *retbuf, int *retlen)
+{
+ struct cl_qdev_info *qdi = (struct cl_qdev_info *)retbuf;
+
+ if (!quorum_device)
+ return -EINVAL;
+
+ strcpy(qdi->name, quorum_device->name);
+ qdi->state = (quorum_device->state == NODESTATE_MEMBER);
+ qdi->votes = quorum_device->votes;
+ *retlen = sizeof(struct cl_qdev_info);
+
+ return 0;
+}
+
static void ccsd_timer_fn(void *arg)
{
int ccs_err;
@@ -1276,6 +1291,10 @@
err = do_cmd_get_cluster(cmdbuf, outbuf+offset, retlen);
break;
+ case CMAN_CMD_GET_QUORUMDEV:
+ err = do_cmd_get_quorum_device(cmdbuf, outbuf+offset, retlen);
+ break;
+
case CMAN_CMD_GETEXTRAINFO:
err = do_cmd_get_extrainfo(cmdbuf, retbuf, retsize, retlen, offset);
break;
--- cluster/cman/lib/libcman.c 2007/11/09 12:51:58 1.39
+++ cluster/cman/lib/libcman.c 2007/12/05 14:28:58 1.40
@@ -1037,6 +1037,22 @@
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_qdev_info q;
+ VALIDATE_HANDLE(h);
+
+ ret = info_call(h, CMAN_CMD_GET_QUORUMDEV, NULL, 0, &q, sizeof(q));
+ if (!ret) {
+ strcpy(info->qi_name, q.name);
+ info->qi_state = q.state;
+ info->qi_votes = q.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;
--- cluster/cman/lib/libcman.h 2007/11/09 12:51:58 1.37
+++ cluster/cman/lib/libcman.h 2007/12/05 14:28:58 1.38
@@ -176,6 +176,13 @@
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:
@@ -394,6 +401,7 @@
int cman_register_quorum_device(cman_handle_t handle, char *name, int votes);
int cman_unregister_quorum_device(cman_handle_t handle);
int cman_poll_quorum_device(cman_handle_t handle, int isavailable);
+int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info);
/*
* Sets the dirty bit inside cman. This indicates that the node has
next reply other threads:[~2007-12-05 14:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-05 14:28 pcaulfield [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-02-08 14:09 [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so pcaulfield
2007-09-17 13:48 pcaulfield
2007-08-28 13:14 pcaulfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071205142859.23435.qmail@sourceware.org \
--to=pcaulfield@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.