TS-3231: use CoreAPI Reconfigure from traffic_manager When traffic_manager gets a SIGHUP, use the Core Reconfigure() API, rather than hitting the local manager directly. Rename the Core Diags() API to not conflict with ink_diags Diags() macro.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b64dfa79 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b64dfa79 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b64dfa79 Branch: refs/heads/master Commit: b64dfa79c111fea1f293453c4e285d0a6018c007 Parents: 948b6af Author: James Peach <[email protected]> Authored: Mon Nov 17 09:16:01 2014 -0800 Committer: James Peach <[email protected]> Committed: Tue Dec 9 13:47:51 2014 -0800 ---------------------------------------------------------------------- cmd/traffic_manager/Makefile.am | 1 + cmd/traffic_manager/traffic_manager.cc | 4 ++-- doc/reference/commands/traffic_manager.en.rst | 10 ++++++++++ lib/records/P_RecCore.cc | 2 +- mgmt/api/CoreAPI.cc | 2 +- mgmt/api/CoreAPI.h | 2 +- mgmt/api/CoreAPIRemote.cc | 2 +- mgmt/api/INKMgmtAPI.cc | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/cmd/traffic_manager/Makefile.am ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/Makefile.am b/cmd/traffic_manager/Makefile.am index 289c01c..d7d953a 100644 --- a/cmd/traffic_manager/Makefile.am +++ b/cmd/traffic_manager/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/proxy/hdrs \ -I$(top_srcdir)/proxy/shared \ -I$(top_srcdir)/mgmt \ + -I$(top_srcdir)/mgmt/api \ -I$(top_srcdir)/mgmt/api/include \ -I$(top_srcdir)/mgmt/cluster \ -I$(top_srcdir)/mgmt/utils \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/cmd/traffic_manager/traffic_manager.cc ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc index 9489544..93d62d9 100644 --- a/cmd/traffic_manager/traffic_manager.cc +++ b/cmd/traffic_manager/traffic_manager.cc @@ -39,6 +39,7 @@ #include "URL.h" #include "MIME.h" #include "HTTP.h" +#include "CoreAPI.h" // Needs LibRecordsConfigInit() #include "RecordsConfig.h" @@ -692,8 +693,7 @@ main(int argc, char **argv) // Check for a SIGHUP if (sigHupNotifier != 0) { mgmt_log(stderr, "[main] Reading Configuration Files due to SIGHUP\n"); - configFiles->rereadConfig(); - lmgmt->signalEvent(MGMT_EVENT_PLUGIN_CONFIG_UPDATE, "*"); + Reconfigure(); sigHupNotifier = 0; mgmt_log(stderr, "[main] Reading Configuration Files Reread\n"); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/doc/reference/commands/traffic_manager.en.rst ---------------------------------------------------------------------- diff --git a/doc/reference/commands/traffic_manager.en.rst b/doc/reference/commands/traffic_manager.en.rst index 1267cf2..faaf439 100644 --- a/doc/reference/commands/traffic_manager.en.rst +++ b/doc/reference/commands/traffic_manager.en.rst @@ -49,3 +49,13 @@ Environment .. envvar:: MGMT_CLUSTER_RS_PORT .. envvar:: MGMT_GROUP_ADDR +Signals +======= + +SIGHUP + This signal causes a reconfiguration event, equivalent to running :program:`traffic_line -x`. + +See also +======== + +:manpage:`traffic_line(8)` http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/lib/records/P_RecCore.cc ---------------------------------------------------------------------- diff --git a/lib/records/P_RecCore.cc b/lib/records/P_RecCore.cc index d42bdfe..1296fe0 100644 --- a/lib/records/P_RecCore.cc +++ b/lib/records/P_RecCore.cc @@ -796,7 +796,7 @@ RecSyncConfigToTB(textBuffer * tb, bool *inc_version) //------------------------------------------------------------------------- -// RecExecConifgUpdateCbs +// RecExecConfigUpdateCbs //------------------------------------------------------------------------- int RecExecConfigUpdateCbs(unsigned int update_required_type) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/mgmt/api/CoreAPI.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc index 059bd1e..5b61f3a 100644 --- a/mgmt/api/CoreAPI.cc +++ b/mgmt/api/CoreAPI.cc @@ -94,7 +94,7 @@ Terminate() * Uses the Traffic Manager diags object to display the diags output. */ void -Diags(TSDiagsT mode, const char *fmt, va_list ap) +DiagnosticMessage(TSDiagsT mode, const char *fmt, va_list ap) { // Mapping TSDiagsT to Diags.h:DiagsLevel // Simple casting would work, but not inflexible http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/mgmt/api/CoreAPI.h ---------------------------------------------------------------------- diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h index a1b2f89..93ef6ec 100644 --- a/mgmt/api/CoreAPI.h +++ b/mgmt/api/CoreAPI.h @@ -38,7 +38,7 @@ TSMgmtError Init(const char *socket_path = NULL, TSInitOptionT options = TS_MGMT_OPT_DEFAULTS); TSMgmtError Terminate(); -void Diags(TSDiagsT mode, const char * fmt, va_list ap); +void DiagnosticMessage(TSDiagsT mode, const char * fmt, va_list ap); /*************************************************************************** * Control Operations http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/mgmt/api/CoreAPIRemote.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc index 00b2bda..531659a 100644 --- a/mgmt/api/CoreAPIRemote.cc +++ b/mgmt/api/CoreAPIRemote.cc @@ -289,7 +289,7 @@ Terminate() // diagnostics, the diagnostics will be outputted to the machine // the remote client is logged into (the one TM is running on) void -Diags(TSDiagsT mode, const char *fmt, va_list ap) +DiagnosticMessage(TSDiagsT mode, const char *fmt, va_list ap) { char diag_msg[MAX_BUF_SIZE]; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b64dfa79/mgmt/api/INKMgmtAPI.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc index 814a90f..dbfbe6b 100644 --- a/mgmt/api/INKMgmtAPI.cc +++ b/mgmt/api/INKMgmtAPI.cc @@ -1842,7 +1842,7 @@ TSDiags(TSDiagsT mode, const char *fmt, ...) va_list ap; va_start(ap, fmt); // initialize the argument pointer ap - Diags(mode, fmt, ap); + DiagnosticMessage(mode, fmt, ap); va_end(ap); return;
