diff --git a/exec/Makefile.am b/exec/Makefile.am index 0bb3a644..ae28f312 100644 --- a/exec/Makefile.am +++ b/exec/Makefile.am @@ -67,7 +67,7 @@ noinst_HEADERS = apidef.h crypto.h mainconfig.h main.h \ quorum.h service.h sync.h timer.h totemconfig.h \ totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \ totemudpu.h totemsrp.h util.h vsf.h schedwrk.h \ - evil.h syncv2.h fsm.h + evil.h syncv2.h fsm.h votequorum.h if BUILD_DARWIN libtotem_pg.so.$(SONAME): $(TOTEM_OBJS) diff --git a/exec/service.c b/exec/service.c index 874d6a40..14321467 100644 --- a/exec/service.c +++ b/exec/service.c @@ -99,13 +99,16 @@ static struct default_service default_services[] = { .loader = wd_get_service_engine_ver0 }, #endif -#ifdef HAVE_VOTEQUORUM { - .name = "corosync_quorum", + .name = "corosync_votequorum", .ver = 0, .loader = votequorum_get_service_engine_ver0 }, -#endif + { + .name = "corosync_quorum", + .ver = 0, + .loader = vsf_quorum_get_service_engine_ver0 + }, { .name = "corosync_cmap", .ver = 0, diff --git a/exec/service.h b/exec/service.h index 33d60531..53091748 100644 --- a/exec/service.h +++ b/exec/service.h @@ -77,6 +77,8 @@ extern const char *service_stats_rx[SERVICE_HANDLER_MAXIMUM_COUNT][64]; extern const char *service_stats_tx[SERVICE_HANDLER_MAXIMUM_COUNT][64]; struct corosync_service_engine *votequorum_get_service_engine_ver0 (void); +struct corosync_service_engine *vsf_quorum_get_service_engine_ver0 (void); +struct corosync_service_engine *quorum_get_service_handler_ver0 (void); struct corosync_service_engine *pload_get_service_engine_ver0 (void); struct corosync_service_engine *cfg_get_service_engine_ver0 (void); struct corosync_service_engine *evs_get_service_engine_ver0 (void); diff --git a/exec/votequorum.c b/exec/votequorum.c index b748c444..023eb0f0 100644 --- a/exec/votequorum.c +++ b/exec/votequorum.c @@ -114,6 +114,8 @@ struct req_exec_quorum_reconfigure { * votequorum_exec onwire version (via totem) */ +#include "votequorum.h" + #define VOTEQUORUM_MAJOR_VERSION 7 #define VOTEQUORUM_MINOR_VERSION 0 #define VOTEQUORUM_PATCH_VERSION 0 @@ -207,9 +209,6 @@ static int last_man_standing_timer_set = 0; * Service Interfaces required by service_message_handler struct */ -static void votequorum_init(struct corosync_api_v1 *api, - quorum_set_quorate_fn_t q_set_quorate_fn); - static void votequorum_confchg_fn ( enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, @@ -1191,8 +1190,9 @@ static void votequorum_confchg_fn ( LEAVE(); } -static void votequorum_init(struct corosync_api_v1 *api, - quorum_set_quorate_fn_t q_set_quorate_fn) + +cs_error_t votequorum_init(struct corosync_api_v1 *api, + quorum_set_quorate_fn_t q_set_quorate_fn) { ENTER(); @@ -1200,10 +1200,9 @@ static void votequorum_init(struct corosync_api_v1 *api, votequorum_readconfig_static(); - /* Load the library-servicing part of this module */ - api->service_link_and_init(api, "corosync_votequorum_iface", 0); - LEAVE(); + + return CS_OK; } /* diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index 2e8a2d62..c258c145 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Red Hat, Inc. + * Copyright (c) 2008, 2009, 2012 Red Hat, Inc. * * All rights reserved. * @@ -67,6 +67,8 @@ #include #include +#include "votequorum.h" + LOGSYS_DECLARE_SUBSYS ("QUORUM"); struct quorum_pd { @@ -193,7 +195,7 @@ static struct corosync_service_engine quorum_service_handler = { .sync_mode = CS_SYNC_V1 }; -static struct corosync_service_engine *quorum_get_service_engine_ver0 (void) +struct corosync_service_engine *vsf_quorum_get_service_engine_ver0 (void) { return (&quorum_service_handler); } @@ -250,10 +252,11 @@ static struct quorum_callin_functions callins = { static int quorum_exec_init_fn (struct corosync_api_v1 *api) { + char *quorum_module; + #ifdef COROSYNC_SOLARIS logsys_subsys_init(); #endif -#ifdef SDAKE corosync_api = api; list_init (&lib_trackers_list); list_init (&internal_trackers_list); @@ -267,45 +270,25 @@ static int quorum_exec_init_fn (struct corosync_api_v1 *api) * Look for a quorum provider */ if (icmap_get_string("quorum.provider", &quorum_module) == CS_OK) { - res = lcr_ifact_reference ( - &q_handle, - quorum_module, - 0, - &quorum_iface_p, - 0); - - if (res == -1) { - log_printf (LOGSYS_LEVEL_NOTICE, - "Couldn't load quorum provider %s\n", - quorum_module); - free(quorum_module); - return (-1); - } - log_printf (LOGSYS_LEVEL_NOTICE, "Using quorum provider %s\n", quorum_module); - /* - * Register the log sites with libqb - */ - _start = lcr_ifact_addr_get(q_handle, "__start___verbose"); - _stop = lcr_ifact_addr_get(q_handle, "__stop___verbose"); - qb_log_callsites_register(_start, _stop); - - quorum_iface = (struct quorum_services_api_ver1 *)quorum_iface_p; - quorum_iface->init (api, quorum_api_set_quorum); - quorum_type = 1; - free(quorum_module); + if (strcmp (quorum_module, "corosync_votequorum") == 0) { + if (votequorum_init (api, quorum_api_set_quorum) == CS_OK) { + quorum_type = 1; + } + } } - if (!quorum_iface) { - /* - * With no quorum provider, we are always quorate - */ + + /* + * setting quorum_type and primary_designated in the right order is important + * always try to lookup/init a quorum module, then revert back to be quorate + */ + + if (quorum_type == 0) { primary_designated = 1; - quorum_type = 0; } -#endif return (0); }