TODO: server: add --panic-action and CTDB_PANIC_ACTION option for backtrace support
authorStefan Metzmacher <metze@samba.org>
Thu, 7 Jan 2010 08:21:56 +0000 (09:21 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 22 Dec 2010 14:59:01 +0000 (15:59 +0100)
pass cmdline parameters with spaces...

metze

Makefile.in
config/ctdb.init
config/ctdb.sysconfig
packaging/RPM/ctdb.spec.in
server/ctdbd.c

index e5ef81f5509b44136be0360fb7f33f26ec828bf6..668f35b3fd881b346fa87c710dbe256a1421be57 100755 (executable)
@@ -229,6 +229,7 @@ install: all
        ${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb
        ${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb
        ${INSTALLCMD} -m 755 config/interface_modify.sh $(DESTDIR)$(etcdir)/ctdb
+       ${INSTALLCMD} -m 755 config/gdb_backtrace $(DESTDIR)$(etcdir)/ctdb
        ${INSTALLCMD} -m 644 config/events.d/README $(DESTDIR)$(docdir)/ctdb/README.eventscripts
        ${INSTALLCMD} -m 644 doc/recovery-process.txt $(DESTDIR)$(docdir)/ctdb/recovery-process.txt
        ${INSTALLCMD} -m 755 config/events.d/00.ctdb $(DESTDIR)$(etcdir)/ctdb/events.d
index 25e158fcc5382abb6ce7f9266991f4854df45b51..0bdea5946c467a6b174b42383d016bd30408fbc8 100755 (executable)
@@ -80,6 +80,11 @@ build_ctdb_options () {
            sep=""
        }
 
+       # we may quote the value
+       [ -n "$4" ] && {
+           val="$4$2$4"
+       }
+
        CTDB_OPTIONS="${CTDB_OPTIONS}${CTDB_OPTIONS:+ }${1}${sep}${val}"
     }
 
@@ -109,6 +114,7 @@ build_ctdb_options () {
     maybe_set "--log-ringbuf-size"       "$CTDB_LOG_RINGBUF_SIZE"
     maybe_set "--syslog"                 "$CTDB_SYSLOG"               "yes"
     maybe_set "--max-persistent-check-errors" "$CTDB_MAX_PERSISTENT_CHECK_ERRORS"
+    maybe_set "--panic-action"           "$CTDB_PANIC_ACTION"         "" "'"
 }
 
 check_tdb () {
index 011593d7bcc36f49cd99d8d2b86f6a66c72fe6d6..87497553969bdf23c9fa3c42ac74d47377cd67cb 100644 (file)
@@ -295,6 +295,13 @@ CTDB_DEBUGLEVEL=ERR
 #    CTDB_SET_TRAVERSETIMEOUT=60
 # you can get a list of variables using "ctdb listvars"
 
+# setup a panic action which is triggerd when ctdbd
+# gets SIGABRT, SIGBUS, SIGSEGV or SIGFPE.
+#
+# The magic values %PID% and %PROG% will be substituted.
+#
+# CTDB_PANIC_ACTION="/etc/ctdb/gdb_backtrace %PID% %PROG%"
+
 # any other options you might want. Run ctdbd --help for a list
 # CTDB_OPTIONS=
 
index 1f43825ec237a9b12f7fb7aecf0598ca3b9476d9..c818c8751a4e2ac1a1e9a9af99e86b34b3069e55 100644 (file)
@@ -93,6 +93,8 @@ rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/ctdb/functions
 %attr(755,root,root) %{initdir}/ctdb
 
+%{_sysconfdir}/ctdb/gdb_backtrace
+
 %{_docdir}/ctdb/README.eventscripts
 %{_docdir}/ctdb/recovery-process.txt
 %{_sysconfdir}/ctdb/events.d/00.ctdb
index b90dbcdf1e41683d3f61e30bdb9bf0bf26689a45..4654d2dc418626a1bccd152a4c6e66a58b845c5c 100644 (file)
@@ -42,6 +42,7 @@ static struct {
        const char *public_interface;
        const char *single_public_ip;
        const char *node_ip;
+       const char *panic_action;
        int         valgrinding;
        int         use_syslog;
        int         start_as_disabled;
@@ -132,6 +133,9 @@ int main(int argc, const char *argv[])
                { "dbdir-persistent", 0, POPT_ARG_STRING, &options.db_dir_persistent, 0, "directory for persistent tdb files", NULL },
                { "dbdir-state", 0, POPT_ARG_STRING, &options.db_dir_state, 0, "directory for internal state tdb files", NULL },
                { "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" },
+               { "panic-action", 0, POPT_ARG_STRING,
+                 &options.panic_action, 0,
+                 "set the panic action (default none)", NULL },
                { "valgrinding", 0, POPT_ARG_NONE, &options.valgrinding, 0, "make valgrind more effective", NULL },
                { "syslog", 0, POPT_ARG_NONE, &options.use_syslog, 0, "log messages to syslog", NULL },
                { "start-as-disabled", 0, POPT_ARG_NONE, &options.start_as_disabled, 0, "Node starts in disabled state", NULL },
@@ -176,6 +180,7 @@ int main(int argc, const char *argv[])
 
        ctdb_block_signal(SIGPIPE);
        fault_setup("ctdbd");
+       panic_action = options.panic_action;
 
        ev = event_context_init(NULL);
        tevent_loop_allow_nesting(ev);