[SCM] CTDB repository - branch master updated - ctdb-1.0.62-2-g06097b8

Ronnie Sahlberg sahlberg at samba.org
Fri Oct 17 02:38:04 GMT 2008


The branch, master has been updated
       via  06097b88709ced09d1f9f869eed9a54e6d2fedbf (commit)
       via  cdc79d4f22f1a6aec5c34115969421f93663932a (commit)
      from  49431e799ba7f7c78f596fdf896316a2e22c745e (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 06097b88709ced09d1f9f869eed9a54e6d2fedbf
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Oct 17 09:02:03 2008 +1100

    make it possible to set the script log level in CTDB sysconfig

commit cdc79d4f22f1a6aec5c34115969421f93663932a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Oct 17 07:56:12 2008 +1100

    specify a "script log level" on the commandline to set under which log
    level any/all output from eventscripts will be logged as

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

Summary of changes:
 config/ctdb.init       |    3 +++
 include/ctdb_private.h |    2 ++
 server/ctdb_logging.c  |   12 +++++++++---
 server/ctdbd.c         |    6 ++++++
 4 files changed, 20 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index eb56ef6..9e06c24 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -75,6 +75,9 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
 [ -z "$CTDB_LVS_PUBLIC_IP" ] || {
 	CTDB_OPTIONS="$CTDB_OPTIONS --lvs"
 }
+[ -z "$CTDB_SCRIPT_LOG_LEVEL" ] || {
+	CTDB_OPTIONS="$CTDB_OPTIONS --script-log-level=$CTDB_SCRIPT_LOG_LEVEL"
+}
 
 if [ "$CTDB_VALGRIND" = "yes" ]; then
     init_style="valgrind"
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 7bcd4a9..756c62a 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1423,4 +1423,6 @@ void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip);
 
 int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
 
+extern int script_log_level;
+
 #endif
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index f551088..06c7eb8 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -151,6 +151,8 @@ static void ctdb_log_handler(struct event_context *ev, struct fd_event *fde,
 		ctdb->log->buf_used += n;
 	}
 
+	this_log_level = script_log_level;
+
 	while (ctdb->log->buf_used > 0 &&
 	       (p = memchr(ctdb->log->buf, '\n', ctdb->log->buf_used)) != NULL) {
 		int n1 = (p - ctdb->log->buf)+1;
@@ -159,7 +161,9 @@ static void ctdb_log_handler(struct event_context *ev, struct fd_event *fde,
 		if (n2 > 0 && ctdb->log->buf[n2-1] == '\r') {
 			n2--;
 		}
-		do_debug("%*.*s\n", n2, n2, ctdb->log->buf);
+		if (script_log_level <= LogLevel) {
+			do_debug("%*.*s\n", n2, n2, ctdb->log->buf);
+		}
 		memmove(ctdb->log->buf, p+1, sizeof(ctdb->log->buf) - n1);
 		ctdb->log->buf_used -= n1;
 	}
@@ -167,8 +171,10 @@ static void ctdb_log_handler(struct event_context *ev, struct fd_event *fde,
 	/* the buffer could have completely filled - unfortunately we have
 	   no choice but to dump it out straight away */
 	if (ctdb->log->buf_used == sizeof(ctdb->log->buf)) {
-		do_debug("%*.*s\n", 
-			 (int)ctdb->log->buf_used, (int)ctdb->log->buf_used, ctdb->log->buf);
+		if (script_log_level <= LogLevel) {
+			do_debug("%*.*s\n", 
+				(int)ctdb->log->buf_used, (int)ctdb->log->buf_used, ctdb->log->buf);
+		}
 		ctdb->log->buf_used = 0;
 	}
 }
diff --git a/server/ctdbd.c b/server/ctdbd.c
index 4dc0f74..8e15df0 100644
--- a/server/ctdbd.c
+++ b/server/ctdbd.c
@@ -46,6 +46,7 @@ static struct {
 	int         no_lmaster;
 	int         no_recmaster;
 	int         lvs;
+	int	    script_log_level;
 } options = {
 	.nlist = ETCDIR "/ctdb/nodes",
 	.transport = "tcp",
@@ -53,8 +54,10 @@ static struct {
 	.logfile = VARDIR "/log/log.ctdb",
 	.db_dir = VARDIR "/ctdb",
 	.db_dir_persistent = VARDIR "/ctdb/persistent",
+	.script_log_level = DEBUG_ERR,
 };
 
+int script_log_level;
 
 /*
   called by the transport layer when a packet comes in
@@ -126,6 +129,7 @@ int main(int argc, const char *argv[])
 		{ "no-lmaster", 0, POPT_ARG_NONE, &options.no_lmaster, 0, "disable lmaster role on this node", NULL },
 		{ "no-recmaster", 0, POPT_ARG_NONE, &options.no_recmaster, 0, "disable recmaster role on this node", NULL },
 		{ "lvs", 0, POPT_ARG_NONE, &options.lvs, 0, "lvs is enabled on this node", NULL },
+		{ "script-log-level", 0, POPT_ARG_INT, &options.script_log_level, DEBUG_ERR, "log level of event script output", NULL },
 		POPT_TABLEEND
 	};
 	int opt, ret;
@@ -167,6 +171,8 @@ int main(int argc, const char *argv[])
 
 	ctdb->start_as_disabled = options.start_as_disabled;
 
+	script_log_level = options.script_log_level;
+
 	ret = ctdb_set_logfile(ctdb, options.logfile, options.use_syslog);
 	if (ret == -1) {
 		printf("ctdb_set_logfile to %s failed - %s\n", 


-- 
CTDB repository


More information about the samba-cvs mailing list