From 5c092b9eac78cb2b1f85df0c367cf3a930f6cc40 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 7 Jan 2010 09:21:56 +0100 Subject: [PATCH] TODO: server: add --panic-action and CTDB_PANIC_ACTION option for backtrace support pass cmdline parameters with spaces... metze --- Makefile.in | 1 + config/ctdb.init | 6 ++++++ config/ctdb.sysconfig | 7 +++++++ packaging/RPM/ctdb.spec.in | 2 ++ server/ctdbd.c | 5 +++++ 5 files changed, 21 insertions(+) diff --git a/Makefile.in b/Makefile.in index e5ef81f5..668f35b3 100755 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/config/ctdb.init b/config/ctdb.init index 25e158fc..0bdea594 100755 --- a/config/ctdb.init +++ b/config/ctdb.init @@ -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 () { diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig index 011593d7..87497553 100644 --- a/config/ctdb.sysconfig +++ b/config/ctdb.sysconfig @@ -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= diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in index 1f43825e..c818c875 100644 --- a/packaging/RPM/ctdb.spec.in +++ b/packaging/RPM/ctdb.spec.in @@ -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 diff --git a/server/ctdbd.c b/server/ctdbd.c index b90dbcdf..4654d2dc 100644 --- a/server/ctdbd.c +++ b/server/ctdbd.c @@ -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); -- 2.34.1