[Openais] Proposed change to default nodeid generation

Andrew Beekhof abeekhof at suse.de
Wed Aug 20 01:10:20 PDT 2008


I'm sure this will be an unpopular patch, however there are good  
reasons for it.

Although OpenAIS uses uint32_t for node ids, both the in-kernel and  
userspace pieces of the DLM use int32_t.
I'm also told that the chances of the kernel pieces changing approach  
zero.

So because the kernel is using signed ints, other pieces of the RedHat  
stack also use signed ints, clusters are unlikely to span the entire  
ipv4 address space (thus making dups unlikely) and that nodeids can be  
manually assigned even if a dup occurs... I propose the following  
patch that converts any negative nodeid back into a positive one.

http://hg.clusterlabs.org/extra/openais/whitetank/raw-rev/b6a7886a3e90

diff -r 70c18fd72ea9 -r b6a7886a3e90 exec/totemnet.c
--- a/exec/totemnet.c	Thu Aug 14 07:31:36 2008 +0200
+++ b/exec/totemnet.c	Mon Aug 18 12:17:10 2008 +0200
@@ -702,7 +702,12 @@ static int netif_determine (
  	 * field is only 32 bits.
  	 */
  	if (bound_to->family == AF_INET && bound_to->nodeid == 0) {
-		memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int));
+		int nodeid = 0;
+		memcpy (&nodeid, bound_to->addr, sizeof (int));
+		if(nodeid < 0) {
+		    nodeid = 0 - nodeid;
+		}
+		bound_to->nodeid = nodeid;
  	}

  	return (res);



More information about the Openais mailing list