[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/cman cman_tool/main.c daemon/cnxman-so ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]