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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 7 13:34:57 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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/data/src/confdb.c b/data/src/confdb.c
index 6659e5e..ec02f08 100644
--- a/data/src/confdb.c
+++ b/data/src/confdb.c
@@ -97,6 +97,13 @@ cmap_read_clusternodes(
 				cfs_critical("cmap_get %s failed %d", key_name, result);
 			}
 		} else if (strcmp(subkey, "ring0_addr") == 0) {
+			// prefer the 'name' subkey over 'ring0_addr', allows ring0_addr
+			// to be IP addresses without changing the nodename
+			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) {
 			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