[Openais] [PATCH] diags: add a mechanism to trigger the writing the flight data
Angus Salkeld
asalkeld at redhat.com
Tue Apr 27 21:57:11 PDT 2010
trigger the dumping of flight data using:
corosync-objctl -w runtime.logsys.dump_flight_data=yes
then read the flight data as usual:
corosync-fplay
Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
exec/main.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/exec/main.c b/exec/main.c
index 155c91f..3d993c3 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1256,6 +1256,51 @@ 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");
+ }
+}
+
+static void corosync_fplay_control_init (void)
+{
+ hdb_handle_t object_find_handle;
+ hdb_handle_t object_runtime_handle;
+ hdb_handle_t object_fplay_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;
+ }
+
+ /* Connection objects */
+ objdb->object_create (object_runtime_handle,
+ &object_fplay_handle,
+ "logsys", strlen ("logsys"));
+
+ objdb->object_key_create_typed (object_fplay_handle,
+ "dump_flight_data", "no", strlen("no"),
+ OBJDB_VALUETYPE_STRING);
+
+ objdb->object_track_start (object_fplay_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 +1344,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 (
--
1.6.6.1
More information about the Openais
mailing list