[SCM] CTDB repository - branch 1.0.56 updated - ctdb-1.0.56-1-3-gdb97b00

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


The branch, 1.0.56 has been updated
       via  db97b004e87686f4f7da2d7cb39d0c3c5b6dd770 (commit)
       via  2e3f26e3e62d4f76dcb03d6842fbf2de093cd37b (commit)
      from  25000c39a9013bf60c6a8a0396c168df14365adb (commit)

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


- Log -----------------------------------------------------------------
commit db97b004e87686f4f7da2d7cb39d0c3c5b6dd770
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 2e3f26e3e62d4f76dcb03d6842fbf2de093cd37b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Oct 17 08:37: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
    
    new version 1.0.56-2

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

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


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 72de84d..2119cc8 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 f44a940..ebb7abb 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1376,4 +1376,6 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
 int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb, 
 				  struct ctdb_req_control *c);
 
+extern int script_log_level;
+
 #endif
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index 6c6d8d3..9c76285 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0
-Release: 56_1
+Release: 56_2
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -118,6 +118,9 @@ fi
 %{_includedir}/ctdb_private.h
 
 %changelog
+* Fri Oct 17 2008 : Version 1.0.56-2
+ - Add an option to force all output from eventscripts and rc.local to be logged
+   at a specific log level.
 * Tue Sep 16 2008 : Version 1.0.56-1
  - backported fixes for three memory leaks from HEAD
 * Mon Aug 11 2008 : Version 1.0.56
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 b797904..35e1cca 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