[pve-devel] [RFC pve-cluster] Prefer name key from corosync config for nodename

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 5 16:58:12 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.

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

diff --git a/data/src/confdb.c b/data/src/confdb.c
index 6659e5e..61c885a 100644
--- a/data/src/confdb.c
+++ b/data/src/confdb.c
@@ -97,6 +97,12 @@ 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'
+			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