This simple patch allows multiple config modules to be specified. Simply
add them to the OPENAIS_DEFAULT_CONFIG_IFACE environment variable
separated by colons.
Index: trunk/exec/main.c
===================================================================
--- trunk/exec/main.c	(revision 1489)
+++ trunk/exec/main.c	(working copy)
@@ -439,6 +439,7 @@
 	struct config_iface_ver0 *config;
 	void *config_p;
 	char *config_iface;
+	char *iface;
 	int res, ch;
 	int background, setprio;
  	int totem_log_service;
@@ -512,25 +514,36 @@
 		config_iface = "aisparser";
 	}
 
-	res = lcr_ifact_reference (
-		&config_handle,
-		config_iface,
-		config_version,
-		&config_p,
-		0);
+	/* Make a copy so we can deface it with strtok */
+	config_iface = strdup(config_iface);
 
-	config = (struct config_iface_ver0 *)config_p;
-	if (res == -1) {
-		log_printf (LOG_LEVEL_ERROR, "AIS Executive couldn't open configuration component.\n");
-		openais_exit_error (AIS_DONE_MAINCONFIGREAD);
-	}
+	iface = strtok(config_iface, ":");
+	while (iface)
+	{
+		res = lcr_ifact_reference (
+			&config_handle,
+			iface,
+			config_version,
+			&config_p,
+			0);
 
-	res = config->config_readconfig(objdb, &error_string);
-	if (res == -1) {
-		log_printf (LOG_LEVEL_ERROR, error_string);
-		openais_exit_error (AIS_DONE_MAINCONFIGREAD);
+		config = (struct config_iface_ver0 *)config_p;
+		if (res == -1) {
+			log_printf (LOG_LEVEL_ERROR, "AIS Executive couldn't open configuration component '%s'\n", iface);
+			openais_exit_error (AIS_DONE_MAINCONFIGREAD);
+		}
+
+		res = config->config_readconfig(objdb, &error_string);
+		if (res == -1) {
+			log_printf (LOG_LEVEL_ERROR, error_string);
+			openais_exit_error (AIS_DONE_MAINCONFIGREAD);
+		}
+		log_printf (LOG_LEVEL_NOTICE, error_string);
+
+		iface = strtok(NULL, ":");
 	}
-	log_printf (LOG_LEVEL_NOTICE, error_string);
+	if (config_iface)
+		free(config_iface);
 
 	openais_service_default_objdb_set (objdb);
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to