The user may specify "whitetank" or "none" for compatibility.  The
default is whitetank.

Index: vsf_quorum.c
===================================================================
--- vsf_quorum.c	(revision 2293)
+++ vsf_quorum.c	(working copy)
@@ -161,6 +161,7 @@
 	.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] = {
Index: mainconfig.c
===================================================================
--- mainconfig.c	(revision 2293)
+++ mainconfig.c	(working copy)
@@ -715,3 +715,35 @@
 	*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);
+}
Index: mainconfig.h
===================================================================
--- mainconfig.h	(revision 2293)
+++ mainconfig.h	(working copy)
@@ -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 @@
 	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 */
Index: main.c
===================================================================
--- main.c	(revision 2293)
+++ main.c	(working copy)
@@ -118,6 +118,8 @@
 
 static struct corosync_api_v1 *api = NULL;
 
+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;
@@ -836,7 +838,6 @@
 		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);
@@ -872,6 +873,14 @@
 	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);
+	}
+
 	/*
 	 * Sleep for a while to let other nodes in the cluster
 	 * understand that this node has been away (if it was
@@ -914,6 +923,12 @@
 		corosync_exit_error (AIS_DONE_INIT_SERVICES);
 	}
 
+	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");
+	}
 
 	sync_register (corosync_sync_callbacks_retrieve, corosync_sync_completed);
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to