diff --git a/conf/corosync.conf.example b/conf/corosync.conf.example index 7cf3f8b1..fa4973f0 100644 --- a/conf/corosync.conf.example +++ b/conf/corosync.conf.example @@ -1,4 +1,6 @@ # Please read the corosync.conf.5 manual page +compatibility: whitetank + totem { version: 2 secauth: off diff --git a/exec/main.c b/exec/main.c index 0ffa0468..bc9c1e01 100644 --- a/exec/main.c +++ b/exec/main.c @@ -119,6 +119,10 @@ static struct objdb_iface_ver0 *objdb = NULL; static struct corosync_api_v1 *api = NULL; +static enum cs_sync_mode minimum_sync_mode; + +static enum cs_sync_mode minimum_sync_mode; + unsigned long long *(*main_clm_get_by_nodeid) (unsigned int node_id); hdb_handle_t corosync_poll_handle; @@ -837,7 +841,6 @@ int main (int argc, char **argv) corosync_exit_error (AIS_DONE_DIR_NOT_PRESENT); } - res = totem_config_read (objdb, &totem_config, &error_string); if (res == -1) { log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string); @@ -873,6 +876,22 @@ int main (int argc, char **argv) totem_config.totem_logging_configuration.log_level_debug = LOGSYS_LEVEL_DEBUG; totem_config.totem_logging_configuration.log_printf = _logsys_log_printf; + res = corosync_main_config_compatibility_read (objdb, + &minimum_sync_mode, + &error_string); + if (res == -1) { + log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string); + corosync_exit_error (AIS_DONE_MAINCONFIGREAD); + } + + res = corosync_main_config_compatibility_read (objdb, + &minimum_sync_mode, + &error_string); + if (res == -1) { + log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string); + corosync_exit_error (AIS_DONE_MAINCONFIGREAD); + } + /* * Sleep for a while to let other nodes in the cluster * understand that this node has been away (if it was @@ -905,6 +924,12 @@ int main (int argc, char **argv) &corosync_group, 1); + if (minimum_sync_mode == 1) { + log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to none. Using V2 of the synchronization engine.\n"); + } else + if (minimum_sync_mode == 0) { + log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to whitetank. Using V1 and V2 of the synchronization engine.\n"); + } /* * This must occur after totempg is initialized because "this_ip" must be set diff --git a/exec/mainconfig.c b/exec/mainconfig.c index 43b34b51..82c5631c 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -715,3 +715,35 @@ parse_error: *error_string = error_string_response; return (-1); } + +int corosync_main_config_compatibility_read ( + struct objdb_iface_ver0 *objdb, + enum cs_sync_mode *minimum_sync_mode, + const char **error_string) +{ + const char *error_reason = error_string_response; + char *value; + + *minimum_sync_mode = CS_SYNC_V1; + if (!objdb_get_string (objdb, OBJECT_PARENT_HANDLE, "compatibility", &value)) { + + if (strcmp (value, "whitetank") == 0) { + *minimum_sync_mode = CS_SYNC_V1; + } else + if (strcmp (value, "none") == 0) { + *minimum_sync_mode = CS_SYNC_V2; + } else { + + snprintf (error_string_response, sizeof (error_string_response), + "Invalid compatibility option '%s' specified, must be none or whitetank.\n", value); + goto parse_error; + } + } + + return 0; + +parse_error: + *error_string = error_reason; + + return (-1); +} diff --git a/exec/mainconfig.h b/exec/mainconfig.h index b60f42e2..a1c87a32 100644 --- a/exec/mainconfig.h +++ b/exec/mainconfig.h @@ -38,6 +38,7 @@ #include #include #include +#include /* * All service handlers in the AIS @@ -65,4 +66,9 @@ extern int corosync_main_config_read ( struct objdb_iface_ver0 *objdb, const char **error_string); +extern int corosync_main_config_compatibility_read ( + struct objdb_iface_ver0 *objdb, + enum cs_sync_mode *minimum_sync_mode, + const char **error_string); + #endif /* MAINCONFIG_H_DEFINED */ diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index 5fc1e011..18824056 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -161,6 +161,7 @@ static struct corosync_service_engine quorum_service_handler = { .lib_engine = quorum_lib_service, .exec_init_fn = quorum_exec_init_fn, .lib_engine_count = sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler), + .sync_mode = CS_SYNC_V1 }; static struct lcr_iface corosync_quorum_ver0[1] = { diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index 9a87dd95..0f104156 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -134,6 +134,11 @@ enum cs_flow_control_state { #endif /* COROSYNC_FLOW_CONTROL_STATE */ +enum cs_sync_mode { + CS_SYNC_V1 = 0, + CS_SYNC_V2 = 1 +}; + typedef enum { COROSYNC_FATAL_ERROR_EXIT = -1, COROSYNC_LIBAIS_SOCKET = -6, @@ -623,6 +628,7 @@ struct corosync_service_engine { 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); + enum cs_sync_mode sync_mode; void (*sync_init) (void); int (*sync_process) (void); void (*sync_activate) (void); diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 index c9d66915..6026a9a5 100644 --- a/man/corosync.conf.5 +++ b/man/corosync.conf.5 @@ -43,7 +43,8 @@ corosync.conf - corosync executive configuration file The corosync.conf instructs the corosync executive about various parameters needed to control the corosync executive. The configuration file consists of bracketed top level directives. The possible directive choices are -.IR "totem { } , logging { }. +.IR "totem { } , logging { }. It is also possible to specify the top level +parameter compatibility. These directives are described below. .TP @@ -56,6 +57,18 @@ This top level directive contains configuration options for logging. event { } This top level directive contains configuration options for the event service. +.PP +.PP +The +.B compatibility +directive indicates the level of compatibility requested by the user. The +option whitetank can be specified to remain backward compatable with +openais-0.80.z. The option none can be specified to only be compatable +with corsoync-1.Y.Z. Extra processing during configuration changes is +required to remain backward compatable. + +The default is whitetank. (backwards compatibility) + .PP .PP Within the diff --git a/services/cfg.c b/services/cfg.c index a3ef847f..6c7eff10 100644 --- a/services/cfg.c +++ b/services/cfg.c @@ -280,6 +280,7 @@ struct corosync_service_engine cfg_service_engine = { .exec_engine = cfg_exec_engine, .exec_engine_count = 0, /* sizeof (cfg_aisexec_handler_fns) / sizeof (coroync_exec_handler), */ .confchg_fn = cfg_confchg_fn, + .sync_mode = CS_SYNC_V1 }; /* diff --git a/services/cpg.c b/services/cpg.c index ba53e0b8..46ae68e6 100644 --- a/services/cpg.c +++ b/services/cpg.c @@ -277,6 +277,7 @@ struct corosync_service_engine cpg_service_engine = { .exec_engine = cpg_exec_engine, .exec_engine_count = sizeof (cpg_exec_engine) / sizeof (struct corosync_exec_handler), .confchg_fn = cpg_confchg_fn, + .sync_mode = CS_SYNC_V1, .sync_init = cpg_sync_init, .sync_process = cpg_sync_process, .sync_activate = cpg_sync_activate, diff --git a/services/evs.c b/services/evs.c index 536bbbd0..809813b7 100644 --- a/services/evs.c +++ b/services/evs.c @@ -150,7 +150,8 @@ struct corosync_service_engine evs_service_engine = { .exec_engine_count = sizeof (evs_exec_engine) / sizeof (struct corosync_exec_handler), .confchg_fn = evs_confchg_fn, .exec_init_fn = evs_exec_init_fn, - .exec_dump_fn = NULL + .exec_dump_fn = NULL, + .sync_mode = CS_SYNC_V1 }; static DECLARE_LIST_INIT (confchg_notify); diff --git a/services/pload.c b/services/pload.c index 43d65ca8..cf82bbc3 100644 --- a/services/pload.c +++ b/services/pload.c @@ -160,7 +160,8 @@ struct corosync_service_engine pload_service_engine = { .exec_engine_count = sizeof (pload_exec_engine) / sizeof (struct corosync_exec_handler), .confchg_fn = pload_confchg_fn, .exec_init_fn = pload_exec_init_fn, - .exec_dump_fn = NULL + .exec_dump_fn = NULL, + .sync_mode = CS_SYNC_V2 }; static DECLARE_LIST_INIT (confchg_notify); diff --git a/services/votequorum.c b/services/votequorum.c index 83076575..79855bf5 100644 --- a/services/votequorum.c +++ b/services/votequorum.c @@ -316,6 +316,7 @@ static struct corosync_service_engine quorum_service_handler = { .exec_engine = votequorum_exec_engine, .exec_engine_count = sizeof (votequorum_exec_engine) / sizeof (struct corosync_exec_handler), .confchg_fn = quorum_confchg_fn, + .sync_mode = CS_SYNC_V1 }; /*