File 0001-totemconfig.c-Fixed-Evicted-from-CPG-membership.patch of Package corosync.6022

From 622a4a629346f3b52ecac140ab99fb3023dca8f9 Mon Sep 17 00:00:00 2001
From: Bin Liu <bliu@suse.com>
Date: Tue, 11 Apr 2017 16:57:55 +0800
Subject: [PATCH] totemconfig.c: Fixed Evicted from CPG membership

---
 exec/main.c        |  4 ++++
 exec/totemconfig.c | 13 ++++++++++++-
 exec/totemconfig.h |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/exec/main.c b/exec/main.c
index 0ca5634a..f09b73cf 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1261,6 +1261,10 @@ int main (int argc, char **argv, char **envp)
 	if (totem_config_warnings & TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED) {
 		log_printf (LOGSYS_LEVEL_WARNING, "nodeid appears both in totem section and nodelist. Nodelist one is used.");
 	}
+    if (totem_config_warnings & TOTEM_CONFIG_BINDNETADDR_NODELIST_SET) {
+        log_printf (LOGSYS_LEVEL_WARNING, "%s", "interface section bindnetaddr is used together with nodelist. "
+                    "Nodelist one is going to be used.");
+    }
 
 	if (totem_config_warnings != 0) {
 		log_printf (LOGSYS_LEVEL_WARNING, "Please migrate config file to nodelist.");
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index f232ea8f..305a7fe4 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -975,7 +975,7 @@ extern int totem_config_read (
 	uint64_t *warnings)
 {
 	int res = 0;
-	char *str;
+	char *str, *ring0_addr_str;
 	unsigned int ringnumber = 0;
 	int member_count = 0;
 	icmap_iter_t iter, member_iter;
@@ -1048,6 +1048,17 @@ extern int totem_config_read (
 		 */
 		config_convert_nodelist_to_interface(totem_config);
 	} else {
+        if (icmap_get_string("nodelist.node.0.ring0_addr", &ring0_addr_str) == CS_OK) {
+            /*
+             * Both bindnetaddr and ring0_addr are set.
+             * Log warning information, and use nodelist instead
+             */
+            *warnings |= TOTEM_CONFIG_BINDNETADDR_NODELIST_SET;
+
+            config_convert_nodelist_to_interface(totem_config);
+
+            free(ring0_addr_str);
+        }
 		free(str);
 	}
 
diff --git a/exec/totemconfig.h b/exec/totemconfig.h
index 10607cc2..368ecabf 100644
--- a/exec/totemconfig.h
+++ b/exec/totemconfig.h
@@ -46,6 +46,7 @@
 #define TOTEM_CONFIG_WARNING_MEMBERS_IGNORED		(1<<1)
 #define TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED		(1<<2)
 #define TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED	(1<<3)
+#define TOTEM_CONFIG_BINDNETADDR_NODELIST_SET (1<<4)
 
 extern int totem_config_read (
 	struct totem_config *totem_config,
-- 
2.12.0

openSUSE Build Service is sponsored by