Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx> --- cts/agents/Makefile.am | 48 +------- cts/agents/cpg_test_agent.c | 125 ++++++++--------- cts/agents/syncv2.c | 306 ------------------------------------------- cts/corotests.py | 82 +----------- 4 files changed, 63 insertions(+), 498 deletions(-) delete mode 100644 cts/agents/syncv2.c diff --git a/cts/agents/Makefile.am b/cts/agents/Makefile.am index 0cdc48e..5848b02 100644 --- a/cts/agents/Makefile.am +++ b/cts/agents/Makefile.am @@ -36,23 +36,14 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ SOURCES = TEST_AGENTS = cpg_test_agent sam_test_agent votequorum_test_agent -EXTRA_DIST = syncv2.c - if INSTALL_TESTAGENTS agentdir = $(datadir)/$(PACKAGE)/tests bin_PROGRAMS = $(TEST_AGENTS) dist_agent_SCRIPTS = mem_leak_test.sh net_breaker.sh cmap-dispatch-deadlock.sh shm_leak_audit.sh - AM_CFLAGS = -fPIC -SERVICE_LCRSO = syncv2 -SOURCES += $(SERVICE_LCRSO:%=%.c) -LCRSO = $(SERVICE_LCRSO:%=service_%.lcrso) -LCRSO_OBJS = $(SOURCES:%.c=%.o) else noinst_PROGRAMS = $(TEST_AGENTS) noinst_SCRIPTS = mem_leak_test.sh net_breaker.sh cmap-dispatch-deadlock.sh shm_leak_audit.sh -LCRSO = -LCRSO_OBJS = endif noinst_HEADERS = common_test_agent.h @@ -69,45 +60,8 @@ votequorum_test_agent_SOURCES = votequorum_test_agent.c common_test_agent.c votequorum_test_agent_LDADD = -lvotequorum -lquorum $(LIBQB_LIBS) votequorum_test_agent_LDFLAGS = -L../../lib -if BUILD_DARWIN - -service_%.lcrso: %.o - $(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -llogsys -bundle -bundle_loader $(top_builddir)/exec/corosync $^ -o $@ - -else -if BUILD_SOLARIS - -service_%.lcrso: %.o - $(LD) $(LDFLAGS) -G $^ -o $@ - -else - -service_%.lcrso: %.o - $(CC) $(LDFLAGS) $(CFLAGS) $(COVERAGE_LCRSO_EXTRA_LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@ -endif -endif - - - -if INSTALL_TESTAGENTS -syncv2.o: syncv2.c - $(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $< - -all-local: $(LCRSO_OBJS) $(LCRSO) - @echo Built Service Engines - -install-exec-local: - $(INSTALL) -d $(DESTDIR)/$(LCRSODIR) - $(INSTALL) -m 755 $(LCRSO) $(DESTDIR)/$(LCRSODIR) - -uninstall-local: - cd $(DESTDIR)/$(LCRSODIR) && \ - rm -f $(LCRSO) - -endif - clean-local: - rm -f *.o *.a *.so* *.da *.bb *.bbg *.lcrso + rm -f *.o *.a *.so* *.da *.bb *.bbg lint: -splint $(LINT_FLAGS) $(CFLAGS) *.c diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c index f4439d6..cd225b2 100644 --- a/cts/agents/cpg_test_agent.c +++ b/cts/agents/cpg_test_agent.c @@ -42,7 +42,6 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -#include <syslog.h> #include <poll.h> #include <unistd.h> #include <fcntl.h> @@ -51,6 +50,7 @@ #include <qb/qbdefs.h> #include <qb/qbutil.h> #include <qb/qbloop.h> +#include <qb/qblog.h> #include <corosync/cpg.h> #include <corosync/cfg.h> #include "../../exec/crypto.h" @@ -169,8 +169,8 @@ static void delivery_callback ( sha1_process (&sha1_hash, msg_pt->payload, (msg_pt->size - sizeof (msg_t))); sha1_done (&sha1_hash, sha1_compare); if (memcmp (sha1_compare, msg_pt->sha1, 20) != 0) { - syslog (LOG_ERR, "%s(); msg seq:%d; incorrect hash", - __func__, msg_pt->seq); + qb_log (LOG_ERR, "msg seq:%d; incorrect hash", + msg_pt->seq); status = MSG_SHA1_ERR; } @@ -185,7 +185,7 @@ static void delivery_callback ( total_msgs_revd++; if ((total_msgs_revd % 100) == 0) { - syslog (LOG_INFO, "%s(); %d", __func__, total_msgs_revd); + qb_log (LOG_INFO, "%d",total_msgs_revd); } } @@ -203,8 +203,7 @@ static void config_change_callback ( /* group_name,ip,pid,join|leave */ for (i = 0; i < left_list_entries; i++) { - syslog (LOG_INFO, "%s(%d) %d:%s left", __func__, record_config_events_g, - left_list[i].nodeid, groupName->value); + qb_log(LOG_INFO, "Member left: %s", left_list[i].nodeid); if (record_config_events_g > 0) { log_pt = malloc (sizeof(log_entry_t)); @@ -215,8 +214,7 @@ static void config_change_callback ( } } for (i = 0; i < joined_list_entries; i++) { - syslog (LOG_INFO, "%s(%d) %d:%s joined", __func__, record_config_events_g, - left_list[i].nodeid, groupName->value); + qb_log(LOG_INFO, "Member joined: %s", joined_list[i].nodeid); if (record_config_events_g > 0) { log_pt = malloc (sizeof(log_entry_t)); @@ -236,7 +234,7 @@ static void config_change_callback ( static void my_shutdown_callback (corosync_cfg_handle_t handle, corosync_cfg_shutdown_flags_t flags) { - syslog (LOG_CRIT, "%s flags:%d", __func__, flags); + qb_log (LOG_CRIT, "flags:%d", flags); if (flags & COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST) { corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); } @@ -255,7 +253,7 @@ static cpg_callbacks_t callbacks = { static void record_messages (void) { record_messages_g = 1; - syslog (LOG_DEBUG,"%s() record:%d", __func__, record_messages_g); + qb_log (LOG_DEBUG,"record:%d", record_messages_g); } static void record_config_events (int sock) @@ -263,7 +261,7 @@ static void record_config_events (int sock) char response[100]; record_config_events_g = 1; - syslog (LOG_INFO, "%s() record:%d", __func__, record_config_events_g); + qb_log (LOG_INFO, "record:%d", record_config_events_g); snprintf (response, 100, "%s", OK_STR); send (sock, response, strlen (response), 0); @@ -281,7 +279,7 @@ static void read_config_event (int sock) list_del (&entry->list); free (entry); } else { - syslog (LOG_DEBUG,"%s() no events in list", __func__); + qb_log (LOG_DEBUG, "no events in list"); send (sock, empty, strlen (empty), 0); } } @@ -298,8 +296,8 @@ static void read_messages (int sock, char* atmost_str) if (atmost > (HOW_BIG_AND_BUF / LOG_STR_SIZE)) atmost = (HOW_BIG_AND_BUF / LOG_STR_SIZE); -// syslog (LOG_DEBUG, "%s() atmost %d; total_stored_msgs:%d", -// __func__, atmost, total_stored_msgs); + qb_log(LOG_DEBUG, "atmost %d; total_stored_msgs:%d", + atmost, total_stored_msgs); big_and_buf[0] = '\0'; for (list = msg_log_head.next; @@ -319,8 +317,8 @@ static void read_messages (int sock, char* atmost_str) if (packed == 0) { strcpy (big_and_buf, "None"); } else { - syslog (LOG_INFO, "%s() sending %d; total_stored_msgs:%d; len:%d", - __func__, packed, total_stored_msgs, (int)strlen (big_and_buf)); + qb_log(LOG_INFO, "sending %d; total_stored_msgs:%d; len:%d", + packed, total_stored_msgs, (int)strlen (big_and_buf)); } send (sock, big_and_buf, strlen (big_and_buf), 0); } @@ -359,7 +357,7 @@ static void send_some_more_messages_zcb (void) my_msg = (msg_t*)zcb_buffer; - //syslog (LOG_DEBUG,"%s() send_now:%d", __func__, send_now); + qb_log(LOG_DEBUG, "send_now:%d", send_now); my_msg->pid = my_pid; my_msg->nodeid = my_nodeid; my_msg->size = sizeof (msg_t) + payload_size; @@ -377,7 +375,7 @@ static void send_some_more_messages_zcb (void) if (res == CS_OK && fc_state == CPG_FLOW_CONTROL_ENABLED) { /* lets do this later */ send_some_more_messages_later (); - syslog (LOG_INFO, "%s() flow control enabled.", __func__); + qb_log (LOG_INFO, "flow control enabled."); goto free_buffer; } @@ -386,13 +384,13 @@ static void send_some_more_messages_zcb (void) /* lets do this later */ send_some_more_messages_later (); // if (i > 0) { -// syslog (LOG_INFO, "%s() TRY_AGAIN %d to send.", -// __func__, my_msgs_to_send); +// qb_log (LOG_INFO, "TRY_AGAIN %d to send.", +// my_msgs_to_send); // } goto free_buffer; } else if (res != CS_OK) { - syslog (LOG_ERR, "%s() -> cpg_mcast_joined error:%d, exiting.", - __func__, res); + qb_log (LOG_ERR, "cpg_mcast_joined error:%d, exiting.", + res); exit (-2); } @@ -430,7 +428,8 @@ static void send_some_more_messages_normal (void) send_now = my_msgs_to_send; - //syslog (LOG_DEBUG,"%s() send_now:%d", __func__, send_now); + qb_log (LOG_DEBUG,"send_now:%d", send_now); + my_msg.pid = my_pid; my_msg.nodeid = my_nodeid; payload_size = (rand() % 10000); @@ -454,12 +453,12 @@ static void send_some_more_messages_normal (void) before = time(NULL); cs_repeat(retries, 30, res = cpg_mcast_joined(cpg_handle, CPG_TYPE_AGREED, iov, 2)); if (retries > 20) { - syslog (LOG_ERR, "%s() -> cs_repeat: blocked for :%lu secs.", - __func__, (unsigned long)(time(NULL) - before)); + qb_log (LOG_ERR, "cs_repeat: blocked for :%lu secs.", + (unsigned long)(time(NULL) - before)); } if (res != CS_OK) { - syslog (LOG_ERR, "%s() -> cpg_mcast_joined error:%d.", - __func__, res); + qb_log (LOG_ERR, "cpg_mcast_joined error:%d.", + res); return; } } else { @@ -467,7 +466,7 @@ static void send_some_more_messages_normal (void) if (res == CS_OK && fc_state == CPG_FLOW_CONTROL_ENABLED) { /* lets do this later */ send_some_more_messages_later (); - syslog (LOG_INFO, "%s() flow control enabled.", __func__); + qb_log (LOG_INFO, "flow control enabled."); return; } @@ -476,21 +475,21 @@ static void send_some_more_messages_normal (void) /* lets do this later */ send_some_more_messages_later (); if (i > 0) { - syslog (LOG_INFO, "%s() TRY_AGAIN %d to send.", - __func__, my_msgs_to_send); + qb_log (LOG_INFO, "TRY_AGAIN %d to send.", + my_msgs_to_send); } return; } else if (res != CS_OK) { - syslog (LOG_ERR, "%s() -> cpg_mcast_joined error:%d, exiting.", - __func__, res); + qb_log (LOG_ERR, "cpg_mcast_joined error:%d, exiting.", + res); exit (-2); } } my_msgs_sent++; my_msgs_to_send--; } - syslog (LOG_INFO, "%s() sent %d; to send %d.", - __func__, my_msgs_sent, my_msgs_to_send); + qb_log (LOG_INFO, "sent %d; to send %d.", + my_msgs_sent, my_msgs_to_send); } static void send_some_more_messages (void * unused) @@ -569,7 +568,7 @@ static int cfg_dispatch_wrapper_fn ( { cs_error_t error; if (revents & POLLHUP || revents & POLLERR) { - syslog (LOG_ERR, "%s() got POLLHUP disconnecting from CFG", __func__); + qb_log (LOG_ERR, "got POLLHUP disconnecting from CFG"); corosync_cfg_finalize(cfg_handle); cfg_handle = 0; qb_loop_poll_del (ta_poll_handle_get(), cfg_fd); @@ -579,7 +578,7 @@ static int cfg_dispatch_wrapper_fn ( } error = corosync_cfg_dispatch (cfg_handle, CS_DISPATCH_ALL); if (error == CS_ERR_LIBRARY) { - syslog (LOG_ERR, "%s() got LIB error disconnecting from CFG.", __func__); + qb_log (LOG_ERR, "got LIB error disconnecting from CFG."); corosync_cfg_finalize(cfg_handle); cfg_handle = 0; qb_loop_poll_del (ta_poll_handle_get(), cfg_fd); @@ -597,7 +596,7 @@ static int cpg_dispatch_wrapper_fn ( { cs_error_t error; if (revents & POLLHUP || revents & POLLERR) { - syslog (LOG_ERR, "%s() got POLLHUP disconnecting from CPG", __func__); + qb_log (LOG_ERR, "got POLLHUP disconnecting from CPG"); cpg_finalize(cpg_handle); cpg_handle = 0; qb_loop_poll_del (ta_poll_handle_get(), cpg_fd); @@ -607,7 +606,7 @@ static int cpg_dispatch_wrapper_fn ( } error = cpg_dispatch (cpg_handle, CS_DISPATCH_ALL); if (error == CS_ERR_LIBRARY) { - syslog (LOG_ERR, "%s() got LIB error disconnecting from CPG", __func__); + qb_log (LOG_ERR, "got LIB error disconnecting from CPG"); cpg_finalize(cpg_handle); cpg_handle = 0; qb_loop_poll_del (ta_poll_handle_get(), cpg_fd); @@ -625,7 +624,7 @@ static void do_command (int sock, char* func, char*args[], int num_args) struct cpg_name group_name; if (parse_debug) - syslog (LOG_DEBUG,"RPC:%s() called.", func); + qb_log (LOG_DEBUG,"RPC:%s() called.", func); if (strcmp ("cpg_mcast_joined",func) == 0) { struct iovec iov[5]; @@ -644,11 +643,11 @@ static void do_command (int sock, char* func, char*args[], int num_args) result = cpg_join (cpg_handle, &group_name); if (result != CS_OK) { - syslog (LOG_ERR, + qb_log (LOG_ERR, "Could not join process group, error %d\n", result); exit (1); } - syslog (LOG_INFO, "called cpg_join()!"); + qb_log (LOG_INFO, "called cpg_join()!"); } else if (strcmp ("cpg_leave",func) == 0) { @@ -657,18 +656,18 @@ static void do_command (int sock, char* func, char*args[], int num_args) result = cpg_leave (cpg_handle, &group_name); if (result != CS_OK) { - syslog (LOG_ERR, + qb_log (LOG_ERR, "Could not leave process group, error %d\n", result); exit (1); } - syslog (LOG_INFO, "called cpg_leave()!"); + qb_log (LOG_INFO, "called cpg_leave()!"); } else if (strcmp ("cpg_initialize",func) == 0) { int retry_count = 0; result = cpg_initialize (&cpg_handle, &callbacks); while (result != CS_OK) { - syslog (LOG_ERR, + qb_log (LOG_ERR, "cpg_initialize error %d (attempt %d)\n", result, retry_count); if (retry_count >= 3) { @@ -726,18 +725,18 @@ static void do_command (int sock, char* func, char*args[], int num_args) } else if (strcmp ("cfg_shutdown", func) == 0) { - syslog (LOG_INFO,"%s calling %s() called!", __func__, func); + qb_log (LOG_INFO, "calling %s() called!", func); result = corosync_cfg_try_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); - syslog (LOG_INFO,"%s() returned %d!", func, result); + qb_log (LOG_INFO,"%s() returned %d!", func, result); } else if (strcmp ("cfg_initialize",func) == 0) { int retry_count = 0; - syslog (LOG_INFO,"%s %s() called!", __func__, func); + qb_log (LOG_INFO,"%s() called!", func); result = corosync_cfg_initialize (&cfg_handle, &cfg_callbacks); while (result != CS_OK) { - syslog (LOG_ERR, - "cfg_initialize error %d (attempt %d)\n", + qb_log (LOG_ERR, + "cfg_initialize error %d (attempt %d)", result, retry_count); if (retry_count >= 3) { exit (1); @@ -746,13 +745,13 @@ static void do_command (int sock, char* func, char*args[], int num_args) retry_count++; result = corosync_cfg_initialize (&cfg_handle, &cfg_callbacks); } - syslog (LOG_INFO,"corosync_cfg_initialize() == %d", result); + qb_log (LOG_INFO,"corosync_cfg_initialize() == %d", result); result = corosync_cfg_fd_get (cfg_handle, &cfg_fd); - syslog (LOG_INFO,"corosync_cfg_fd_get() == %d", result); + qb_log (LOG_INFO,"corosync_cfg_fd_get() == %d", result); result = corosync_cfg_state_track (cfg_handle, 0, ¬ification_buffer); - syslog (LOG_INFO,"corosync_cfg_state_track() == %d", result); + qb_log (LOG_INFO,"corosync_cfg_state_track() == %d", result); qb_loop_poll_add (ta_poll_handle_get(), QB_LOOP_MED, @@ -761,21 +760,13 @@ static void do_command (int sock, char* func, char*args[], int num_args) NULL, cfg_dispatch_wrapper_fn); } else { - syslog (LOG_ERR,"%s RPC:%s not supported!", __func__, func); + qb_log(LOG_ERR, "RPC:%s not supported!", func); } } -static void cs_ipcs_libqb_log_fn(const char *file_name, - int32_t file_line, - int32_t severity, - const char *msg) -{ - syslog(severity, "%s:%d %s() %s", file_name, file_line, __func__, msg); -} - static void my_pre_exit(void) { - syslog (LOG_INFO, "%s PRE EXIT", __FILE__); + qb_log (LOG_INFO, "%s PRE EXIT", __FILE__); if (cpg_handle > 0) { cpg_finalize (cpg_handle); cpg_handle = 0; @@ -785,15 +776,17 @@ static void my_pre_exit(void) int main (int argc, char *argv[]) { int res = 0; - openlog (NULL, LOG_CONS|LOG_PID, LOG_DAEMON); - syslog (LOG_INFO, "%s STARTING", __FILE__); - qb_util_set_log_function (cs_ipcs_libqb_log_fn); + qb_log_init("cpg_test_agent", LOG_DAEMON, LOG_DEBUG); + qb_log_format_set(QB_LOG_SYSLOG, "%n() [%p] %b"); + qb_log (LOG_INFO, "STARTING"); + list_init (&msg_log_head); list_init (&config_chg_log_head); res = test_agent_run (9034, do_command, my_pre_exit); - syslog (LOG_INFO, "%s EXITING", __FILE__); + qb_log (LOG_INFO, "EXITING"); + qb_log_fini(); return res; } diff --git a/cts/agents/syncv2.c b/cts/agents/syncv2.c deleted file mode 100644 index fb6ad32..0000000 --- a/cts/agents/syncv2.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2010 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Angus Salkeld <asalkeld@xxxxxxxxxx> - * - * 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 <config.h> - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <sys/time.h> -#include <sys/ioctl.h> -#include <netinet/in.h> -#include <sys/uio.h> -#include <unistd.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <time.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <string.h> - -#include <corosync/swab.h> -#include <corosync/corotypes.h> -#include <qb/qbipc_common.h> -#include <corosync/corodefs.h> -#include <corosync/lcr/lcr_comp.h> -#include <corosync/mar_gen.h> -#include <corosync/coroapi.h> -#include <corosync/list.h> -#include <corosync/logsys.h> - -LOGSYS_DECLARE_SUBSYS ("TST2"); - -/* - * Service Interfaces required by service_message_handler struct - */ -static int tst_sv2_exec_init_fn ( - struct corosync_api_v1 *corosync_api); - -static void tst_sv2_confchg_fn ( - enum totem_configuration_type configuration_type, - const unsigned int *member_list, size_t member_list_entries, - const unsigned int *left_list, size_t left_list_entries, - const unsigned int *joined_list, size_t joined_list_entries, - const struct memb_ring_id *ring_id); - -static struct corosync_api_v1 *api; - -static void tst_sv2_sync_init_v2 ( - const unsigned int *member_list, - size_t member_list_entries, - const struct memb_ring_id *ring_id); - -static int tst_sv2_sync_process (void); - -static void tst_sv2_sync_activate (void); - -static void tst_sv2_sync_abort (void); - -static int tst_sv2_exec_exit_fn (void); - -struct corosync_service_engine tst_sv2_service_engine = { - .name = "corosync test synv2 service", - .id = TST_SV2_SERVICE, - .priority = 1, - .private_data_size = 0, - .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, - .lib_init_fn = NULL, - .lib_exit_fn = NULL, - .lib_engine = NULL, - .lib_engine_count = 0, - .exec_engine = NULL, - .exec_engine_count = 0, - .confchg_fn = tst_sv2_confchg_fn, - .exec_init_fn = tst_sv2_exec_init_fn, - .exec_exit_fn = tst_sv2_exec_exit_fn, - .exec_dump_fn = NULL, - .sync_mode = CS_SYNC_V2, - .sync_init = tst_sv2_sync_init_v2, - .sync_process = tst_sv2_sync_process, - .sync_activate = tst_sv2_sync_activate, - .sync_abort = tst_sv2_sync_abort -}; - -static unsigned int my_member_list[PROCESSOR_COUNT_MAX]; - -static unsigned int my_member_list_entries; - -static unsigned int my_old_member_list[PROCESSOR_COUNT_MAX]; - -static unsigned int my_old_member_list_entries = 0; -static int num_sync_processes = 0; - -static DECLARE_LIST_INIT (confchg_notify); - -/* - * Dynamic loading descriptor - */ - -static struct corosync_service_engine *tst_sv2_get_service_engine_ver0 (void); - -static struct corosync_service_engine_iface_ver0 tst_sv2_service_engine_iface = { - .corosync_get_service_engine_ver0 = tst_sv2_get_service_engine_ver0 -}; - -static struct lcr_iface corosync_tst_sv2_ver0[1] = { - { - .name = "corosync_tst_sv2", - .version = 0, - .versions_replace = 0, - .versions_replace_count = 0, - .dependencies = 0, - .dependency_count = 0, - .constructor = NULL, - .destructor = NULL, - .interfaces = NULL, - } -}; - -static struct lcr_comp tst_sv2_comp_ver0 = { - .iface_count = 1, - .ifaces = corosync_tst_sv2_ver0 -}; - -static struct corosync_service_engine *tst_sv2_get_service_engine_ver0 (void) -{ - return (&tst_sv2_service_engine); -} - -#ifdef COROSYNC_SOLARIS -void corosync_lcr_component_register (void); - -void corosync_lcr_component_register (void) { -#else -__attribute__ ((constructor)) static void corosync_lcr_component_register (void) { -#endif - lcr_interfaces_set (&corosync_tst_sv2_ver0[0], &tst_sv2_service_engine_iface); - - lcr_component_register (&tst_sv2_comp_ver0); -} - -static int tst_sv2_exec_init_fn ( - struct corosync_api_v1 *corosync_api) -{ -#ifdef COROSYNC_SOLARIS - logsys_subsys_init(); -#endif - api = corosync_api; - - return 0; -} - -static int32_t exit_count = 0; -static int tst_sv2_exec_exit_fn (void) -{ - exit_count++; - log_printf (LOGSYS_LEVEL_INFO, "exit_count:%d", exit_count); - if (exit_count < 4) { - return -1; - } - return 0; -} - -static void tst_sv2_confchg_fn ( - enum totem_configuration_type configuration_type, - const unsigned int *member_list, size_t member_list_entries, - const unsigned int *left_list, size_t left_list_entries, - const unsigned int *joined_list, size_t joined_list_entries, - const struct memb_ring_id *ring_id) -{ - int j; - for (j = 0; j < left_list_entries; j++) { - log_printf (LOGSYS_LEVEL_INFO, - "Member left: %s", api->totem_ifaces_print (left_list[j])); - } - for (j = 0; j < joined_list_entries; j++) { - log_printf (LOGSYS_LEVEL_INFO, - "Member joined: %s", api->totem_ifaces_print (joined_list[j])); - } -} - -static void tst_sv2_sync_init_v2 ( - const unsigned int *member_list, - size_t member_list_entries, - const struct memb_ring_id *ring_id) -{ - unsigned int lowest_nodeid = 0xffffffff; - int i, j; - int found; - - num_sync_processes = 0; - - memcpy (my_member_list, member_list, member_list_entries * - sizeof (unsigned int)); - my_member_list_entries = member_list_entries; - - for (i = 0; i < my_member_list_entries; i++) { - if (my_member_list[i] < lowest_nodeid) { - lowest_nodeid = my_member_list[i]; - } - } - - log_printf (LOGSYS_LEVEL_INFO, - "tst_sv2_sync_init_v2 %s", - api->totem_ifaces_print (lowest_nodeid)); - - /* look for new (joined) nodes */ - for (j = 0; j < member_list_entries; j++) { - found = 0; - for (i = 0; i < my_old_member_list_entries; i++) { - if (my_old_member_list[i] == member_list[j]) { - found = 1; - break; - } - } - if (found == 0) { - log_printf (LOGSYS_LEVEL_INFO, - "sync: node joined %s", - api->totem_ifaces_print (member_list[j])); - } - } - /* look for old (left) nodes */ - for (i = 0; i < my_old_member_list_entries; i++) { - found = 0; - for (j = 0; j < member_list_entries; j++) { - if (my_old_member_list[i] == member_list[j]) { - found = 1; - break; - } - } - if (found == 0) { - log_printf (LOGSYS_LEVEL_INFO, - "sync: node left %s", - api->totem_ifaces_print (my_old_member_list[i])); - } - } - -} - -static int tst_sv2_sync_process (void) -{ - num_sync_processes++; - - if (num_sync_processes > 3) { - return 0; - } else { - return 1; - } -} - -static void tst_sv2_sync_activate (void) -{ - memcpy (my_old_member_list, my_member_list, - my_member_list_entries * sizeof (unsigned int)); - my_old_member_list_entries = my_member_list_entries; - - if (num_sync_processes <= 3) { - log_printf (LOGSYS_LEVEL_ERROR, - "sync: activate called before process is done %d", - num_sync_processes); - } else { - log_printf (LOGSYS_LEVEL_INFO, - "sync: activate correctly %d", - num_sync_processes); - } - - num_sync_processes = 0; -} - -static void tst_sv2_sync_abort (void) -{ - log_printf (LOGSYS_LEVEL_INFO, "sync: abort"); -} - diff --git a/cts/corotests.py b/cts/corotests.py index 7c881a8..f8a313e 100644 --- a/cts/corotests.py +++ b/cts/corotests.py @@ -552,83 +552,6 @@ class MemLeakSession(CoroTest): return self.failure(str(mem_leaked) + 'kB memory leaked.') ################################################################### -class ServiceLoadTest(CoroTest): - ''' - Test loading and unloading of service engines - ''' - def __init__(self, cm): - CoroTest.__init__(self, cm) - self.name="ServiceLoadTest" - - def is_loaded(self, node): - check = 'corosync-objctl runtime.services. | grep evs' - - (res, out) = self.CM.rsh(node, check, stdout=2) - if res is 0: - return True - else: - return False - - def service_unload(self, node): - # unload evs - pats = [] - pats.append("%s .*Service engine unloaded: corosync extended.*" % node) - unloaded = self.create_watch(pats, 60) - unloaded.setwatch() - - self.CM.rsh(node, 'corosync-cfgtool -u corosync_evs') - - if not unloaded.lookforall(): - self.CM.log("Patterns not found: " + repr(unloaded.unmatched)) - self.error_message = "evs service not unloaded" - return False - - if self.is_loaded(node): - self.error_message = "evs has been unload, why are it's session objects are still there?" - return False - return True - - def service_load(self, node): - # now reload it. - pats = [] - pats.append("%s .*Service engine loaded.*" % node) - loaded = self.create_watch(pats, 60) - loaded.setwatch() - - self.CM.rsh(node, 'corosync-cfgtool -l corosync_evs') - - if not loaded.lookforall(): - self.CM.log("Patterns not found: " + repr(loaded.unmatched)) - self.error_message = "evs service not unloaded" - return False - - return True - - - def __call__(self, node): - self.incr("calls") - should_be_loaded = True - - if self.is_loaded(node): - ret = self.service_unload(node) - should_be_loaded = False - else: - ret = self.service_load(node) - should_be_loaded = True - - if not ret: - return self.failure(self.error_message) - - if self.is_loaded(node): - ret = self.service_unload(node) - else: - ret = self.service_load(node) - - if not ret: - return self.failure(self.error_message) - - return self.success() - class CMapDispatchDeadlock(CoroTest): ''' run cmap-dispatch-deadlock.sh @@ -1459,7 +1382,9 @@ GenTestClasses.append(CpgCfgChgOnGroupLeave) GenTestClasses.append(CpgCfgChgOnNodeLeave) GenTestClasses.append(CpgCfgChgOnNodeIsolate) #GenTestClasses.append(CpgCfgChgOnNodeRestart) -GenTestClasses.append(CpgCfgChgOnLowestNodeJoin) + +# TODO need log messages in sync +#GenTestClasses.append(CpgCfgChgOnLowestNodeJoin) GenTestClasses.append(VoteQuorumGoDown) GenTestClasses.append(VoteQuorumGoUp) @@ -1483,7 +1408,6 @@ AllTestClasses.append(NoWDOnCorosyncStop) AllTestClasses.append(WdDeleteResource) #AllTestClasses.append(RebootOnHighMem) AllTestClasses.append(ResourcePollAdjust) -AllTestClasses.append(ServiceLoadTest) AllTestClasses.append(MemLeakObject) AllTestClasses.append(MemLeakSession) #AllTestClasses.append(CMapDispatchDeadlock) -- 1.7.7.5 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss