Add support for reenabling a failed redundant ring and printing ring status

through the test/opeanis-cfgtool application.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1137 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2006-07-19 19:31:01 +00:00
parent b776747e9a
commit 640cfba2ab
20 changed files with 861 additions and 900 deletions

View File

@ -102,6 +102,7 @@ install:
ln -sf libSaMsg.so.2.0.0 lib/libSaMsg.so.2
ln -sf libevs.so.2.0.0 lib/libevs.so.2
ln -sf libcpg.so.2.0.0 lib/libcpg.so.2
ln -sf libcfg.so.2.0.0 lib/libcfg.so.2
ln -sf libtotem_pg.so.2.0.0 exec/libtotem_pg.so.2
cp -a lib/libais.so $(DESTDIR)$(LIBDIR)
@ -112,6 +113,7 @@ install:
cp -a lib/libSaMsg.so $(DESTDIR)$(LIBDIR)
cp -a lib/libevs.so $(DESTDIR)$(LIBDIR)
cp -a lib/libcpg.so $(DESTDIR)$(LIBDIR)
cp -a lib/libcfg.so $(DESTDIR)$(LIBDIR)
cp -a exec/libtotem_pg.so $(DESTDIR)$(LIBDIR)
cp -a lib/libais.so.2 $(DESTDIR)$(LIBDIR)
@ -122,6 +124,7 @@ install:
cp -a lib/libSaMsg.so.2 $(DESTDIR)$(LIBDIR)
cp -a lib/libevs.so.2 $(DESTDIR)$(LIBDIR)
cp -a lib/libcpg.so.2 $(DESTDIR)$(LIBDIR)
cp -a lib/libcfg.so.2 $(DESTDIR)$(LIBDIR)
cp -a exec/libtotem_pg.so.2 $(DESTDIR)$(LIBDIR)
install -m 755 lib/libais.so.2.* $(DESTDIR)$(LIBDIR)
@ -133,6 +136,7 @@ install:
install -m 755 lib/libSaMsg.so.2.* $(DESTDIR)$(LIBDIR)
install -m 755 lib/libevs.so.2.* $(DESTDIR)$(LIBDIR)
install -m 755 lib/libcpg.so.2.* $(DESTDIR)$(LIBDIR)
install -m 755 lib/libcfg.so.2.* $(DESTDIR)$(LIBDIR)
install -m 755 exec/libtotem_pg.so.2.* $(DESTDIR)$(LIBDIR)
ifneq "NO" "$(STATICLIBS)"
@ -147,6 +151,7 @@ ifneq "NO" "$(STATICLIBS)"
install -m 755 lib/libcpg.a $(DESTDIR)$(LIBDIR)
install -m 755 lib/libevs.a $(DESTDIR)$(LIBDIR)
install -m 755 lib/libcpg.a $(DESTDIR)$(LIBDIR)
install -m 755 lib/libcfg.a $(DESTDIR)$(LIBDIR)
install -m 755 exec/libtotem_pg.a $(DESTDIR)$(LIBDIR)
endif
@ -168,6 +173,7 @@ endif
install -m 644 include/saLck.h $(DESTDIR)$(INCLUDEDIR)
install -m 644 include/saMsg.h $(DESTDIR)$(INCLUDEDIR)
install -m 644 include/cpg.h $(DESTDIR)$(INCLUDEDIR)
install -m 644 include/cfg.h $(DESTDIR)$(INCLUDEDIR)
install -m 644 include/evs.h $(DESTDIR)$(INCLUDEDIR)
install -m 644 exec/aispoll.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
install -m 644 exec/totempg.h $(DESTDIR)$(INCLUDEDIR_TOTEM)

View File

@ -1,4 +1,5 @@
# Copyright (c) 2002-2006 MontaVista Software, Inc.
#
# All rights reserved.
#
@ -315,9 +316,9 @@ msg.o: ../include/list.h ../include/queue.h ../lcr/lcr_comp.h service.h
msg.o: totem.h totemip.h objdb.h aispoll.h mempool.h util.h main.h
msg.o: ../include/saClm.h ../include/ipc_gen.h ../exec/totemip.h mainconfig.h
msg.o: totemsrp.h totempg.h print.h
cfg.o: ../include/saAis.h ../include/openaisCfg.h ../include/saAis.h
cfg.o: ../include/saAis.h ../include/cfg.h ../include/saAis.h
cfg.o: ../include/ipc_gen.h ../exec/totemip.h ../include/ipc_cfg.h
cfg.o: ../include/ipc_gen.h ../include/openaisCfg.h ../include/list.h
cfg.o: ../include/ipc_gen.h ../include/cfg.h ../include/list.h
cfg.o: ../include/queue.h ../lcr/lcr_comp.h service.h totem.h totemip.h
cfg.o: objdb.h totempg.h aispoll.h totemsrp.h mempool.h util.h print.h
cfg.o: mainconfig.h

View File

@ -47,10 +47,14 @@
#include <string.h>
#include "../include/saAis.h"
#include "../include/openaisCfg.h"
#include "../include/cfg.h"
#include "../include/mar_gen.h"
#include "../include/ipc_gen.h"
#include "../include/ipc_cfg.h"
#include "../include/list.h"
#include "totem.h"
#include "totempg.h"
#include "ipc.h"
#include "../include/queue.h"
#include "../lcr/lcr_comp.h"
#include "service.h"
@ -58,10 +62,11 @@
#include "mempool.h"
#include "util.h"
#include "print.h"
#include "main.h"
#define LOG_LEVEL_FROM_LIB LOG_LEVEL_DEBUG
#define LOG_LEVEL_FROM_GMI LOG_LEVEL_DEBUG
#define LOG_LEVEL_ENTER_FUNC LOG_LEVEL_DEBUG
enum cfg_message_req_types {
MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0
};
static void cfg_confchg_fn (
enum totem_configuration_type configuration_type,
@ -76,13 +81,33 @@ static int cfg_lib_init_fn (void *conn);
static int cfg_lib_exit_fn (void *conn);
static void message_handler_req_lib_cfg_statetrackstart (void *conn, void *msg);
static void message_handler_req_exec_cfg_ringreenable (
void *message,
unsigned int nodeid);
static void message_handler_req_lib_cfg_statetrackstop (void *conn, void *msg);
static void message_handler_req_lib_cfg_ringstatusget (
void *conn,
void *msg);
static void message_handler_req_lib_cfg_administrativestateset (void *conn, void *msg);
static void message_handler_req_lib_cfg_ringreenable (
void *conn,
void *msg);
static void message_handler_req_lib_cfg_administrativestateget (void *conn, void *msg);
static void message_handler_req_lib_cfg_statetrack (
void *conn,
void *msg);
static void message_handler_req_lib_cfg_statetrackstop (
void *conn,
void *msg);
static void message_handler_req_lib_cfg_administrativestateset (
void *conn,
void *msg);
static void message_handler_req_lib_cfg_administrativestateget (
void *conn,
void *msg);
/*
* Service Handler Definition
@ -90,8 +115,20 @@ static void message_handler_req_lib_cfg_administrativestateget (void *conn, void
static struct openais_lib_handler cfg_lib_service[] =
{
{ /* 0 */
.lib_handler_fn = message_handler_req_lib_cfg_statetrackstart,
.response_size = sizeof (struct res_lib_cfg_statetrackstart),
.lib_handler_fn = message_handler_req_lib_cfg_ringstatusget,
.response_size = sizeof (struct res_lib_cfg_ringstatusget),
.response_id = MESSAGE_RES_CFG_RINGSTATUSGET,
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
},
{ /* 0 */
.lib_handler_fn = message_handler_req_lib_cfg_ringreenable,
.response_size = sizeof (struct res_lib_cfg_ringreenable),
.response_id = MESSAGE_RES_CFG_RINGREENABLE,
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
},
{ /* 0 */
.lib_handler_fn = message_handler_req_lib_cfg_statetrack,
.response_size = sizeof (struct res_lib_cfg_statetrack),
.response_id = MESSAGE_RES_CFG_STATETRACKSTART,
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
},
@ -118,13 +155,8 @@ static struct openais_lib_handler cfg_lib_service[] =
static struct openais_exec_handler cfg_exec_service[] =
{
{
message_handler_req_exec_cfg_ringreenable
}
/*
message_handler_req_exec_cfg_componentregister,
message_handler_req_exec_cfg_componentunregister,
message_handler_req_exec_cfg_componenterrorreport,
message_handler_req_exec_cfg_componenterrorclear,
*/
};
/*
@ -183,6 +215,11 @@ __attribute__ ((constructor)) static void register_this_component (void) {
lcr_component_register (&cfg_comp_ver0);
}
struct req_exec_cfg_ringreenable {
mar_req_header_t header __attribute__((aligned(8)));
mar_message_source_t source __attribute__((aligned(8)));
};
/* IMPL */
static int cfg_exec_init_fn (struct objdb_iface_ver0 *objdb)
@ -206,22 +243,113 @@ int cfg_lib_exit_fn (void *conn)
static int cfg_lib_init_fn (void *conn)
{
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize configuration service.\n");
ENTER("");
LEAVE("");
return (0);
}
/*
* Executive message handlers
*/
static void message_handler_req_exec_cfg_ringreenable (
void *message,
unsigned int nodeid)
{
struct req_exec_cfg_ringreenable *req_exec_cfg_ringreenable =
(struct req_exec_cfg_ringreenable *)message;
struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
ENTER("");
totempg_ring_reenable ();
if (message_source_is_local(&req_exec_cfg_ringreenable->source)) {
res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
res_lib_cfg_ringreenable.header.error = SA_AIS_OK;
openais_conn_send_response (
req_exec_cfg_ringreenable->source.conn,
&res_lib_cfg_ringreenable,
sizeof (struct res_lib_cfg_ringreenable));
}
LEAVE("");
}
/*
* Library Interface Implementation
*/
static void message_handler_req_lib_cfg_statetrackstart (
static void message_handler_req_lib_cfg_ringstatusget (
void *conn,
void *msg)
{
// struct req_lib_cfg_statetrackstart *req_lib_cfg_statetrackstart = (struct req_lib_cfg_statetrackstart *)message;
struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
struct totem_ip_address interfaces[INTERFACE_MAX];
unsigned int iface_count;
char **status;
char *totem_ip_string;
unsigned int i;
log_printf (LOG_LEVEL_FROM_LIB,
"Handle : message_handler_req_lib_cfg_statetrackstart()\n");
ENTER("");
res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET;
res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
res_lib_cfg_ringstatusget.header.error = SA_AIS_OK;
totempg_ifaces_get (
this_ip->nodeid,
interfaces,
&status,
&iface_count);
res_lib_cfg_ringstatusget.interface_count = iface_count;
for (i = 0; i < iface_count; i++) {
totem_ip_string = (char *)totemip_print (&interfaces[i]);
strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
status[i]);
strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
totem_ip_string);
}
openais_conn_send_response (
conn,
&res_lib_cfg_ringstatusget,
sizeof (struct res_lib_cfg_ringstatusget));
LEAVE("");
}
static void message_handler_req_lib_cfg_ringreenable (
void *conn,
void *msg)
{
struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable;
struct iovec iovec;
ENTER("");
req_exec_cfg_ringreenable.header.size =
sizeof (struct req_exec_cfg_ringreenable);
req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
MESSAGE_REQ_EXEC_CFG_RINGREENABLE);
message_source_set (&req_exec_cfg_ringreenable.source, conn);
iovec.iov_base = &req_exec_cfg_ringreenable;
iovec.iov_len = sizeof (struct req_exec_cfg_ringreenable);
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
TOTEMPG_SAFE) == 0);
LEAVE("");
}
static void message_handler_req_lib_cfg_statetrack (
void *conn,
void *msg)
{
// struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message;
ENTER("");
LEAVE("");
}
static void message_handler_req_lib_cfg_statetrackstop (
@ -230,8 +358,8 @@ static void message_handler_req_lib_cfg_statetrackstop (
{
// struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
log_printf (LOG_LEVEL_FROM_LIB,
"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
ENTER("");
LEAVE("");
}
static void message_handler_req_lib_cfg_administrativestateset (
@ -239,15 +367,15 @@ static void message_handler_req_lib_cfg_administrativestateset (
void *msg)
{
// struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
log_printf (LOG_LEVEL_FROM_LIB,
"Handle : message_handler_req_lib_cfg_administrativestateset()\n");
ENTER("");
LEAVE("");
}
static void message_handler_req_lib_cfg_administrativestateget (
void *conn,
void *msg)
{
// struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
log_printf (LOG_LEVEL_FROM_LIB,
"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
ENTER("");
LEAVE("");
}

View File

@ -1,560 +0,0 @@
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
21.95 0.09 0.09 274959 0.00 0.00 message_handler_mcast
19.51 0.17 0.08 274977 0.00 0.00 pending_queues_deliver
9.76 0.21 0.04 1655 0.02 0.05 user_deliver
9.76 0.25 0.04 1 40.00 409.61 poll_run
7.32 0.28 0.03 322067 0.00 0.00 timerlist_expire
7.32 0.31 0.03 1623 0.02 0.03 deliver_fn
4.88 0.33 0.02 322068 0.00 0.00 timerlist_timeout_msec
4.88 0.35 0.02 322046 0.00 0.00 recv_handler
2.44 0.36 0.01 47021 0.00 0.00 timerlist_add_future
2.44 0.37 0.01 46913 0.00 0.00 message_handler_orf_token
2.44 0.38 0.01 46913 0.00 0.00 orf_token_mcast
2.44 0.39 0.01 46878 0.00 0.00 messages_free
2.44 0.40 0.01 1632 0.01 0.01 SaNameTisNameT
2.44 0.41 0.01 1527 0.01 0.01 message_handler_req_exec_ckpt_sectionwrite
0.00 0.41 0.00 47304 0.00 0.00 poll_timer_delete
0.00 0.41 0.00 47021 0.00 0.00 poll_timer_add
0.00 0.41 0.00 47021 0.00 0.00 timerlist_add
0.00 0.41 0.00 47019 0.00 0.00 timerlist_del
0.00 0.41 0.00 46913 0.00 0.00 orf_token_evs
0.00 0.41 0.00 46913 0.00 0.00 orf_token_rtr
0.00 0.41 0.00 46878 0.00 0.00 sq_items_release
0.00 0.41 0.00 1655 0.00 0.00 pend_delv_next_delivery_find
0.00 0.41 0.00 1623 0.00 0.00 queue_reinit
0.00 0.41 0.00 726 0.00 0.00 internal_log_printf
0.00 0.41 0.00 125 0.00 0.00 mempool_free
0.00 0.41 0.00 125 0.00 0.00 mempool_strdup
0.00 0.41 0.00 125 0.00 0.00 strstr_rs
0.00 0.41 0.00 71 0.00 0.00 ckptConfChg
0.00 0.41 0.00 71 0.00 0.00 clmConfChg
0.00 0.41 0.00 71 0.00 0.00 confchg_fn
0.00 0.41 0.00 71 0.00 0.00 libraryNotificationLeave
0.00 0.41 0.00 70 0.00 0.00 message_handler_memb_form_token
0.00 0.41 0.00 53 0.00 0.00 message_handler_req_exec_clm_nodejoin
0.00 0.41 0.00 52 0.00 0.00 message_handler_memb_attempt_join
0.00 0.41 0.00 52 0.00 0.00 message_handler_memb_join
0.00 0.41 0.00 41 0.00 0.01 message_handler_req_exec_ckpt_checkpointopen
0.00 0.41 0.00 36 0.00 0.00 SaNameTisEqual
0.00 0.41 0.00 35 0.00 0.00 memb_form_token_conf_desc_build
0.00 0.41 0.00 35 0.00 0.00 queues_pend_delv_memb_new
0.00 0.41 0.00 35 0.00 0.00 sq_reinit
0.00 0.41 0.00 20 0.00 0.00 queue_init
0.00 0.41 0.00 19 0.00 0.00 memb_state_commit_enter
0.00 0.41 0.00 19 0.00 0.00 memb_state_gather_enter
0.00 0.41 0.00 18 0.00 0.02 findComponent
0.00 0.41 0.00 18 0.00 0.00 gmi_mcast
0.00 0.41 0.00 18 0.00 0.00 gmi_pend_trans_item_store
0.00 0.41 0.00 18 0.00 0.00 libraryNotificationJoin
0.00 0.41 0.00 18 0.00 0.00 memb_print_commit_set
0.00 0.41 0.00 18 0.00 0.00 memb_state_commit_consensus
0.00 0.41 0.00 15 0.00 0.00 orf_timer_function_token_timeout
0.00 0.41 0.00 12 0.00 0.00 mempool_malloc
0.00 0.41 0.00 5 0.00 0.00 memb_timer_function_state_gather
0.00 0.41 0.00 2 0.00 0.01 message_handler_req_exec_ckpt_sectioncreate
0.00 0.41 0.00 2 0.00 0.00 poll_dispatch_add
0.00 0.41 0.00 1 0.00 0.00 aisexec_libais_bind
0.00 0.41 0.00 1 0.00 0.00 amfExecutiveInitialize
0.00 0.41 0.00 1 0.00 0.39 amfReadGroups
0.00 0.41 0.00 1 0.00 0.00 clmExecutiveInitialize
0.00 0.41 0.00 1 0.00 0.00 determine_local_if
0.00 0.41 0.00 1 0.00 0.00 gmi_init
0.00 0.41 0.00 1 0.00 0.00 gmi_join
0.00 0.41 0.00 1 0.00 0.00 grow_connections_table
0.00 0.41 0.00 1 0.00 0.00 handle_create
0.00 0.41 0.00 1 0.00 0.00 memb_conf_id_build
0.00 0.41 0.00 1 0.00 0.00 memb_timer_function_state_commit_timeout
0.00 0.41 0.00 1 0.00 0.00 mempool_init
0.00 0.41 0.00 1 0.00 0.00 mempool_realloc
0.00 0.41 0.00 1 0.00 0.00 poll_create
0.00 0.41 0.00 1 0.00 0.00 sq_init
0.00 0.41 0.00 1 0.00 0.00 this_ip_set
0.00 0.41 0.00 1 0.00 0.00 timerlist_init
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the number of times this function was invoked, if
this function is profiled, else blank.
self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.
total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.
name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) for 2.44% of 0.41 seconds
index % time self children called name
<spontaneous>
[1] 100.0 0.00 0.41 main [1]
0.04 0.37 1/1 poll_run [2]
0.00 0.00 1/1 amfReadGroups [18]
0.00 0.00 1/1 gmi_init [27]
0.00 0.00 2/726 internal_log_printf [36]
0.00 0.00 1/1 poll_create [69]
0.00 0.00 1/1 mempool_init [67]
0.00 0.00 1/1 aisexec_libais_bind [58]
0.00 0.00 1/1 grow_connections_table [63]
0.00 0.00 1/2 poll_dispatch_add [57]
0.00 0.00 1/1 gmi_join [62]
0.00 0.00 1/1 amfExecutiveInitialize [59]
0.00 0.00 1/1 clmExecutiveInitialize [60]
-----------------------------------------------
0.04 0.37 1/1 main [1]
[2] 99.9 0.04 0.37 1 poll_run [2]
0.02 0.30 322046/322046 recv_handler [3]
0.03 0.00 322067/322067 timerlist_expire [9]
0.02 0.00 322068/322068 timerlist_timeout_msec [10]
-----------------------------------------------
0.02 0.30 322046/322046 poll_run [2]
[3] 78.0 0.02 0.30 322046 recv_handler [3]
0.09 0.17 274959/274959 message_handler_mcast [4]
0.01 0.03 46913/46913 message_handler_orf_token [8]
0.00 0.00 70/70 message_handler_memb_form_token [20]
0.00 0.00 52/52 message_handler_memb_join [24]
0.00 0.00 52/52 message_handler_memb_attempt_join [26]
-----------------------------------------------
0.09 0.17 274959/274959 recv_handler [3]
[4] 63.3 0.09 0.17 274959 message_handler_mcast [4]
0.08 0.09 274959/274977 pending_queues_deliver [5]
-----------------------------------------------
0.00 0.00 18/274977 orf_token_mcast [12]
0.08 0.09 274959/274977 message_handler_mcast [4]
[5] 41.4 0.08 0.09 274977 pending_queues_deliver [5]
0.04 0.05 1655/1655 user_deliver [6]
-----------------------------------------------
0.04 0.05 1655/1655 pending_queues_deliver [5]
[6] 21.9 0.04 0.05 1655 user_deliver [6]
0.03 0.02 1623/1623 deliver_fn [7]
0.00 0.00 1655/1655 pend_delv_next_delivery_find [34]
0.00 0.00 1623/1623 queue_reinit [35]
-----------------------------------------------
0.03 0.02 1623/1623 user_deliver [6]
[7] 12.1 0.03 0.02 1623 deliver_fn [7]
0.01 0.01 1527/1527 message_handler_req_exec_ckpt_sectionwrite [11]
0.00 0.00 41/41 message_handler_req_exec_ckpt_checkpointopen [19]
0.00 0.00 2/2 message_handler_req_exec_ckpt_sectioncreate [21]
0.00 0.00 53/53 message_handler_req_exec_clm_nodejoin [44]
-----------------------------------------------
0.01 0.03 46913/46913 recv_handler [3]
[8] 9.8 0.01 0.03 46913 message_handler_orf_token [8]
0.01 0.00 46913/46913 orf_token_mcast [12]
0.01 0.00 46878/46878 messages_free [15]
0.00 0.01 46913/47021 poll_timer_add [13]
0.00 0.00 46913/46913 orf_token_rtr [32]
0.00 0.00 46913/46913 orf_token_evs [31]
0.00 0.00 46913/47304 poll_timer_delete [28]
-----------------------------------------------
0.03 0.00 322067/322067 poll_run [2]
[9] 7.3 0.03 0.00 322067 timerlist_expire [9]
0.00 0.00 15/19 memb_state_gather_enter [23]
0.00 0.00 5/5 memb_timer_function_state_gather [25]
0.00 0.00 15/15 orf_timer_function_token_timeout [55]
0.00 0.00 1/1 memb_timer_function_state_commit_timeout [66]
-----------------------------------------------
0.02 0.00 322068/322068 poll_run [2]
[10] 4.9 0.02 0.00 322068 timerlist_timeout_msec [10]
-----------------------------------------------
0.01 0.01 1527/1527 deliver_fn [7]
[11] 4.7 0.01 0.01 1527 message_handler_req_exec_ckpt_sectionwrite [11]
0.01 0.00 1527/1632 SaNameTisNameT [16]
-----------------------------------------------
0.01 0.00 46913/46913 message_handler_orf_token [8]
[12] 2.4 0.01 0.00 46913 orf_token_mcast [12]
0.00 0.00 18/274977 pending_queues_deliver [5]
-----------------------------------------------
0.00 0.00 19/47021 memb_state_commit_enter [22]
0.00 0.00 19/47021 memb_state_gather_enter [23]
0.00 0.00 70/47021 message_handler_memb_form_token [20]
0.00 0.01 46913/47021 message_handler_orf_token [8]
[13] 2.4 0.00 0.01 47021 poll_timer_add [13]
0.01 0.00 47021/47021 timerlist_add_future [14]
-----------------------------------------------
0.01 0.00 47021/47021 poll_timer_add [13]
[14] 2.4 0.01 0.00 47021 timerlist_add_future [14]
0.00 0.00 47021/47021 timerlist_add [29]
-----------------------------------------------
0.01 0.00 46878/46878 message_handler_orf_token [8]
[15] 2.4 0.01 0.00 46878 messages_free [15]
0.00 0.00 46878/46878 sq_items_release [33]
-----------------------------------------------
0.00 0.00 2/1632 message_handler_req_exec_ckpt_sectioncreate [21]
0.00 0.00 40/1632 message_handler_req_exec_ckpt_checkpointopen [19]
0.00 0.00 63/1632 findComponent [17]
0.01 0.00 1527/1632 message_handler_req_exec_ckpt_sectionwrite [11]
[16] 2.4 0.01 0.00 1632 SaNameTisNameT [16]
-----------------------------------------------
0.00 0.00 18/18 amfReadGroups [18]
[17] 0.1 0.00 0.00 18 findComponent [17]
0.00 0.00 63/1632 SaNameTisNameT [16]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[18] 0.1 0.00 0.00 1 amfReadGroups [18]
0.00 0.00 18/18 findComponent [17]
0.00 0.00 125/125 strstr_rs [39]
0.00 0.00 36/36 SaNameTisEqual [45]
0.00 0.00 12/12 mempool_malloc [56]
-----------------------------------------------
0.00 0.00 41/41 deliver_fn [7]
[19] 0.1 0.00 0.00 41 message_handler_req_exec_ckpt_checkpointopen [19]
0.00 0.00 40/1632 SaNameTisNameT [16]
-----------------------------------------------
0.00 0.00 70/70 recv_handler [3]
[20] 0.0 0.00 0.00 70 message_handler_memb_form_token [20]
0.00 0.00 70/47021 poll_timer_add [13]
0.00 0.00 280/47304 poll_timer_delete [28]
0.00 0.00 35/35 memb_form_token_conf_desc_build [46]
-----------------------------------------------
0.00 0.00 2/2 deliver_fn [7]
[21] 0.0 0.00 0.00 2 message_handler_req_exec_ckpt_sectioncreate [21]
0.00 0.00 2/1632 SaNameTisNameT [16]
-----------------------------------------------
0.00 0.00 5/19 memb_timer_function_state_gather [25]
0.00 0.00 14/19 message_handler_memb_join [24]
[22] 0.0 0.00 0.00 19 memb_state_commit_enter [22]
0.00 0.00 19/47021 poll_timer_add [13]
0.00 0.00 19/47304 poll_timer_delete [28]
-----------------------------------------------
0.00 0.00 1/19 gmi_init [27]
0.00 0.00 3/19 message_handler_memb_attempt_join [26]
0.00 0.00 15/19 timerlist_expire [9]
[23] 0.0 0.00 0.00 19 memb_state_gather_enter [23]
0.00 0.00 19/47021 poll_timer_add [13]
0.00 0.00 38/726 internal_log_printf [36]
0.00 0.00 19/47304 poll_timer_delete [28]
-----------------------------------------------
0.00 0.00 52/52 recv_handler [3]
[24] 0.0 0.00 0.00 52 message_handler_memb_join [24]
0.00 0.00 14/19 memb_state_commit_enter [22]
0.00 0.00 18/18 memb_print_commit_set [53]
0.00 0.00 18/18 memb_state_commit_consensus [54]
0.00 0.00 18/726 internal_log_printf [36]
-----------------------------------------------
0.00 0.00 5/5 timerlist_expire [9]
[25] 0.0 0.00 0.00 5 memb_timer_function_state_gather [25]
0.00 0.00 5/19 memb_state_commit_enter [22]
-----------------------------------------------
0.00 0.00 52/52 recv_handler [3]
[26] 0.0 0.00 0.00 52 message_handler_memb_attempt_join [26]
0.00 0.00 3/19 memb_state_gather_enter [23]
0.00 0.00 86/726 internal_log_printf [36]
0.00 0.00 3/47304 poll_timer_delete [28]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[27] 0.0 0.00 0.00 1 gmi_init [27]
0.00 0.00 1/19 memb_state_gather_enter [23]
0.00 0.00 1/20 queue_init [49]
0.00 0.00 1/1 sq_init [70]
0.00 0.00 1/1 determine_local_if [61]
0.00 0.00 1/1 memb_conf_id_build [65]
0.00 0.00 1/2 poll_dispatch_add [57]
-----------------------------------------------
0.00 0.00 3/47304 message_handler_memb_attempt_join [26]
0.00 0.00 19/47304 memb_state_commit_enter [22]
0.00 0.00 19/47304 memb_state_gather_enter [23]
0.00 0.00 70/47304 orf_token_evs [31]
0.00 0.00 280/47304 message_handler_memb_form_token [20]
0.00 0.00 46913/47304 message_handler_orf_token [8]
[28] 0.0 0.00 0.00 47304 poll_timer_delete [28]
0.00 0.00 47019/47019 timerlist_del [30]
-----------------------------------------------
0.00 0.00 47021/47021 timerlist_add_future [14]
[29] 0.0 0.00 0.00 47021 timerlist_add [29]
-----------------------------------------------
0.00 0.00 47019/47019 poll_timer_delete [28]
[30] 0.0 0.00 0.00 47019 timerlist_del [30]
-----------------------------------------------
0.00 0.00 46913/46913 message_handler_orf_token [8]
[31] 0.0 0.00 0.00 46913 orf_token_evs [31]
0.00 0.00 70/47304 poll_timer_delete [28]
0.00 0.00 70/71 confchg_fn [42]
0.00 0.00 35/726 internal_log_printf [36]
0.00 0.00 35/35 sq_reinit [48]
0.00 0.00 35/35 queues_pend_delv_memb_new [47]
-----------------------------------------------
0.00 0.00 46913/46913 message_handler_orf_token [8]
[32] 0.0 0.00 0.00 46913 orf_token_rtr [32]
-----------------------------------------------
0.00 0.00 46878/46878 messages_free [15]
[33] 0.0 0.00 0.00 46878 sq_items_release [33]
-----------------------------------------------
0.00 0.00 1655/1655 user_deliver [6]
[34] 0.0 0.00 0.00 1655 pend_delv_next_delivery_find [34]
-----------------------------------------------
0.00 0.00 1623/1623 user_deliver [6]
[35] 0.0 0.00 0.00 1623 queue_reinit [35]
-----------------------------------------------
0.00 0.00 1/726 sigintr_handler [175]
0.00 0.00 1/726 memb_timer_function_state_commit_timeout [66]
0.00 0.00 2/726 main [1]
0.00 0.00 15/726 orf_timer_function_token_timeout [55]
0.00 0.00 18/726 message_handler_memb_join [24]
0.00 0.00 35/726 orf_token_evs [31]
0.00 0.00 38/726 memb_state_gather_enter [23]
0.00 0.00 53/726 message_handler_req_exec_clm_nodejoin [44]
0.00 0.00 86/726 message_handler_memb_attempt_join [26]
0.00 0.00 477/726 clmConfChg [41]
[36] 0.0 0.00 0.00 726 internal_log_printf [36]
-----------------------------------------------
0.00 0.00 125/125 strstr_rs [39]
[37] 0.0 0.00 0.00 125 mempool_free [37]
-----------------------------------------------
0.00 0.00 125/125 strstr_rs [39]
[38] 0.0 0.00 0.00 125 mempool_strdup [38]
-----------------------------------------------
0.00 0.00 125/125 amfReadGroups [18]
[39] 0.0 0.00 0.00 125 strstr_rs [39]
0.00 0.00 125/125 mempool_strdup [38]
0.00 0.00 125/125 mempool_free [37]
-----------------------------------------------
0.00 0.00 71/71 confchg_fn [42]
[40] 0.0 0.00 0.00 71 ckptConfChg [40]
-----------------------------------------------
0.00 0.00 71/71 confchg_fn [42]
[41] 0.0 0.00 0.00 71 clmConfChg [41]
0.00 0.00 477/726 internal_log_printf [36]
0.00 0.00 71/71 libraryNotificationLeave [43]
0.00 0.00 18/18 gmi_mcast [50]
-----------------------------------------------
0.00 0.00 1/71 memb_timer_function_state_commit_timeout [66]
0.00 0.00 70/71 orf_token_evs [31]
[42] 0.0 0.00 0.00 71 confchg_fn [42]
0.00 0.00 71/71 ckptConfChg [40]
0.00 0.00 71/71 clmConfChg [41]
-----------------------------------------------
0.00 0.00 71/71 clmConfChg [41]
[43] 0.0 0.00 0.00 71 libraryNotificationLeave [43]
-----------------------------------------------
0.00 0.00 53/53 deliver_fn [7]
[44] 0.0 0.00 0.00 53 message_handler_req_exec_clm_nodejoin [44]
0.00 0.00 53/726 internal_log_printf [36]
0.00 0.00 18/18 libraryNotificationJoin [52]
-----------------------------------------------
0.00 0.00 36/36 amfReadGroups [18]
[45] 0.0 0.00 0.00 36 SaNameTisEqual [45]
-----------------------------------------------
0.00 0.00 35/35 message_handler_memb_form_token [20]
[46] 0.0 0.00 0.00 35 memb_form_token_conf_desc_build [46]
-----------------------------------------------
0.00 0.00 35/35 orf_token_evs [31]
[47] 0.0 0.00 0.00 35 queues_pend_delv_memb_new [47]
0.00 0.00 19/20 queue_init [49]
-----------------------------------------------
0.00 0.00 35/35 orf_token_evs [31]
[48] 0.0 0.00 0.00 35 sq_reinit [48]
-----------------------------------------------
0.00 0.00 1/20 gmi_init [27]
0.00 0.00 19/20 queues_pend_delv_memb_new [47]
[49] 0.0 0.00 0.00 20 queue_init [49]
-----------------------------------------------
0.00 0.00 18/18 clmConfChg [41]
[50] 0.0 0.00 0.00 18 gmi_mcast [50]
0.00 0.00 18/18 gmi_pend_trans_item_store [51]
-----------------------------------------------
0.00 0.00 18/18 gmi_mcast [50]
[51] 0.0 0.00 0.00 18 gmi_pend_trans_item_store [51]
-----------------------------------------------
0.00 0.00 18/18 message_handler_req_exec_clm_nodejoin [44]
[52] 0.0 0.00 0.00 18 libraryNotificationJoin [52]
-----------------------------------------------
0.00 0.00 18/18 message_handler_memb_join [24]
[53] 0.0 0.00 0.00 18 memb_print_commit_set [53]
-----------------------------------------------
0.00 0.00 18/18 message_handler_memb_join [24]
[54] 0.0 0.00 0.00 18 memb_state_commit_consensus [54]
-----------------------------------------------
0.00 0.00 15/15 timerlist_expire [9]
[55] 0.0 0.00 0.00 15 orf_timer_function_token_timeout [55]
0.00 0.00 15/726 internal_log_printf [36]
-----------------------------------------------
0.00 0.00 12/12 amfReadGroups [18]
[56] 0.0 0.00 0.00 12 mempool_malloc [56]
-----------------------------------------------
0.00 0.00 1/2 main [1]
0.00 0.00 1/2 gmi_init [27]
[57] 0.0 0.00 0.00 2 poll_dispatch_add [57]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[58] 0.0 0.00 0.00 1 aisexec_libais_bind [58]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[59] 0.0 0.00 0.00 1 amfExecutiveInitialize [59]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[60] 0.0 0.00 0.00 1 clmExecutiveInitialize [60]
0.00 0.00 1/1 this_ip_set [71]
-----------------------------------------------
0.00 0.00 1/1 gmi_init [27]
[61] 0.0 0.00 0.00 1 determine_local_if [61]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[62] 0.0 0.00 0.00 1 gmi_join [62]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[63] 0.0 0.00 0.00 1 grow_connections_table [63]
0.00 0.00 1/1 mempool_realloc [68]
-----------------------------------------------
0.00 0.00 1/1 poll_create [69]
[64] 0.0 0.00 0.00 1 handle_create [64]
-----------------------------------------------
0.00 0.00 1/1 gmi_init [27]
[65] 0.0 0.00 0.00 1 memb_conf_id_build [65]
-----------------------------------------------
0.00 0.00 1/1 timerlist_expire [9]
[66] 0.0 0.00 0.00 1 memb_timer_function_state_commit_timeout [66]
0.00 0.00 1/726 internal_log_printf [36]
0.00 0.00 1/71 confchg_fn [42]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[67] 0.0 0.00 0.00 1 mempool_init [67]
-----------------------------------------------
0.00 0.00 1/1 grow_connections_table [63]
[68] 0.0 0.00 0.00 1 mempool_realloc [68]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[69] 0.0 0.00 0.00 1 poll_create [69]
0.00 0.00 1/1 handle_create [64]
0.00 0.00 1/1 timerlist_init [72]
-----------------------------------------------
0.00 0.00 1/1 gmi_init [27]
[70] 0.0 0.00 0.00 1 sq_init [70]
-----------------------------------------------
0.00 0.00 1/1 clmExecutiveInitialize [60]
[71] 0.0 0.00 0.00 1 this_ip_set [71]
-----------------------------------------------
0.00 0.00 1/1 poll_create [69]
[72] 0.0 0.00 0.00 1 timerlist_init [72]
-----------------------------------------------
This table describes the call tree of the program, and was sorted by
the total amount of time spent in each function and its children.
Each entry in this table consists of several lines. The line with the
index number at the left hand margin lists the current function.
The lines above it list the functions that called this function,
and the lines below it list the functions this one called.
This line lists:
index A unique number given to each element of the table.
Index numbers are sorted numerically.
The index number is printed next to every function name so
it is easier to look up where the function in the table.
% time This is the percentage of the `total' time that was spent
in this function and its children. Note that due to
different viewpoints, functions excluded by options, etc,
these numbers will NOT add up to 100%.
self This is the total amount of time spent in this function.
children This is the total amount of time propagated into this
function by its children.
called This is the number of times the function was called.
If the function called itself recursively, the number
only includes non-recursive calls, and is followed by
a `+' and the number of recursive calls.
name The name of the current function. The index number is
printed after it. If the function is a member of a
cycle, the cycle number is printed between the
function's name and the index number.
For the function's parents, the fields have the following meanings:
self This is the amount of time that was propagated directly
from the function into this parent.
children This is the amount of time that was propagated from
the function's children into this parent.
called This is the number of times this parent called the
function `/' the total number of times the function
was called. Recursive calls to the function are not
included in the number after the `/'.
name This is the name of the parent. The parent's index
number is printed after it. If the parent is a
member of a cycle, the cycle number is printed between
the name and the index number.
If the parents of the function cannot be determined, the word
`<spontaneous>' is printed in the `name' field, and all the other
fields are blank.
For the function's children, the fields have the following meanings:
self This is the amount of time that was propagated directly
from the child into the function.
children This is the amount of time that was propagated from the
child's children to the function.
called This is the number of times the function called
this child `/' the total number of times the child
was called. Recursive calls by the child are not
listed in the number after the `/'.
name This is the name of the child. The child's index
number is printed after it. If the child is a
member of a cycle, the cycle number is printed
between the name and the index number.
If there are any cycles (circles) in the call graph, there is an
entry for the cycle-as-a-whole. This entry shows who called the
cycle (as parents) and the members of the cycle (as children.)
The `+' recursive calls entry shows the number of function calls that
were internal to the cycle, and the calls entry for each member shows,
for that member, how many times it was called from other members of
the cycle.
Index by function name
[45] SaNameTisEqual [54] memb_state_commit_consensus [34] pend_delv_next_delivery_find
[16] SaNameTisNameT [22] memb_state_commit_enter [5] pending_queues_deliver
[58] aisexec_libais_bind [23] memb_state_gather_enter [69] poll_create
[59] amfExecutiveInitialize [66] memb_timer_function_state_commit_timeout [57] poll_dispatch_add
[18] amfReadGroups [25] memb_timer_function_state_gather [2] poll_run
[40] ckptConfChg [37] mempool_free [13] poll_timer_add
[41] clmConfChg [67] mempool_init [28] poll_timer_delete
[60] clmExecutiveInitialize [56] mempool_malloc [49] queue_init
[42] confchg_fn [68] mempool_realloc [35] queue_reinit
[7] deliver_fn [38] mempool_strdup [47] queues_pend_delv_memb_new
[61] determine_local_if [4] message_handler_mcast [3] recv_handler
[17] findComponent [26] message_handler_memb_attempt_join [70] sq_init
[27] gmi_init [20] message_handler_memb_form_token [33] sq_items_release
[62] gmi_join [24] message_handler_memb_join [48] sq_reinit
[50] gmi_mcast [8] message_handler_orf_token [39] strstr_rs
[51] gmi_pend_trans_item_store [19] message_handler_req_exec_ckpt_checkpointopen [71] this_ip_set
[63] grow_connections_table [21] message_handler_req_exec_ckpt_sectioncreate [29] timerlist_add
[64] handle_create [11] message_handler_req_exec_ckpt_sectionwrite [14] timerlist_add_future
[36] internal_log_printf [44] message_handler_req_exec_clm_nodejoin [30] timerlist_del
[52] libraryNotificationJoin [15] messages_free [9] timerlist_expire
[43] libraryNotificationLeave [55] orf_timer_function_token_timeout [72] timerlist_init
[65] memb_conf_id_build [31] orf_token_evs [10] timerlist_timeout_msec
[46] memb_form_token_conf_desc_build [12] orf_token_mcast [6] user_deliver
[53] memb_print_commit_set [32] orf_token_rtr

View File

@ -172,18 +172,31 @@ void totemmrp_new_msg_signal (void) {
totemsrp_new_msg_signal (totemsrp_handle_in);
}
int totemmrp_interfaces_get (
int totemmrp_ifaces_get (
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count)
{
int res;
res = totemsrp_interfaces_get (
res = totemsrp_ifaces_get (
totemsrp_handle_in,
nodeid,
interfaces,
status,
iface_count);
return (res);
}
extern int totemmrp_ring_reenable (void)
{
int res;
res = totemsrp_ring_reenable (
totemsrp_handle_in);
return (res);
}

View File

@ -98,9 +98,12 @@ extern void totemmrp_callback_token_destroy (
extern void totemmrp_new_msg_signal (void);
extern int totemmrp_interfaces_get (
extern int totemmrp_ifaces_get (
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count);
extern int totemmrp_ring_reenable (void);
#endif /* TOTEMMRP_H_DEFINED */

View File

@ -1139,30 +1139,42 @@ error_exit:
int totempg_ifaces_get (
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count)
{
int res;
res = totemmrp_interfaces_get (
res = totemmrp_ifaces_get (
nodeid,
interfaces,
status,
iface_count);
return (res);
}
int totempg_ring_reenable (void)
{
int res;
res = totemmrp_ring_reenable ();
return (res);
}
char *totempg_ifaces_print (unsigned int nodeid)
{
static char iface_string[256 * INTERFACE_MAX];
char one_iface[64];
struct totem_ip_address interfaces[INTERFACE_MAX];
char *status;
unsigned int iface_count;
unsigned int i;
int res;
iface_string[0] = '\0';
res = totempg_ifaces_get (nodeid, interfaces, &iface_count);
res = totempg_ifaces_get (nodeid, interfaces, &status, &iface_count);
if (res == -1) {
return ("no interface found for nodeid");
}

View File

@ -133,8 +133,11 @@ extern int totempg_groups_send_ok_groups (
extern int totempg_ifaces_get (
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count);
extern int totempg_ring_reenable (void);
extern char *totempg_ifaces_print (unsigned int nodeid);
#endif /* TOTEMPG_H_DEFINED */

View File

@ -148,6 +148,9 @@ struct rrp_algo {
struct totemrrp_instance *instance,
struct totem_ip_address *token_target,
unsigned int iface_no);
void (*ring_reenable) (
struct totemrrp_instance *instance);
};
struct totemrrp_instance {
@ -159,6 +162,8 @@ struct totemrrp_instance {
void *context;
char *status[INTERFACE_MAX];
void (*totemrrp_deliver_fn) (
void *context,
void *msg,
@ -174,7 +179,6 @@ struct totemrrp_instance {
unsigned int *seqid,
unsigned int *token_is);
unsigned int (*totemrrp_msgs_missing) (void);
/*
@ -258,6 +262,9 @@ static void none_token_target_set (
struct totem_ip_address *token_target,
unsigned int iface_no);
static void none_ring_reenable (
struct totemrrp_instance *instance);
/*
* Passive Replication Forward Declerations
*/
@ -313,6 +320,9 @@ static void passive_token_target_set (
struct totem_ip_address *token_target,
unsigned int iface_no);
static void passive_ring_reenable (
struct totemrrp_instance *instance);
/*
* Active Replication Forward Definitions
*/
@ -368,6 +378,9 @@ static void active_token_target_set (
struct totem_ip_address *token_target,
unsigned int iface_no);
static void active_ring_reenable (
struct totemrrp_instance *instance);
static void active_timer_expired_token_start (
struct active_instance *active_instance);
@ -392,7 +405,8 @@ struct rrp_algo none_algo = {
.send_flush = none_send_flush,
.iface_check = none_iface_check,
.processor_count_set = none_processor_count_set,
.token_target_set = none_token_target_set
.token_target_set = none_token_target_set,
.ring_reenable = none_ring_reenable
};
struct rrp_algo passive_algo = {
@ -407,7 +421,8 @@ struct rrp_algo passive_algo = {
.send_flush = passive_send_flush,
.iface_check = passive_iface_check,
.processor_count_set = passive_processor_count_set,
.token_target_set = passive_token_target_set
.token_target_set = passive_token_target_set,
.ring_reenable = passive_ring_reenable
};
struct rrp_algo active_algo = {
@ -422,7 +437,8 @@ struct rrp_algo active_algo = {
.send_flush = active_send_flush,
.iface_check = active_iface_check,
.processor_count_set = active_processor_count_set,
.token_target_set = active_token_target_set
.token_target_set = active_token_target_set,
.ring_reenable = active_ring_reenable
};
struct rrp_algo *rrp_algos[] = {
@ -534,6 +550,14 @@ static void none_token_target_set (
totemnet_token_target_set (instance->net_handles[0], token_target);
}
static void none_ring_reenable (
struct totemrrp_instance *instance)
{
/*
* No operation
*/
}
/*
* Passive Replication Implementation
*/
@ -687,11 +711,13 @@ static void passive_mcast_recv (
(max - passive_instance->mcast_recv_count[i] >
rrp_instance->totem_config->rrp_problem_count_threshold)) {
passive_instance->faulty[i] = 1;
log_printf (
rrp_instance->totemrrp_log_level_error,
sprintf (rrp_instance->status[i],
"Marking ringid %d interface %s FAULTY - adminisrtative intervention required.",
i,
totemnet_iface_print (rrp_instance->net_handles[i]));
log_printf (
rrp_instance->totemrrp_log_level_error,
rrp_instance->status[i]);
}
}
}
@ -767,12 +793,14 @@ static void passive_token_recv (
(max - passive_instance->token_recv_count[i] >
rrp_instance->totem_config->rrp_problem_count_threshold)) {
passive_instance->faulty[i] = 1;
log_printf (
rrp_instance->totemrrp_log_level_error,
sprintf (rrp_instance->status[i],
"Marking seqid %d ringid %d interface %s FAULTY - adminisrtative intervention required.",
token_seq,
i,
totemnet_iface_print (rrp_instance->net_handles[i]));
log_printf (
rrp_instance->totemrrp_log_level_error,
rrp_instance->status[i]);
}
}
}
@ -857,6 +885,19 @@ static void passive_token_target_set (
totemnet_token_target_set (instance->net_handles[iface_no], token_target);
}
static void passive_ring_reenable (
struct totemrrp_instance *instance)
{
struct passive_instance *rrp_algo_instance = (struct passive_instance *)instance->rrp_algo_instance;
memset (rrp_algo_instance->mcast_recv_count, 0, sizeof (unsigned int) *
instance->interface_count);
memset (rrp_algo_instance->token_recv_count, 0, sizeof (unsigned int) *
instance->interface_count);
memset (rrp_algo_instance->faulty, 0, sizeof (unsigned int) *
instance->interface_count);
}
/*
* Active Replication Implementation
*/
@ -919,12 +960,19 @@ static void timer_function_active_problem_decrementer (void *context)
if (active_instance->counter_problems[i] > 0) {
problem_found = 1;
active_instance->counter_problems[i] -= 1;
log_printf (
rrp_instance->totemrrp_log_level_warning,
"Decrementing problem counter for iface %s to [%d of %d]",
totemnet_iface_print (rrp_instance->net_handles[i]),
active_instance->counter_problems[i],
rrp_instance->totem_config->rrp_problem_count_threshold);
if (active_instance->counter_problems[i] == 0) {
sprintf (rrp_instance->status[i],
"ring %d active with no faults", i);
} else {
sprintf (rrp_instance->status[i],
"Decrementing problem counter for iface %s to [%d of %d]",
totemnet_iface_print (rrp_instance->net_handles[i]),
active_instance->counter_problems[i],
rrp_instance->totem_config->rrp_problem_count_threshold);
}
log_printf (
rrp_instance->totemrrp_log_level_warning,
rrp_instance->status[i]);
}
}
if (problem_found) {
@ -947,25 +995,29 @@ static void timer_function_active_token_expired (void *context)
if (active_instance->timer_problem_decrementer == 0) {
active_timer_problem_decrementer_start (active_instance);
}
log_printf (
rrp_instance->totemrrp_log_level_warning,
sprintf (rrp_instance->status[i],
"Incrementing problem counter for seqid %d iface %s to [%d of %d]",
active_instance->last_token_seq,
totemnet_iface_print (rrp_instance->net_handles[i]),
active_instance->counter_problems[i],
rrp_instance->totem_config->rrp_problem_count_threshold);
log_printf (
rrp_instance->totemrrp_log_level_warning,
rrp_instance->status[i]);
}
}
for (i = 0; i < rrp_instance->interface_count; i++) {
if (active_instance->counter_problems[i] >= rrp_instance->totem_config->rrp_problem_count_threshold)
{
active_instance->faulty[i] = 1;
log_printf (
rrp_instance->totemrrp_log_level_error,
sprintf (rrp_instance->status[i],
"Marking seqid %d ringid %d interface %s FAULTY - adminisrtative intervention required.",
active_instance->last_token_seq,
i,
totemnet_iface_print (rrp_instance->net_handles[i]));
log_printf (
rrp_instance->totemrrp_log_level_error,
rrp_instance->status[i]);
active_timer_problem_decrementer_cancel (active_instance);
}
}
@ -1184,6 +1236,19 @@ static void active_token_target_set (
totemnet_token_target_set (instance->net_handles[iface_no], token_target);
}
static void active_ring_reenable (
struct totemrrp_instance *instance)
{
struct active_instance *rrp_algo_instance = (struct active_instance *)instance->rrp_algo_instance;
memset (rrp_algo_instance->last_token_recv, 0, sizeof (unsigned int) *
instance->interface_count);
memset (rrp_algo_instance->faulty, 0, sizeof (unsigned int) *
instance->interface_count);
memset (rrp_algo_instance->counter_problems, 0, sizeof (unsigned int) *
instance->interface_count);
}
struct deliver_fn_context {
struct totemrrp_instance *instance;
void *context;
@ -1214,6 +1279,10 @@ static int totemrrp_algorithm_set (
break;
}
}
for (i = 0; i < totem_config->interface_count; i++) {
instance->status[i] = malloc (1024);
sprintf (instance->status[i], "ring %d active with no faults", i);
}
return (res);
}
@ -1594,14 +1663,13 @@ error_exit:
return (res);
}
int totemrrp_interfaces_get (
int totemrrp_ifaces_get (
totemrrp_handle handle,
struct totem_ip_address *interfaces,
unsigned int *iface_count)
char ***status,
unsigned int *iface_count)
{
struct totemrrp_instance *instance;
int res = 0;
unsigned int i;
res = hdb_handle_get (&totemrrp_instance_database, handle,
(void *)&instance);
@ -1610,11 +1678,41 @@ int totemrrp_interfaces_get (
goto error_exit;
}
for (i = 0; i < instance->interface_count; i++) {
totemnet_iface_get (instance->net_handles[i], &interfaces[i]);
*status = instance->status;
if (iface_count) {
*iface_count = instance->interface_count;
}
hdb_handle_put (&totemrrp_instance_database, handle);
error_exit:
return (res);
}
int totemrrp_ring_reenable (
totemrrp_handle handle)
{
struct totemrrp_instance *instance;
int res = 0;
unsigned int i;
printf ("totemrrp ring reenable\n");
res = hdb_handle_get (&totemrrp_instance_database, handle,
(void *)&instance);
if (res != 0) {
res = ENOENT;
goto error_exit;
}
instance->rrp_algo->ring_reenable (instance);
for (i = 0; i < instance->interface_count; i++) {
sprintf (instance->status[i], "ring %d active with no faults", i);
}
hdb_handle_put (&totemrrp_instance_database, handle);
error_exit:
return (res);
}

View File

@ -109,9 +109,12 @@ extern int totemrrp_iface_check (totemrrp_handle handle);
extern int totemrrp_finalize (totemrrp_handle handle);
extern int totemrrp_interfaces_get (
extern int totemrrp_ifaces_get (
totemrrp_handle handle,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count);
extern int totemrrp_ring_reenable (
totemrrp_handle handle);
#endif /* TOTEMRRP_H_DEFINED */

View File

@ -832,10 +832,11 @@ void totemsrp_finalize (
hdb_handle_put (&totemsrp_instance_database, handle);
}
int totemsrp_interfaces_get (
int totemsrp_ifaces_get (
totemsrp_handle handle,
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count)
{
struct totemsrp_instance *instance;
@ -864,11 +865,33 @@ int totemsrp_interfaces_get (
res = -1;
}
totemrrp_ifaces_get (instance->totemrrp_handle, status, NULL);
hdb_handle_put (&totemsrp_instance_database, handle);
error_exit:
return (res);
}
int totemsrp_ring_reenable (
totemsrp_handle handle)
{
struct totemsrp_instance *instance;
int res;
res = hdb_handle_get (&totemsrp_instance_database, handle,
(void *)&instance);
if (res != 0) {
goto error_exit;
}
totemrrp_ring_reenable (instance->totemrrp_handle);
hdb_handle_put (&totemsrp_instance_database, handle);
error_exit:
return (res);
}
/*
* Set operations for use by the membership algorithm
*/

View File

@ -96,10 +96,14 @@ int totemsrp_new_msg_signal (totemsrp_handle handle);
extern void totemsrp_net_mtu_adjust (struct totem_config *totem_config);
extern int totemsrp_interfaces_get (
extern int totemsrp_ifaces_get (
totemsrp_handle handle,
unsigned int nodeid,
struct totem_ip_address *interfaces,
char ***status,
unsigned int *iface_count);
extern int totemsrp_ring_reenable (
totemsrp_handle handle);
#endif /* TOTEMSRP_H_DEFINED */

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 MontaVista Software, Inc.
* Copyright (c) 2006 Red Hat, Inc.
*
* All rights reserved.
*
@ -37,7 +38,7 @@
#include <netinet/in.h>
#include "saAis.h"
typedef SaUint64T OpenaisCfgHandleT;
typedef SaUint64T openais_cfg_handle_t;
typedef enum {
OPENAIS_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
@ -109,46 +110,56 @@ extern "C" {
#endif
SaAisErrorT
openaisCfgInitialize (
OpenaisCfgHandleT *cfgHandle,
const OpenaisCfgCallbacksT *cfgCallbacks,
SaVersionT *version);
openais_cfg_initialize (
openais_cfg_handle_t *cfg_handle,
const OpenaisCfgCallbacksT *cfgCallbacks);
SaAisErrorT
openaisCfgSelectionObjectGet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_fd_get (
openais_cfg_handle_t cfg_handle,
SaSelectionObjectT *selectionObject);
SaAisErrorT
openaisCfgDispatch (
OpenaisCfgHandleT cfgHandle,
openais_cfg_dispatch (
openais_cfg_handle_t cfg_handle,
SaDispatchFlagsT dispatchFlags);
SaAisErrorT
openaisCfgFinalize (
OpenaisCfgHandleT cfgHandle);
openais_cfg_finalize (
openais_cfg_handle_t cfg_handle);
SaAisErrorT
openaisCfgAdministrativeStateGet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_ring_status_get (
openais_cfg_handle_t cfg_handle,
char ***interface_names,
char ***status,
unsigned int *interface_count);
SaAisErrorT
openais_cfg_ring_reenable (
openais_cfg_handle_t cfg_handle);
SaAisErrorT
openais_cfg_administrative_state_get (
openais_cfg_handle_t cfg_handle,
OpenaisCfgAdministrativeTargetT administrativeTarget,
OpenaisCfgAdministrativeStateT *administrativeState);
SaAisErrorT
openaisCfgAdministrativeStateSet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_administrative_state_set (
openais_cfg_handle_t cfg_handle,
OpenaisCfgAdministrativeTargetT administrativeTarget,
OpenaisCfgAdministrativeStateT administrativeState);
SaAisErrorT
openaisCfgStateTrackStart (
OpenaisCfgHandleT cfgHandle,
openais_cfg_state_track (
openais_cfg_handle_t cfg_handle,
SaUint8T trackFlags,
const OpenaisCfgStateNotificationT *notificationBuffer);
SaAisErrorT
openaisCfgStateTrackStop (
OpenaisCfgHandleT cfgHandle);
openais_cfg_state_track_stop (
openais_cfg_handle_t cfg_handle);
#ifdef __cplusplus
}

View File

@ -37,29 +37,33 @@
#include <netinet/in.h>
#include "ipc_gen.h"
#include "saAis.h"
#include "openaisCfg.h"
#include "cfg.h"
enum req_lib_cfg_types {
MESSAGE_REQ_CFG_STATETRACKSTART = 0,
MESSAGE_REQ_CFG_STATETRACKSTOP = 1,
MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 2,
MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 3,
MESSAGE_REQ_CFG_RINGSTATUSGET = 0,
MESSAGE_REQ_CFG_RINGREENABLE = 1,
MESSAGE_REQ_CFG_STATETRACKSTART = 2,
MESSAGE_REQ_CFG_STATETRACKSTOP = 3,
MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 4,
MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 5,
};
enum res_lib_cfg_types {
MESSAGE_RES_CFG_STATETRACKSTART = 0,
MESSAGE_RES_CFG_STATETRACKSTOP = 1,
MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 2,
MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 3,
MESSAGE_RES_CFG_RINGSTATUSGET = 0,
MESSAGE_RES_CFG_RINGREENABLE = 1,
MESSAGE_RES_CFG_STATETRACKSTART = 2,
MESSAGE_RES_CFG_STATETRACKSTOP = 3,
MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4,
MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5,
};
struct req_lib_cfg_statetrackstart {
struct req_lib_cfg_statetrack {
mar_req_header_t header;
SaUint8T trackFlags;
OpenaisCfgStateNotificationT *notificationBufferAddress;
};
struct res_lib_cfg_statetrackstart {
struct res_lib_cfg_statetrack {
mar_res_header_t header;
};
@ -90,7 +94,26 @@ struct req_lib_cfg_administrativestateget {
};
struct res_lib_cfg_administrativestateget {
mar_res_header_t header;
mar_res_header_t header __attribute__((aligned(8)));
};
struct req_lib_cfg_ringstatusget {
mar_req_header_t header __attribute__((aligned(8)));
};
struct res_lib_cfg_ringstatusget {
mar_res_header_t header __attribute__((aligned(8)));
mar_uint32_t interface_count __attribute__((aligned(8)));
char interface_name[16][128] __attribute__((aligned(8)));
char interface_status[16][512] __attribute__((aligned(8)));
};
struct req_lib_cfg_ringreenable {
mar_req_header_t header __attribute__((aligned(8)));
};
struct res_lib_cfg_ringreenable {
mar_res_header_t header __attribute__((aligned(8)));
};
typedef enum {

View File

@ -35,11 +35,16 @@ include ../Makefile.inc
CFLAGS += -I../include
LDFLAGS += -L./
all:libSaClm.a libSaClm.so.2.0.0 libSaAmf.a libSaAmf.so.2.0.0 libSaCkpt.a \
libSaCkpt.so.2.0.0 libSaEvt.a libSaEvt.so.2.0.0 libSaLck.a \
libSaLck.so.2.0.0 libSaMsg.a libSaMsg.so.2.0.0 \
all:libSaClm.a libSaClm.so.2.0.0 \
libSaAmf.a libSaAmf.so.2.0.0 \
libSaCkpt.a libSaCkpt.so.2.0.0 \
libSaEvt.a libSaEvt.so.2.0.0 \
libSaLck.a libSaLck.so.2.0.0 \
libSaMsg.a libSaMsg.so.2.0.0 \
libcpg.a libcpg.so.2.0.0 \
libais.a libais.so.2.0.0 libevs.a libevs.so.2.0.0
libais.a libais.so.2.0.0 \
libevs.a libevs.so.2.0.0 \
libcfg.a libcfg.so.2.0.0
LIBAIS_SRC = util.c amf.c clm.c ckpt.c evt.c
@ -77,6 +82,9 @@ libevs.so.2.0.0: util.o evs.o
libcpg.so.2.0.0: util.o cpg.o
$(CC) -bundle -bind_at_load util.o cpg.o -o $@
libcfg.so.2.0.0: util.o cfg.o
$(CC) -bundle -bind_at_load util.o cfg.o -o $@
else
libSaClm.so.2.0.0: util.o clm.o
@ -106,6 +114,9 @@ libevs.so.2.0.0: util.o evs.o
libcpg.so.2.0.0: util.o cpg.o
$(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=libcpg.versions util.o cpg.o -o $@
libcfg.so.2.0.0: util.o cfg.o
$(CC) -shared -Wl,-soname,libcfg.so.2,-version-script=libcfg.versions util.o cfg.o -o $@
endif
libSaAmf.a: util.o amf.o
@ -132,10 +143,13 @@ libevs.a: util.o evs.o
libcpg.a: util.o cpg.o
$(AR) -rc libcpg.a util.o cpg.o
libcfg.a: util.o cfg.o
$(AR) -rc libcfg.a util.o cfg.o
clean:
rm -f *.o libais.so* libais.a libSaClm.so* libSaClm.a* libSaAmf.so* libSaAmf.a \
libSaCkpt.so* libSaCkpt.a* libSaEvt.so* libSaEvt.a libSaLck.so* libSaLck.a \
libSaMsg.so* libSaMsg.a libOpenaisCfg.so* libOpenaisCfg.a \
libSaMsg.so* libSaMsg.a libcfg.so* libOpenaisCfg.a \
libevs.so* libevs.a libcpg.so* libcpg.a *.da *.bb *.bbg
# -fPIC rules required for all libraries

465
lib/cfg.c
View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2002-2005 MontaVista Software, Inc.
* Copyright (c) 2006 Red Hat, Inc.
*
* All rights reserved.
*
@ -46,20 +47,21 @@
#include <sys/un.h>
#include "../include/saAis.h"
#include "../include/openaisCfg.h"
#include "../include/cfg.h"
#include "../include/mar_gen.h"
#include "../include/ipc_gen.h"
#include "../include/ipc_cfg.h"
#include "util.h"
struct res_overlay {
struct res_header header;
mar_res_header_t header;
char data[4096];
};
/*
* Data structure for instance data
*/
struct cfgInstance {
struct cfg_instance {
int response_fd;
int dispatch_fd;
OpenaisCfgCallbacksT callbacks;
@ -70,112 +72,95 @@ struct cfgInstance {
pthread_mutex_t dispatch_mutex;
};
static void cfgHandleInstanceDestructor (void *);
static void cfg_handleInstanceDestructor (void *);
/*
* All instances in one database
*/
static struct saHandleDatabase cfgHandleDatabase = {
static struct saHandleDatabase cfg_hdb = {
.handleCount = 0,
.handles = 0,
.mutex = PTHREAD_MUTEX_INITIALIZER,
.handleInstanceDestructor = cfgHandleInstanceDestructor
.handleInstanceDestructor = cfg_handleInstanceDestructor
};
/*
* Versions supported
*/
static SaVersionT amfVersionsSupported[] = {
{ 'A', 1, 1 }
};
static struct saVersionDatabase amfVersionDatabase = {
sizeof (amfVersionsSupported) / sizeof (SaVersionT),
amfVersionsSupported
};
/*
* Implementation
*/
void cfgHandleInstanceDestructor (void *instance)
void cfg_handleInstanceDestructor (void *instance)
{
}
SaAisErrorT
openaisCfgInitialize (
OpenaisCfgHandleT *cfgHandle,
const OpenaisCfgCallbacksT *amfCallbacks,
SaVersionT *version)
openais_cfg_initialize (
openais_cfg_handle_t *cfg_handle,
const OpenaisCfgCallbacksT *cfgCallbacks)
{
struct cfgInstance *cfgInstance;
SaAisErrorT error = SA_OK;
struct cfg_instance *cfg_instance;
SaAisErrorT error = SA_AIS_OK;
error = saVersionVerify (&amfVersionDatabase, (SaVersionT *)version);
if (error != SA_OK) {
goto error_no_destroy;
}
error = saHandleCreate (&cfgHandleDatabase, sizeof (struct cfgInstance), cfgHandle);
if (error != SA_OK) {
error = saHandleCreate (&cfg_hdb, sizeof (struct cfg_instance), cfg_handle);
if (error != SA_AIS_OK) {
goto error_no_destroy;
}
error = saHandleInstanceGet (&cfgHandleDatabase, *cfgHandle, (void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, *cfg_handle, (void *)&cfg_instance);
if (error != SA_AIS_OK) {
goto error_destroy;
}
cfgInstance->response_fd = -1;
cfg_instance->response_fd = -1;
cfgInstance->dispatch_fd = -1;
cfg_instance->dispatch_fd = -1;
error = saServiceConnect (&cfgInstance->response_fd,
&cfgInstance->dispatch_fd, AMF_SERVICE);
if (error != SA_OK) {
error = saServiceConnect (&cfg_instance->response_fd,
&cfg_instance->dispatch_fd, CFG_SERVICE);
if (error != SA_AIS_OK) {
goto error_put_destroy;
}
memcpy (&cfgInstance->callbacks, amfCallbacks, sizeof (OpenaisCfgCallbacksT));
if (cfgCallbacks) {
memcpy (&cfg_instance->callbacks, cfgCallbacks, sizeof (OpenaisCfgCallbacksT));
}
pthread_mutex_init (&cfgInstance->response_mutex, NULL);
pthread_mutex_init (&cfg_instance->response_mutex, NULL);
pthread_mutex_init (&cfgInstance->dispatch_mutex, NULL);
pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL);
saHandleInstancePut (&cfgHandleDatabase, *cfgHandle);
saHandleInstancePut (&cfg_hdb, *cfg_handle);
return (SA_OK);
return (SA_AIS_OK);
error_put_destroy:
saHandleInstancePut (&cfgHandleDatabase, *cfgHandle);
saHandleInstancePut (&cfg_hdb, *cfg_handle);
error_destroy:
saHandleDestroy (&cfgHandleDatabase, *cfgHandle);
saHandleDestroy (&cfg_hdb, *cfg_handle);
error_no_destroy:
return (error);
}
SaAisErrorT
openaisCfgSelectionObjectGet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_fd_get (
openais_cfg_handle_t cfg_handle,
SaSelectionObjectT *selectionObject)
{
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
SaAisErrorT error;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle, (void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
*selectionObject = cfgInstance->dispatch_fd;
*selectionObject = cfg_instance->dispatch_fd;
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
return (SA_OK);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (SA_AIS_OK);
}
SaAisErrorT
openaisCfgDispatch (
OpenaisCfgHandleT cfgHandle,
openais_cfg_dispatch (
openais_cfg_handle_t cfg_handle,
SaDispatchFlagsT dispatchFlags)
{
struct pollfd ufds;
@ -183,7 +168,7 @@ openaisCfgDispatch (
SaAisErrorT error;
int cont = 1; /* always continue do loop except when set to 0 */
int dispatch_avail;
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
#ifdef COMPILE_OUT
struct res_lib_openais_healthcheckcallback *res_lib_openais_healthcheckcallback;
struct res_lib_openais_readinessstatesetcallback *res_lib_openais_readinessstatesetcallback;
@ -194,9 +179,9 @@ openaisCfgDispatch (
OpenaisCfgCallbacksT callbacks;
struct res_overlay dispatch_data;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle,
(void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
(void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
@ -211,38 +196,38 @@ openaisCfgDispatch (
/*
* Read data directly from socket
*/
ufds.fd = cfgInstance->dispatch_fd;
ufds.fd = cfg_instance->dispatch_fd;
ufds.events = POLLIN;
ufds.revents = 0;
error = saPollRetry (&ufds, 1, timeout);
if (error != SA_OK) {
if (error != SA_AIS_OK) {
goto error_nounlock;
}
pthread_mutex_lock (&cfgInstance->dispatch_mutex);
pthread_mutex_lock (&cfg_instance->dispatch_mutex);
error = saPollRetry (&ufds, 1, 0);
if (error != SA_OK) {
if (error != SA_AIS_OK) {
goto error_nounlock;
}
/*
* Handle has been finalized in another thread
*/
if (cfgInstance->finalize == 1) {
error = SA_OK;
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
if (cfg_instance->finalize == 1) {
error = SA_AIS_OK;
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
goto error_unlock;
}
dispatch_avail = ufds.revents & POLLIN;
if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
break; /* exit do while cont is 1 loop */
} else
if (dispatch_avail == 0) {
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
continue; /* next poll */
}
@ -250,91 +235,38 @@ openaisCfgDispatch (
/*
* Queue empty, read response from socket
*/
error = saRecvRetry (cfgInstance->dispatch_fd, &dispatch_data.header,
sizeof (struct res_header));
if (error != SA_OK) {
error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header,
sizeof (mar_res_header_t));
if (error != SA_AIS_OK) {
goto error_unlock;
}
if (dispatch_data.header.size > sizeof (struct res_header)) {
error = saRecvRetry (cfgInstance->dispatch_fd, &dispatch_data.data,
dispatch_data.header.size - sizeof (struct res_header));
if (error != SA_OK) {
if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.data,
dispatch_data.header.size - sizeof (mar_res_header_t));
if (error != SA_AIS_OK) {
goto error_unlock;
}
}
} else {
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
continue;
}
/*
* Make copy of callbacks, message data, unlock instance, and call callback
* A risk of this dispatch method is that the callback routines may
* operate at the same time that amfFinalize has been called in another thread.
* operate at the same time that cfgFinalize has been called in another thread.
*/
memcpy (&callbacks, &cfgInstance->callbacks, sizeof (OpenaisCfgCallbacksT));
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
memcpy (&callbacks, &cfg_instance->callbacks, sizeof (OpenaisCfgCallbacksT));
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
/*
* Dispatch incoming response
*/
switch (dispatch_data.header.id) {
#ifdef COMPILE_OUT
case MESSAGE_RES_AMF_HEALTHCHECKCALLBACK:
res_lib_openais_healthcheckcallback = (struct res_lib_openais_healthcheckcallback *)&dispatch_data;
callbacks.openaisCfgHealthcheckCallback (
res_lib_openais_healthcheckcallback->invocation,
&res_lib_openais_healthcheckcallback->compName,
res_lib_openais_healthcheckcallback->checkType);
break;
case MESSAGE_RES_AMF_READINESSSTATESETCALLBACK:
res_lib_openais_readinessstatesetcallback = (struct res_lib_openais_readinessstatesetcallback *)&dispatch_data;
callbacks.openaisCfgReadinessStateSetCallback (
res_lib_openais_readinessstatesetcallback->invocation,
&res_lib_openais_readinessstatesetcallback->compName,
res_lib_openais_readinessstatesetcallback->readinessState);
break;
case MESSAGE_RES_AMF_CSISETCALLBACK:
res_lib_openais_csisetcallback = (struct res_lib_openais_csisetcallback *)&dispatch_data;
callbacks.openaisCfgCSISetCallback (
res_lib_openais_csisetcallback->invocation,
&res_lib_openais_csisetcallback->compName,
&res_lib_openais_csisetcallback->csiName,
res_lib_openais_csisetcallback->csiFlags,
&res_lib_openais_csisetcallback->haState,
&res_lib_openais_csisetcallback->activeCompName,
res_lib_openais_csisetcallback->transitionDescriptor);
break;
case MESSAGE_RES_AMF_CSIREMOVECALLBACK:
res_lib_openais_csiremovecallback = (struct res_lib_openais_csiremovecallback *)&dispatch_data;
callbacks.openaisCfgCSIRemoveCallback (
res_lib_openais_csiremovecallback->invocation,
&res_lib_openais_csiremovecallback->compName,
&res_lib_openais_csiremovecallback->csiName,
&res_lib_openais_csiremovecallback->csiFlags);
break;
case MESSAGE_RES_AMF_PROTECTIONGROUPTRACKCALLBACK:
res_lib_cfg_statetrackcallback = (struct res_lib_cfg_statetrackcallback *)&dispatch_data;
memcpy (res_lib_cfg_statetrackcallback->notificationBufferAddress,
res_lib_cfg_statetrackcallback->notificationBuffer,
res_lib_cfg_statetrackcallback->numberOfItems * sizeof (OpenaisCfgProtectionGroupNotificationT));
callbacks.openaisCfgProtectionGroupTrackCallback(
&res_lib_cfg_statetrackcallback->csiName,
res_lib_cfg_statetrackcallback->notificationBufferAddress,
res_lib_cfg_statetrackcallback->numberOfItems,
res_lib_cfg_statetrackcallback->numberOfMembers,
res_lib_cfg_statetrackcallback->error);
break;
#endif
default:
error = SA_ERR_LIBRARY;
error = SA_AIS_ERR_LIBRARY;
goto error_nounlock;
break;
}
@ -354,143 +286,254 @@ openaisCfgDispatch (
} while (cont);
error_unlock:
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
saHandleInstancePut (&cfg_hdb, cfg_handle);
error_nounlock:
return (error);
}
SaAisErrorT
openaisCfgFinalize (
OpenaisCfgHandleT cfgHandle)
openais_cfg_finalize (
openais_cfg_handle_t cfg_handle)
{
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
SaAisErrorT error;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle, (void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
pthread_mutex_lock (&cfgInstance->dispatch_mutex);
pthread_mutex_lock (&cfg_instance->dispatch_mutex);
pthread_mutex_lock (&cfgInstance->response_mutex);
pthread_mutex_lock (&cfg_instance->response_mutex);
/*
* Another thread has already started finalizing
*/
if (cfgInstance->finalize) {
pthread_mutex_unlock (&cfgInstance->response_mutex);
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
return (SA_ERR_BAD_HANDLE);
if (cfg_instance->finalize) {
pthread_mutex_unlock (&cfg_instance->response_mutex);
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (SA_AIS_ERR_BAD_HANDLE);
}
cfgInstance->finalize = 1;
cfg_instance->finalize = 1;
pthread_mutex_unlock (&cfgInstance->response_mutex);
pthread_mutex_unlock (&cfg_instance->response_mutex);
pthread_mutex_unlock (&cfgInstance->dispatch_mutex);
pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
saHandleDestroy (&cfgHandleDatabase, cfgHandle);
saHandleDestroy (&cfg_hdb, cfg_handle);
if (cfgInstance->response_fd != -1) {
shutdown (cfgInstance->response_fd, 0);
close (cfgInstance->response_fd);
if (cfg_instance->response_fd != -1) {
shutdown (cfg_instance->response_fd, 0);
close (cfg_instance->response_fd);
}
if (cfgInstance->dispatch_fd != -1) {
shutdown (cfgInstance->dispatch_fd, 0);
close (cfgInstance->dispatch_fd);
if (cfg_instance->dispatch_fd != -1) {
shutdown (cfg_instance->dispatch_fd, 0);
close (cfg_instance->dispatch_fd);
}
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error);
}
SaAisErrorT
openaisCfgStateTrackStart (
OpenaisCfgHandleT cfgHandle,
SaUint8T trackFlags,
const OpenaisCfgStateNotificationT *notificationBuffer)
openais_cfg_ring_status_get (
openais_cfg_handle_t cfg_handle,
char ***interface_names,
char ***status,
unsigned int *interface_count)
{
struct cfgInstance *cfgInstance;
struct req_lib_cfg_statetrackstart req_lib_cfg_statetrackstart;
struct res_lib_cfg_statetrackstart res_lib_cfg_statetrackstart;
struct cfg_instance *cfg_instance;
struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget;
struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
unsigned int i;
SaAisErrorT error;
req_lib_cfg_statetrackstart.header.size = sizeof (struct req_lib_cfg_statetrackstart);
req_lib_cfg_statetrackstart.header.id = MESSAGE_REQ_CFG_STATETRACKSTART;
req_lib_cfg_statetrackstart.trackFlags = trackFlags;
req_lib_cfg_statetrackstart.notificationBufferAddress = (OpenaisCfgStateNotificationT *)notificationBuffer;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle,
(void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
pthread_mutex_lock (&cfgInstance->response_mutex);
req_lib_cfg_ringstatusget.header.size = sizeof (struct req_lib_cfg_ringstatusget);
req_lib_cfg_ringstatusget.header.id = MESSAGE_REQ_CFG_RINGSTATUSGET;
error = saSendReceiveReply (cfgInstance->response_fd,
&req_lib_cfg_statetrackstart,
sizeof (struct req_lib_cfg_statetrackstart),
&res_lib_cfg_statetrackstart,
sizeof (struct res_lib_cfg_statetrackstart));
pthread_mutex_lock (&cfg_instance->response_mutex);
pthread_mutex_unlock (&cfgInstance->response_mutex);
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_ringstatusget,
sizeof (struct req_lib_cfg_ringstatusget),
&res_lib_cfg_ringstatusget,
sizeof (struct res_lib_cfg_ringstatusget));
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
pthread_mutex_unlock (&cfg_instance->response_mutex);
return (error == SA_AIS_OK ? res_lib_cfg_statetrackstart.header.error : error);
*interface_count = res_lib_cfg_ringstatusget.interface_count;
*interface_names = malloc (sizeof (char *) * *interface_count);
if (*interface_names == NULL) {
return (SA_AIS_ERR_NO_MEMORY);
}
memset (*interface_names, 0, sizeof (char *) * *interface_count);
*status = malloc (sizeof (char *) * *interface_count);
if (*status == NULL) {
error = SA_AIS_ERR_NO_MEMORY;
goto error_free_interface_names;
}
memset (*status, 0, sizeof (char *) * *interface_count);
for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
(*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]);
if ((*(interface_names))[i] == NULL) {
error = SA_AIS_ERR_NO_MEMORY;
goto error_free_contents;
}
(*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]);
if ((*(status))[i] == NULL) {
error = SA_AIS_ERR_NO_MEMORY;
goto error_free_contents;
}
}
goto no_error;
error_free_contents:
for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
if ((*(interface_names))[i]) {
free ((*(interface_names))[i]);
}
if ((*(status))[i]) {
free ((*(status))[i]);
}
}
free (*status);
error_free_interface_names:
free (*interface_names);
no_error:
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error);
}
SaAisErrorT
openaisCfgStateTrackStop (
OpenaisCfgHandleT cfgHandle)
openais_cfg_ring_reenable (
openais_cfg_handle_t cfg_handle)
{
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable;
struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
SaAisErrorT error;
error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
req_lib_cfg_ringreenable.header.size = sizeof (struct req_lib_cfg_ringreenable);
req_lib_cfg_ringreenable.header.id = MESSAGE_REQ_CFG_RINGREENABLE;
pthread_mutex_lock (&cfg_instance->response_mutex);
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_ringreenable,
sizeof (struct req_lib_cfg_ringreenable),
&res_lib_cfg_ringreenable,
sizeof (struct res_lib_cfg_ringreenable));
pthread_mutex_unlock (&cfg_instance->response_mutex);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error);
}
SaAisErrorT
openais_cfg_state_track (
openais_cfg_handle_t cfg_handle,
SaUint8T trackFlags,
const OpenaisCfgStateNotificationT *notificationBuffer)
{
struct cfg_instance *cfg_instance;
struct req_lib_cfg_statetrack req_lib_cfg_statetrack;
struct res_lib_cfg_statetrack res_lib_cfg_statetrack;
SaAisErrorT error;
req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack);
req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART;
req_lib_cfg_statetrack.trackFlags = trackFlags;
req_lib_cfg_statetrack.notificationBufferAddress = (OpenaisCfgStateNotificationT *)notificationBuffer;
error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
(void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
pthread_mutex_lock (&cfg_instance->response_mutex);
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_statetrack,
sizeof (struct req_lib_cfg_statetrack),
&res_lib_cfg_statetrack,
sizeof (struct res_lib_cfg_statetrack));
pthread_mutex_unlock (&cfg_instance->response_mutex);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error == SA_AIS_OK ? res_lib_cfg_statetrack.header.error : error);
}
SaAisErrorT
openais_cfg_state_track_stop (
openais_cfg_handle_t cfg_handle)
{
struct cfg_instance *cfg_instance;
struct req_lib_cfg_statetrackstop req_lib_cfg_statetrackstop;
struct res_lib_cfg_statetrackstop res_lib_cfg_statetrackstop;
SaAisErrorT error;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle,
(void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
(void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
req_lib_cfg_statetrackstop.header.size = sizeof (struct req_lib_cfg_statetrackstop);
req_lib_cfg_statetrackstop.header.id = MESSAGE_REQ_CFG_STATETRACKSTOP;
pthread_mutex_lock (&cfgInstance->response_mutex);
pthread_mutex_lock (&cfg_instance->response_mutex);
error = saSendReceiveReply (cfgInstance->response_fd,
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_statetrackstop,
sizeof (struct req_lib_cfg_statetrackstop),
&res_lib_cfg_statetrackstop,
sizeof (struct res_lib_cfg_statetrackstop));
pthread_mutex_unlock (&cfgInstance->response_mutex);
pthread_mutex_unlock (&cfg_instance->response_mutex);
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error == SA_AIS_OK ? res_lib_cfg_statetrackstop.header.error : error);
}
SaAisErrorT
openaisCfgAdministrativeStateGet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_admin_state_get (
openais_cfg_handle_t cfg_handle,
OpenaisCfgAdministrativeTargetT administrativeTarget,
OpenaisCfgAdministrativeStateT *administrativeState)
{
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget;
struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget;
SaAisErrorT error;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle,
(void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
(void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
@ -498,7 +541,7 @@ openaisCfgAdministrativeStateGet (
req_lib_cfg_administrativestateget.header.size = sizeof (struct req_lib_cfg_administrativestateget);
req_lib_cfg_administrativestateget.administrativeTarget = administrativeTarget;
error = saSendReceiveReply (cfgInstance->response_fd,
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_administrativestateget,
sizeof (struct req_lib_cfg_administrativestateget),
&res_lib_cfg_administrativestateget,
@ -506,27 +549,27 @@ openaisCfgAdministrativeStateGet (
error = res_lib_cfg_administrativestateget.header.error;
pthread_mutex_unlock (&cfgInstance->response_mutex);
pthread_mutex_unlock (&cfg_instance->response_mutex);
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error == SA_AIS_OK ? res_lib_cfg_administrativestateget.header.error : error);
}
SaAisErrorT
openaisCfgAdministrativeStateSet (
OpenaisCfgHandleT cfgHandle,
openais_cfg_admin_state_set (
openais_cfg_handle_t cfg_handle,
OpenaisCfgAdministrativeTargetT administrativeTarget,
OpenaisCfgAdministrativeStateT administrativeState)
{
struct cfgInstance *cfgInstance;
struct cfg_instance *cfg_instance;
struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset;
struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset;
SaAisErrorT error;
error = saHandleInstanceGet (&cfgHandleDatabase, cfgHandle,
(void *)&cfgInstance);
if (error != SA_OK) {
error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
(void *)&cfg_instance);
if (error != SA_AIS_OK) {
return (error);
}
@ -535,7 +578,7 @@ openaisCfgAdministrativeStateSet (
req_lib_cfg_administrativestateset.administrativeTarget = administrativeTarget;
req_lib_cfg_administrativestateset.administrativeState = administrativeState;
error = saSendReceiveReply (cfgInstance->response_fd,
error = saSendReceiveReply (cfg_instance->response_fd,
&req_lib_cfg_administrativestateset,
sizeof (struct req_lib_cfg_administrativestateset),
&res_lib_cfg_administrativestateset,
@ -543,9 +586,9 @@ openaisCfgAdministrativeStateSet (
error = res_lib_cfg_administrativestateset.header.error;
pthread_mutex_unlock (&cfgInstance->response_mutex);
pthread_mutex_unlock (&cfg_instance->response_mutex);
saHandleInstancePut (&cfgHandleDatabase, cfgHandle);
saHandleInstancePut (&cfg_hdb, cfg_handle);
return (error == SA_AIS_OK ? res_lib_cfg_administrativestateset.header.error : error);
}

View File

@ -1,29 +0,0 @@
# Version and symbol export for libSaCkpt.so
OPENAIS_CKPT_B.01.01 {
global:
openaisCfgInitialize;
openaisCfgSelectionObjectGet;
openaisCfgDispatch;
openaisCfgFinalize;
openaisCfgAdministrativeStateGet;
openaisCfgAdministrativeStateSet;
openaisCfgTrackStart;
openaisCfgTrackStop;
local:
saHandleCreate;
saHandleDestroy;
saHandleInstanceGet;
saHandleInstancePut;
saPollRetry;
saRecvRetry;
saSendMsgReceiveReply;
saSendMsgRetry;
saSendReceiveReply;
saSendRetry;
saServiceConnect;
saVersionVerify;
clustTimeNow;
};

31
lib/libcfg.versions Normal file
View File

@ -0,0 +1,31 @@
# Version and symbol export for libcfg.so
OPENAIS_CFG_0.80 {
global:
openais_cfg_initialize;
openais_cfg_fd_get;
openais_cfg_dispatch;
openais_cfg_finalize;
openais_cfg_administrative_state_get;
openais_cfg_administrative_state_set;
openais_cfg_track;
openais_cfg_track_stop;
openais_cfg_ring_status_get;
openais_cfg_ring_reenable;
local:
saHandleCreate;
saHandleDestroy;
saHandleInstanceGet;
saHandleInstancePut;
saPollRetry;
saRecvRetry;
saSendMsgReceiveReply;
saSendMsgRetry;
saSendReceiveReply;
saSendRetry;
saServiceConnect;
saVersionVerify;
clustTimeNow;
};

View File

@ -32,7 +32,7 @@
#
include ../Makefile.inc
LIBRARIES= ../lib/libSaClm.a ../lib/libSaAmf.a ../lib/libSaCkpt.a ../lib/libSaEvt.a ../lib/libSaLck.a ../lib/libSaMsg.a ../lib/libevs.a ../lib/libcpg.a
LIBRARIES= ../lib/libSaClm.a ../lib/libSaAmf.a ../lib/libSaCkpt.a ../lib/libSaEvt.a ../lib/libSaLck.a ../lib/libSaMsg.a ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a
LIBS = $(LIBRARIES)
CFLAGS += -I../include
@ -49,7 +49,8 @@ TEST_SRC = testclm.c testamf1.c \
all: testclm testamf1 \
testckpt ckptstress ckptbench \
ckptbenchth ckpt-rd ckpt-wr testevt testevs \
evsbench subscription publish evtbench unlink testclm2 testlck testmsg testcpg
evsbench subscription publish evtbench unlink testclm2 testlck \
testmsg testcpg openais-cfgtool
testtimer: testtimer.o $(LIBRARIES)
$(CC) $(LDFLAGS) -o testtimer testtimer.o ../exec/timer.o
@ -138,6 +139,9 @@ testmsg: testmsg.o $(LIBRARIES)
testcpg: testcpg.o $(LIBRARIES)
$(CC) $(LDFLAGS) -o testcpg testcpg.o $(LIBS)
openais-cfgtool: openais-cfgtool.o $(LIBRARIES)
$(CC) $(LDFLAGS) -o openais-cfgtool openais-cfgtool.o $(LIBS)
clean:
rm -f *.o testclm testamf testamf1 testamf2 testamf3 testamf4 \
testamf5 testamf6 testamfth testckpt ckptstress testtimer \

130
test/openais-cfgtool.c Normal file
View File

@ -0,0 +1,130 @@
/*
* Copyright (c) 2006 Red Hat Inc
*
* All rights reserved.
*
* Author: Steven Dake <sdake@redhat.com>
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "saAis.h"
#include "cfg.h"
static void ringstatusget_do (void)
{
SaAisErrorT result;
openais_cfg_handle_t handle;
unsigned int interface_count;
char **interface_names;
char **interface_status;
unsigned int i;
printf ("Printing ring status.\n");
result = openais_cfg_initialize (&handle, NULL);
if (result != SA_AIS_OK) {
printf ("Could not initialize openais configuration API error %d\n", result);
exit (1);
}
openais_cfg_ring_status_get (handle,
&interface_names,
&interface_status,
&interface_count);
for (i = 0; i < interface_count; i++) {
printf ("RING ID %d\n", i);
printf ("\tid\t= %s\n", interface_names[i]);
printf ("\tstatus\t= %s\n", interface_status[i]);
}
openais_cfg_finalize (handle);
}
static void ringreenable_do (void)
{
SaAisErrorT result;
openais_cfg_handle_t handle;
printf ("Re-enabling all failed rings.\n");
result = openais_cfg_initialize (&handle, NULL);
if (result != SA_AIS_OK) {
printf ("Could not initialize openais configuration API error %d\n", result);
exit (1);
}
result = openais_cfg_ring_reenable (handle);
if (result != SA_AIS_OK) {
printf ("Could not reenable ring error %d\n", result);
}
openais_cfg_finalize (handle);
}
void usage_do (void)
{
printf ("openais-cfgtool [-s] [-r]\n\n");
printf ("A tool for displaying and configuring active parameters within openais.\n");
printf ("options:\n");
printf ("\t-s\tDisplays the status of the current rings on this node.\n");
printf ("\t-r\tReset redundant ring state cluster wide after a fault to\n");
printf ("\t\tre-enable redundant ring operation.\n");
}
int main (int argc, char *argv[]) {
const char *options = "sr";
int opt;
if (argc == 1) {
usage_do ();
}
while ( (opt = getopt(argc, argv, options)) != -1 ) {
switch (opt) {
case 's':
ringstatusget_do ();
break;
case 'r':
ringreenable_do ();
break;
}
}
return (0);
}