[Linux-cluster] better integration between openais and redhat cluster suite (group and dlm)

Steven Dake scd at broked.org
Thu Apr 28 07:36:45 UTC 2005


Dave
find attached some patches to remove the requirement to use both the clm
and evs libraries for cluster/dlm and cluster/group openais
integration.  Instead a function is added to the evs library to
determine the local node identifier.  Give it a spin and let me know
what you think...

I also fixed up a few makefile errors where i couldn't compile the dlm
and group from CVS.

regards
-steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openais-getmemb.patch
Type: text/x-patch
Size: 16932 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20050428/006d8fb8/attachment.bin>
-------------- next part --------------
? group/list.h
? group/daemon/groupd
? group/daemon/list2.h
Index: group/daemon/Makefile.openais
===================================================================
RCS file: /cvs/cluster/cluster/group/daemon/Makefile.openais,v
retrieving revision 1.1
diff -u -r1.1 Makefile.openais
--- group/daemon/Makefile.openais	19 Apr 2005 07:00:42 -0000	1.1
+++ group/daemon/Makefile.openais	28 Apr 2005 07:33:21 -0000
@@ -10,7 +10,7 @@
 ###############################################################################
 ###############################################################################
 
-CFLAGS+= -g -I. -I../../../openais/include/
+CFLAGS+= -g -I../include -I../../../openais/include/
 
 TARGET=groupd
 
@@ -23,8 +23,7 @@
 	update.o \
 	done.o \
 	recover.o \
-	../../../openais/lib/libevs.a \
-	../../../openais/lib/libSaClm.a
+	../../../openais/lib/libevs.a
 	$(CC) $(LDFLAGS) -o $@ $^
 
 main.o: main.c gd_internal.h
Index: group/daemon/openais.c
===================================================================
RCS file: /cvs/cluster/cluster/group/daemon/openais.c,v
retrieving revision 1.1
diff -u -r1.1 openais.c
--- group/daemon/openais.c	19 Apr 2005 07:00:42 -0000	1.1
+++ group/daemon/openais.c	28 Apr 2005 07:33:21 -0000
@@ -38,8 +38,6 @@
 
 #include "gd_internal.h"
 #include "evs.h"
-#include "ais_types.h"
-#include "saClm.h"
 
 extern struct list_head gd_nodes;
 extern int              gd_node_count;
@@ -231,42 +229,14 @@
 	return 0;
 }
 
-/* All this SaClm stuff just to get the local nodeid which isn't
-   available through the evs api. */
-
-void foo(SaInvocationT i, const SaClmClusterNodeT *node, SaAisErrorT error)
-{
-}
-
-void bar (const SaClmClusterNotificationBufferT *b, SaUint32T n, SaAisErrorT e)
-{
-}
-
-SaClmCallbacksT clm_callbacks = {
-	.saClmClusterNodeGetCallback = foo,
-	.saClmClusterTrackCallback = bar
-};
-
 int set_our_nodeid(void)
 {
-	SaVersionT version = { 'B', 1, 1 };
-	SaClmHandleT handle;
-	SaClmClusterNodeT node;
-	int rv;
-
-	rv = saClmInitialize(&handle, &clm_callbacks, &version);
-	if (rv != SA_OK) {
-		log_print("saClmInitialize error %d %d", rv, errno);
-		return rv;
-	}
-
-	rv = saClmClusterNodeGet(handle, SA_CLM_LOCAL_NODE_ID, 0, &node);
-
-	gd_nodeid = (int) node.nodeId;
+	struct in_addr addr;
+	int member_list_entries = 0;
 
-	saClmFinalize(handle);
+	evs_membership_get (eh, &addr, NULL, &member_list_entries);
 
-	log_in("member our nodeid %d rv %d", gd_nodeid, rv);
+	gd_nodeid = addr.s_addr;
 
 	return 0;
 }
-------------- next part --------------
? dlm/daemon/dlm_controld
? dlm/make/defines.mk
Index: dlm/daemon/Makefile.openais
===================================================================
RCS file: /cvs/cluster/cluster/dlm/daemon/Makefile.openais,v
retrieving revision 1.1
diff -u -r1.1 Makefile.openais
--- dlm/daemon/Makefile.openais	18 Apr 2005 10:02:26 -0000	1.1
+++ dlm/daemon/Makefile.openais	28 Apr 2005 07:32:35 -0000
@@ -17,7 +17,7 @@
 
 CFLAGS+= -g -I${incdir} -I${top_srcdir}/config
 
-CFLAGS+= -I../../dlm-kernel/src2/ -I../../../openais/include/
+CFLAGS+= -I../../group/daemon -I../../dlm-kernel/src2/ -I../../../openais/include/
 
 
 TARGET=dlm_controld
Index: dlm/daemon/member_openais.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm/daemon/member_openais.c,v
retrieving revision 1.1
diff -u -r1.1 member_openais.c
--- dlm/daemon/member_openais.c	18 Apr 2005 10:02:26 -0000	1.1
+++ dlm/daemon/member_openais.c	28 Apr 2005 07:32:35 -0000
@@ -20,8 +20,6 @@
 #include <arpa/inet.h>
 
 #include "evs.h"
-#include "ais_types.h"
-#include "saClm.h"
 
 #define MAX_NODES	(256)
 
@@ -120,48 +118,16 @@
         return 0;
 }
 
-/* All this SaClm stuff just to get the local nodeid which isn't
-   available through the evs api. */
-
-void foo(SaInvocationT i, const SaClmClusterNodeT *node, SaAisErrorT error)
-{
-}
-
-void bar (const SaClmClusterNotificationBufferT *b, SaUint32T n, SaAisErrorT e)
-{
-}
-
-SaClmCallbacksT clm_callbacks = {
-        .saClmClusterNodeGetCallback = foo,
-        .saClmClusterTrackCallback = bar
-};
-
 int set_our_nodeid(void)
 {
-        SaVersionT version = { 'B', 1, 1 };
-        SaClmHandleT handle;
-        SaClmClusterNodeT node;
-	struct in_addr a;
-        int rv;
+	struct in_addr addr;
+	int member_list_entries = 0;
 
-        rv = saClmInitialize(&handle, &clm_callbacks, &version);
-        if (rv != SA_OK) {
-                log_error("saClmInitialize error %d %d", rv, errno);
-                return rv;
-        }
+	evs_membership_get (eh, &addr, NULL, &member_list_entries);
 
-        rv = saClmClusterNodeGet(handle, SA_CLM_LOCAL_NODE_ID, 0, &node);
-        if (rv != SA_OK) {
-                log_error("saClmClusterNodeGet error %d %d", rv, errno);
-                return rv;
-        }
+	gd_nodeid = addr.s_addr;
 
-        saClmFinalize(handle);
-
-	a.s_addr = node.nodeId;
-	do_set_local((int) node.nodeId, &a);
-
-        return 0;
+	return 0;
 }
 
 static void dummy(struct in_addr source_addr, void *msg, int len)


More information about the Linux-cluster mailing list