* [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...
@ 2007-08-28 13:14 pcaulfield
0 siblings, 0 replies; 4+ messages in thread
From: pcaulfield @ 2007-08-28 13:14 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: pcaulfield at sourceware.org 2007-08-28 13:14:11
Modified files:
cman/cman_tool : main.c
cman/daemon : cnxman-socket.h commands.c logging.c logging.h
cman/lib : libcman.c libcman.h
cman/man : cman_tool.8
Log message:
Add a 'cman_tool debug' command that allows cman debugging levels to be
changed on-the-fly
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.h.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/man/cman_tool.8.diff?cvsroot=cluster&r1=1.11&r2=1.12
--- cluster/cman/cman_tool/main.c 2007/08/22 08:58:36 1.55
+++ cluster/cman/cman_tool/main.c 2007/08/28 13:14:06 1.56
@@ -31,13 +31,14 @@
#define OP_STATUS 8
#define OP_NODES 9
#define OP_SERVICES 10
+#define OP_DEBUG 11
static void print_usage(int subcmd)
{
printf("Usage:\n");
printf("\n");
- printf("%s <join|leave|kill|expected|votes|version|wait|status|nodes|services> [options]\n",
+ printf("%s <join|leave|kill|expected|votes|version|wait|status|nodes|services|debug> [options]\n",
prog_name);
printf("\n");
printf("Options:\n");
@@ -591,6 +592,18 @@
cman_finish(h);
}
+static void set_debuglog(commandline_t *comline)
+{
+ cman_handle_t h;
+
+ h = open_cman_handle(1);
+
+ if (cman_set_debuglog(h, comline->verbose))
+ perror("setting debuglog failed");
+
+ cman_finish(h);
+}
+
static int get_int_arg(char argopt, char *arg)
{
@@ -774,7 +787,10 @@
} else if (strcmp(argv[optind], "services") == 0) {
if (comline->operation)
die("can't specify two operations");
- comline->operation = OP_SERVICES;
+ } else if (strcmp(argv[optind], "debug") == 0) {
+ if (comline->operation)
+ die("can't specify two operations");
+ comline->operation = OP_DEBUG;
} else if (strcmp(argv[optind], "remove") == 0) {
comline->remove = TRUE;
} else if (strcmp(argv[optind], "force") == 0) {
@@ -889,6 +905,10 @@
case OP_SERVICES:
show_services();
break;
+
+ case OP_DEBUG:
+ set_debuglog(&comline);
+ break;
}
exit(EXIT_SUCCESS);
--- cluster/cman/daemon/cnxman-socket.h 2007/08/20 14:37:26 1.18
+++ cluster/cman/daemon/cnxman-socket.h 2007/08/28 13:14:10 1.19
@@ -53,6 +53,7 @@
#define CMAN_CMD_START_CONFCHG 0x000000c0
#define CMAN_CMD_STOP_CONFCHG 0x000000c1
#define CMAN_CMD_SET_DIRTY 0x800000c2
+#define CMAN_CMD_SET_DEBUGLOG 0x800000c3
#define CMAN_CMD_DATA 0x00000100
#define CMAN_CMD_BIND 0x00000101
--- cluster/cman/daemon/commands.c 2007/08/22 07:05:58 1.67
+++ cluster/cman/daemon/commands.c 2007/08/28 13:14:10 1.68
@@ -1189,6 +1189,7 @@
int err = -EINVAL;
struct cl_version cnxman_version;
char *outbuf = *retbuf;
+ int value;
P_MEMB("command to process is %x\n", cmd);
@@ -1214,6 +1215,12 @@
err = 0;
break;
+ case CMAN_CMD_SET_DEBUGLOG:
+ memcpy(&value, cmdbuf, sizeof(int));
+ set_debuglog(value);
+ err = 0;
+ break;
+
case CMAN_CMD_START_CONFCHG:
con->confchg = 1;
err = 0;
--- cluster/cman/daemon/logging.c 2006/11/08 15:49:39 1.13
+++ cluster/cman/daemon/logging.c 2007/08/28 13:14:10 1.14
@@ -1,7 +1,7 @@
/******************************************************************************
*******************************************************************************
**
-** Copyright (C) 2005-2006 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2005-2007 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
@@ -50,6 +50,11 @@
subsys_mask = subsystems;
}
+void set_debuglog(int subsystems)
+{
+ subsys_mask = subsystems;
+}
+
void log_debug(int subsys, int stamp, const char *fmt, ...)
{
va_list va;
--- cluster/cman/daemon/logging.h 2006/11/08 15:49:39 1.6
+++ cluster/cman/daemon/logging.h 2007/08/28 13:14:10 1.7
@@ -1,7 +1,7 @@
/******************************************************************************
*******************************************************************************
**
-** Copyright (C) 2005 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2005-2007 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
@@ -12,6 +12,7 @@
extern void log_msg(int priority, char *fmt, ...);
extern void init_debug(int subsystems);
+extern void set_debuglog(int subsystems);
/* Debug macros */
#define CMAN_DEBUG_NONE 1
--- cluster/cman/lib/libcman.c 2007/08/20 14:37:26 1.35
+++ cluster/cman/lib/libcman.c 2007/08/28 13:14:10 1.36
@@ -986,6 +986,14 @@
return info_call(h, CMAN_CMD_SET_DIRTY, NULL, 0, NULL, 0);
}
+int cman_set_debuglog(cman_handle_t handle, int subsystems)
+{
+ struct cman_handle *h = (struct cman_handle *)handle;
+ VALIDATE_HANDLE(h);
+
+ return info_call(h, CMAN_CMD_SET_DEBUGLOG, &subsystems, sizeof(int), NULL, 0);
+}
+
int cman_replyto_shutdown(cman_handle_t handle, int yesno)
{
struct cman_handle *h = (struct cman_handle *)handle;
--- cluster/cman/lib/libcman.h 2007/08/22 07:09:44 1.32
+++ cluster/cman/lib/libcman.h 2007/08/28 13:14:10 1.33
@@ -397,4 +397,17 @@
*/
int cman_set_dirty(cman_handle_t handle);
+
+/*
+ * Changes the debug logging level inside cman.
+ * subsystems is a bitmask of:
+ */
+#define CMAN_DEBUGLOG_NONE 0
+#define CMAN_DEBUGLOG_BARRIER 2
+#define CMAN_DEBUGLOG_MEMBERSHIP 4
+#define CMAN_DEBUGLOG_DEAMON 8
+#define CMAN_DEBUGLOG_AIS 16
+
+int cman_set_debuglog(cman_handle_t handle, int subsystems);
+
#endif
--- cluster/cman/man/cman_tool.8 2007/08/22 13:39:57 1.11
+++ cluster/cman/man/cman_tool.8 2007/08/28 13:14:10 1.12
@@ -3,7 +3,7 @@
.SH NAME
cman_tool \- Cluster Management Tool
.SH SYNOPSIS
-.B cman_tool join | leave | kill | expected | votes | version | wait | status | nodes | services [options]
+.B cman_tool join | leave | kill | expected | votes | version | wait | status | nodes | services | debug [options]
.br
.SH DESCRIPTION
.PP
@@ -84,6 +84,14 @@
Displays the local view of subsystems using cman (deprecated, group_tool
should be used instead).
+.TP
+.I debug
+Sets the debug level of the running cman daemon. Debug output will be
+sent to syslog level LOG_DEBUG. the
+.B -d
+switch specifies the new logging level. This is the same bitmask used
+for cman_tool join -d
+.br
.SH "LEAVE" OPTIONS
.TP
.I -w
@@ -235,3 +243,16 @@
.I -a
Shows the IP address(es) the nodes are communicating on.
+.SH "DEBUG" OPTIONS
+.TP
+.I -d <value>
+The value is a bitmask of
+.br
+2 Barriers
+.br
+4 Membership messages
+.br
+8 Daemon operation, including command-line interaction
+.br
+16 Interaction with OpenAIS
+.br
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...
@ 2007-09-17 13:48 pcaulfield
0 siblings, 0 replies; 4+ messages in thread
From: pcaulfield @ 2007-09-17 13:48 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: pcaulfield at sourceware.org 2007-09-17 13:48:15
Modified files:
cman/cman_tool : main.c
cman/daemon : cnxman-socket.h commands.c logging.c logging.h
cman/lib : libcman.c libcman.h
Log message:
Add option to set the cman debug level.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.51.2.2&r2=1.51.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.17.2.1&r2=1.17.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.55.2.11&r2=1.55.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.12&r2=1.12.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/logging.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.30.2.4&r2=1.30.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.29.2.1&r2=1.29.2.2
--- cluster/cman/cman_tool/main.c 2007/09/17 13:22:30 1.51.2.2
+++ cluster/cman/cman_tool/main.c 2007/09/17 13:48:15 1.51.2.3
@@ -31,13 +31,14 @@
#define OP_STATUS 8
#define OP_NODES 9
#define OP_SERVICES 10
+#define OP_DEBUG 11
static void print_usage(int subcmd)
{
printf("Usage:\n");
printf("\n");
- printf("%s <join|leave|kill|expected|votes|version|wait|status|nodes|services> [options]\n",
+ printf("%s <join|leave|kill|expected|votes|version|wait|status|nodes|services|debug> [options]\n",
prog_name);
printf("\n");
printf("Options:\n");
@@ -289,7 +290,7 @@
printf("\n");
}
}
-
+ cman_finish(h);
}
static int node_compare(const void *va, const void *vb)
@@ -415,6 +416,8 @@
}
}
free(nodes);
+ free(dis_nodes);
+ cman_finish(h);
}
static void show_services(void)
@@ -589,6 +592,18 @@
cman_finish(h);
}
+static void set_debuglog(commandline_t *comline)
+{
+ cman_handle_t h;
+
+ h = open_cman_handle(1);
+
+ if (cman_set_debuglog(h, comline->verbose))
+ perror("setting debuglog failed");
+
+ cman_finish(h);
+}
+
static int get_int_arg(char argopt, char *arg)
{
@@ -772,7 +787,10 @@
} else if (strcmp(argv[optind], "services") == 0) {
if (comline->operation)
die("can't specify two operations");
- comline->operation = OP_SERVICES;
+ } else if (strcmp(argv[optind], "debug") == 0) {
+ if (comline->operation)
+ die("can't specify two operations");
+ comline->operation = OP_DEBUG;
} else if (strcmp(argv[optind], "remove") == 0) {
comline->remove = TRUE;
} else if (strcmp(argv[optind], "force") == 0) {
@@ -887,6 +905,10 @@
case OP_SERVICES:
show_services();
break;
+
+ case OP_DEBUG:
+ set_debuglog(&comline);
+ break;
}
exit(EXIT_SUCCESS);
--- cluster/cman/daemon/cnxman-socket.h 2007/09/17 13:22:31 1.17.2.1
+++ cluster/cman/daemon/cnxman-socket.h 2007/09/17 13:48:15 1.17.2.2
@@ -53,6 +53,7 @@
#define CMAN_CMD_START_CONFCHG 0x000000c0
#define CMAN_CMD_STOP_CONFCHG 0x000000c1
#define CMAN_CMD_SET_DIRTY 0x800000c2
+#define CMAN_CMD_SET_DEBUGLOG 0x800000c3
#define CMAN_CMD_DATA 0x00000100
#define CMAN_CMD_BIND 0x00000101
--- cluster/cman/daemon/commands.c 2007/09/17 13:35:35 1.55.2.11
+++ cluster/cman/daemon/commands.c 2007/09/17 13:48:15 1.55.2.12
@@ -1188,6 +1188,7 @@
int err = -EINVAL;
struct cl_version cnxman_version;
char *outbuf = *retbuf;
+ int value;
P_MEMB("command to process is %x\n", cmd);
@@ -1210,8 +1211,15 @@
case CMAN_CMD_SET_DIRTY:
us->flags |= NODE_FLAGS_DIRTY;
+ err = 0;
break;
+ case CMAN_CMD_SET_DEBUGLOG:
+ memcpy(&value, cmdbuf, sizeof(int));
+ set_debuglog(value);
+ err = 0;
+ break;
+
case CMAN_CMD_START_CONFCHG:
con->confchg = 1;
err = 0;
--- cluster/cman/daemon/logging.c 2006/06/30 13:00:27 1.12
+++ cluster/cman/daemon/logging.c 2007/09/17 13:48:15 1.12.2.1
@@ -50,6 +50,11 @@
subsys_mask = subsystems;
}
+void set_debuglog(int subsystems)
+{
+ subsys_mask = subsystems;
+}
+
#ifdef DEBUG
void log_debug(int subsys, int stamp, const char *fmt, ...)
{
--- cluster/cman/daemon/logging.h 2006/04/21 10:13:40 1.5
+++ cluster/cman/daemon/logging.h 2007/09/17 13:48:15 1.5.2.1
@@ -12,6 +12,7 @@
extern void log_msg(int priority, char *fmt, ...);
extern void init_debug(int subsystems);
+void set_debuglog(int subsystems);
/* Debug macros */
#ifdef DEBUG
--- cluster/cman/lib/libcman.c 2007/09/17 13:22:31 1.30.2.4
+++ cluster/cman/lib/libcman.c 2007/09/17 13:48:15 1.30.2.5
@@ -986,6 +986,14 @@
return info_call(h, CMAN_CMD_SET_DIRTY, NULL, 0, NULL, 0);
}
+int cman_set_debuglog(cman_handle_t handle, int subsystems)
+{
+ struct cman_handle *h = (struct cman_handle *)handle;
+ VALIDATE_HANDLE(h);
+
+ return info_call(h, CMAN_CMD_SET_DEBUGLOG, &subsystems, sizeof(int), NULL, 0);
+}
+
int cman_replyto_shutdown(cman_handle_t handle, int yesno)
{
struct cman_handle *h = (struct cman_handle *)handle;
--- cluster/cman/lib/libcman.h 2007/09/17 13:22:31 1.29.2.1
+++ cluster/cman/lib/libcman.h 2007/09/17 13:48:15 1.29.2.2
@@ -393,8 +393,21 @@
* Sets the dirty bit inside cman. This indicates that the node has
* some internal 'state' (eg in a daemon, filesystem or lock manager)
* and cannot merge with another cluster that already has state.
- * This cannot be reset.
+ * This needs an admin socket. It cannot be reset.
*/
int cman_set_dirty(cman_handle_t handle);
+
+/*
+ * Changes the debug logging level inside cman.
+ * subsystems is a bitmask of:
+ */
+#define CMAN_DEBUGLOG_NONE 0
+#define CMAN_DEBUGLOG_BARRIER 2
+#define CMAN_DEBUGLOG_MEMBERSHIP 4
+#define CMAN_DEBUGLOG_DAEMON 8
+#define CMAN_DEBUGLOG_AIS 16
+
+int cman_set_debuglog(cman_handle_t handle, int subsystems);
+
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...
@ 2007-12-05 14:28 pcaulfield
0 siblings, 0 replies; 4+ messages in thread
From: pcaulfield @ 2007-12-05 14:28 UTC (permalink / raw)
To: cluster-devel.redhat.com
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...
@ 2008-02-08 14:09 pcaulfield
0 siblings, 0 replies; 4+ messages in thread
From: pcaulfield @ 2008-02-08 14:09 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: pcaulfield at sourceware.org 2008-02-08 14:09:28
Modified files:
cman/cman_tool : main.c
cman/daemon : cnxman-socket.h commands.c
cman/lib : libcman.c libcman.h
Log message:
Implement a nicer way of getting the quorum disk information.
The libcman API remains the same but the connection to cman itself
works using the normal GETNODE call.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/main.c.diff?cvsroot=cluster&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.39&r2=1.40
--- cluster/cman/cman_tool/main.c 2007/12/05 14:28:58 1.61
+++ cluster/cman/cman_tool/main.c 2008/02/08 14:09:27 1.62
@@ -201,7 +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;
+ cman_qdev_info_t qinfo;
int quorate;
int i;
int j;
@@ -229,7 +229,7 @@
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)
+ 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);
--- cluster/cman/daemon/cnxman-socket.h 2007/12/05 14:28:58 1.21
+++ cluster/cman/daemon/cnxman-socket.h 2008/02/08 14:09:28 1.22
@@ -54,7 +54,6 @@
#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
--- cluster/cman/daemon/commands.c 2008/02/04 10:54:26 1.83
+++ cluster/cman/daemon/commands.c 2008/02/08 14:09:28 1.84
@@ -1024,21 +1024,6 @@
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;
@@ -1291,10 +1276,6 @@
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 2008/01/07 18:53:14 1.41
+++ cluster/cman/lib/libcman.c 2008/02/08 14:09:28 1.42
@@ -1041,14 +1041,15 @@
{
struct cman_handle *h = (struct cman_handle *)handle;
int ret;
- struct cl_qdev_info q;
+ struct cl_cluster_node cman_node;
VALIDATE_HANDLE(h);
- ret = info_call(h, CMAN_CMD_GET_QUORUMDEV, NULL, 0, &q, sizeof(q));
+ 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, q.name);
- info->qi_state = q.state;
- info->qi_votes = q.votes;
+ strcpy(info->qi_name, cman_node.name);
+ info->qi_state = cman_node.state;
+ info->qi_votes = cman_node.votes;
}
return ret;
}
--- cluster/cman/lib/libcman.h 2007/12/11 10:48:01 1.39
+++ cluster/cman/lib/libcman.h 2008/02/08 14:09:28 1.40
@@ -186,7 +186,7 @@
char qi_name[CMAN_MAX_NODENAME_LEN+1];
int qi_state;
int qi_votes;
-} cman_qdev_info;
+} cman_qdev_info_t;
/*
* NOTE: Apart from cman_replyto_shutdown(), you must not
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-08 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 14:28 [Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so pcaulfield
-- strict thread matches above, loose matches on Subject: below --
2008-02-08 14:09 pcaulfield
2007-09-17 13:48 pcaulfield
2007-08-28 13:14 pcaulfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).