shouldn't corosync-blackbox be installed on the system? Wouldn't make distcheck fail with this patch?
Regards -steve On Sun, 2010-05-02 at 22:12 +1000, Angus Salkeld wrote: > This is an updated patch with a wrapper script and dump functionality > as well. > > > trigger the dumping of flight data using: > corosync-objctl -w runtime.blackbox.dump_flight_data=anything > trigger the dumping of state using: > corosync-objctl -w runtime.blackbox.dump_state=anything > > then read the flight data as usual: > corosync-fplay > > This patch includes a wrapper script called: > corosync-blackbox > > Signed-off-by: Angus Salkeld <[email protected]> > --- > exec/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++--- > services/cpg.c | 10 +++++++- > tools/corosync-blackbox | 35 ++++++++++++++++++++++++++++ > 3 files changed, 97 insertions(+), 5 deletions(-) > create mode 100755 tools/corosync-blackbox > > diff --git a/exec/main.c b/exec/main.c > index 155c91f..2275490 100644 > --- a/exec/main.c > +++ b/exec/main.c > @@ -187,11 +187,8 @@ static void *corosync_exit_thread_handler (void *arg) > > static void sigusr2_handler (int num) > { > - /* > - * TODO remove this from sigusr2 handler and access via cfg service > - * engine api - corosync-cfgtool > - */ > corosync_state_dump (); > + logsys_log_rec_store (LOCALSTATEDIR "/lib/corosync/fdata"); > } > > static void sigterm_handler (int num) > @@ -1256,6 +1253,57 @@ static void corosync_setscheduler (void) > #endif > } > > +static void fplay_key_change_notify_fn ( > + object_change_type_t change_type, > + hdb_handle_t parent_object_handle, > + hdb_handle_t object_handle, > + const void *object_name_pt, size_t object_name_len, > + const void *key_name_pt, size_t key_len, > + const void *key_value_pt, size_t key_value_len, > + void *priv_data_pt) > +{ > + if (key_len == strlen ("dump_flight_data") && > + memcmp ("dump_flight_data", key_name_pt, key_len) == 0) { > + logsys_log_rec_store (LOCALSTATEDIR "/lib/corosync/fdata"); > + } > + if (key_len == strlen ("dump_state") && > + memcmp ("dump_state", key_name_pt, key_len) == 0) { > + corosync_state_dump (); > + } > +} > + > +static void corosync_fplay_control_init (void) > +{ > + hdb_handle_t object_find_handle; > + hdb_handle_t object_runtime_handle; > + hdb_handle_t object_blackbox_handle; > + > + objdb->object_find_create (OBJECT_PARENT_HANDLE, > + "runtime", strlen ("runtime"), > + &object_find_handle); > + > + if (objdb->object_find_next (object_find_handle, > + &object_runtime_handle) != 0) { > + return; > + } > + > + objdb->object_create (object_runtime_handle, > + &object_blackbox_handle, > + "blackbox", strlen ("blackbox")); > + > + objdb->object_key_create_typed (object_blackbox_handle, > + "dump_flight_data", "no", strlen("no"), > + OBJDB_VALUETYPE_STRING); > + objdb->object_key_create_typed (object_blackbox_handle, > + "dump_state", "no", strlen("no"), > + OBJDB_VALUETYPE_STRING); > + > + objdb->object_track_start (object_blackbox_handle, > + OBJECT_TRACK_DEPTH_RECURSIVE, > + fplay_key_change_notify_fn, > + NULL, NULL, NULL, NULL); > +} > + > static void corosync_stats_init (void) > { > hdb_handle_t object_find_handle; > @@ -1299,6 +1347,7 @@ static void main_service_ready (void) > evil_init (api); > corosync_stats_init (); > corosync_totem_stats_init (); > + corosync_fplay_control_init (); > if (minimum_sync_mode == CS_SYNC_V2) { > log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to > none. Using V2 of the synchronization engine.\n"); > sync_v2_init ( > diff --git a/services/cpg.c b/services/cpg.c > index 8ce74ae..2a8180b 100644 > --- a/services/cpg.c > +++ b/services/cpg.c > @@ -253,6 +253,8 @@ static void cpg_sync_init_v2 ( > size_t member_list_entries, > const struct memb_ring_id *ring_id); > > +static void cpg_exec_dump (void); > + > static int cpg_sync_process (void); > > static void cpg_sync_activate (void); > @@ -343,7 +345,7 @@ struct corosync_service_engine cpg_service_engine = { > .lib_engine = cpg_lib_engine, > .lib_engine_count = sizeof (cpg_lib_engine) / > sizeof (struct corosync_lib_handler), > .exec_init_fn = cpg_exec_init_fn, > - .exec_dump_fn = NULL, > + .exec_dump_fn = cpg_exec_dump, > .exec_engine = cpg_exec_engine, > .exec_engine_count = sizeof (cpg_exec_engine) / > sizeof (struct corosync_exec_handler), > .sync_mode = CS_SYNC_V1_APIV2, > @@ -444,6 +446,12 @@ static int memb_list_remove_value (unsigned int *list, > return list_entries; > } > > + > +static void cpg_exec_dump (void) > +{ > + log_printf (LOGSYS_LEVEL_DEBUG, "hello"); > +} > + > static void cpg_sync_init_v2 ( > const unsigned int *trans_list, > size_t trans_list_entries, > diff --git a/tools/corosync-blackbox b/tools/corosync-blackbox > new file mode 100755 > index 0000000..b1c27ec > --- /dev/null > +++ b/tools/corosync-blackbox > @@ -0,0 +1,35 @@ > +#!/bin/sh > +# Copyright (c) 2010 Red Hat, Inc. > +# > +# Authors: Angus Salkeld <[email protected] > +# > +# This software licensed under BSD license, the text of which follows: > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions are met: > +# > +# - Redistributions of source code must retain the above copyright notice, > +# this list of conditions and the following disclaimer. > +# - Redistributions in binary form must reproduce the above copyright notice, > +# this list of conditions and the following disclaimer in the documentation > +# and/or other materials provided with the distribution. > +# - Neither the name of the MontaVista Software, Inc. nor the names of its > +# contributors may be used to endorse or promote products derived from this > +# software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" > +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE > +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF > +# THE POSSIBILITY OF SUCH DAMAGE. > + > +corosync-objctl -w runtime.blackbox.dump_state=$(date +%s) > +corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +%s) > +corosync-fplay > + _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
