[pve-devel] [PATCH v3 pve-cluster 1/4] prefer 'name' subkey over 'ring0_addr' for nodename

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 9 18:49:36 CEST 2015


Use the name subkey from the cmap keys by default, if not set
fallback to the ring0_addr.
This fixes some issues when we move the corosync communication to
a different network and use an specific address or an new hostname
for that. Withouth this patch the nodename in the .members special
file changes together with ring0_addr, which can result in quite a
few problems (e.g.: in the ha-manager).
This allows also to separate the webinterface traffic from corosync.
IP adresses can be used for ring0 addresses directly now also,
without making problems.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/src/confdb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/data/src/confdb.c b/data/src/confdb.c
index 6659e5e..813283d 100644
--- a/data/src/confdb.c
+++ b/data/src/confdb.c
@@ -97,6 +97,15 @@ cmap_read_clusternodes(
 				cfs_critical("cmap_get %s failed %d", key_name, result);
 			}
 		} else if (strcmp(subkey, "ring0_addr") == 0) {
+			// prefering the 'name' subkey over 'ring0_addr', needed for RRP
+			// and when using a IP address for ring0_addr
+			if (name == NULL &&
+			    (result = cmap_get_string(handle, key_name, &name)) != CS_OK) {
+				cfs_critical("cmap_get %s failed %d", key_name, result);
+			}
+		} else if (strcmp(subkey, "name") == 0) {
+			free(name);
+			name = NULL;
 			if ((result = cmap_get_string(handle, key_name, &name)) != CS_OK) {
 				cfs_critical("cmap_get %s failed %d", key_name, result);
 			}
-- 
2.1.4





More information about the pve-devel mailing list