فهرست منبع

Add compatability option in config file. Defaults to whitetank.
Add sync_mode to coroapi to indicate to corosync the service engine's
desired compatibility mode.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2298 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 16 سال پیش
والد
کامیت
f540be9060
12فایلهای تغییر یافته به همراه94 افزوده شده و 4 حذف شده
  1. 2 0
      conf/corosync.conf.example
  2. 26 1
      exec/main.c
  3. 32 0
      exec/mainconfig.c
  4. 6 0
      exec/mainconfig.h
  5. 1 0
      exec/vsf_quorum.c
  6. 6 0
      include/corosync/engine/coroapi.h
  7. 14 1
      man/corosync.conf.5
  8. 1 0
      services/cfg.c
  9. 1 0
      services/cpg.c
  10. 2 1
      services/evs.c
  11. 2 1
      services/pload.c
  12. 1 0
      services/votequorum.c

+ 2 - 0
conf/corosync.conf.example

@@ -1,4 +1,6 @@
 # Please read the corosync.conf.5 manual page
+compatibility: whitetank
+
 totem {
 	version: 2
 	secauth: off

+ 26 - 1
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

+ 32 - 0
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);
+}

+ 6 - 0
exec/mainconfig.h

@@ -38,6 +38,7 @@
 #include <corosync/engine/objdb.h>
 #include <corosync/engine/logsys.h>
 #include <corosync/list.h>
+#include <corosync/engine/coroapi.h>
 
 /*
  * 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 */

+ 1 - 0
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] = {

+ 6 - 0
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);

+ 14 - 1
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

+ 1 - 0
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
 };
 
 /*

+ 1 - 0
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,

+ 2 - 1
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);

+ 2 - 1
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);

+ 1 - 0
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
 };
 
 /*