* [Cluster-devel] cluster/fence/agents/manual Makefile manual.c
@ 2006-06-20 18:23 teigland
0 siblings, 0 replies; only message in thread
From: teigland @ 2006-06-20 18:23 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-06-20 18:23:25
Modified files:
fence/agents/manual: Makefile manual.c
Log message:
don't skip fencing a node unless it's both a cman member and has
fully started groupd
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/manual/Makefile.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/manual/manual.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
--- cluster/fence/agents/manual/Makefile 2005/05/25 08:18:17 1.5
+++ cluster/fence/agents/manual/Makefile 2006/06/20 18:23:25 1.6
@@ -13,13 +13,10 @@
TARGET= fence_manual fence_ack_manual
-fence_manual_SOURCE= manual.c
-fence_ack_manual_SOURCE= ack.c
-
top_srcdir=../..
-INCLUDE= -I${top_srcdir}/include -I${top_srcdir}/config -I${incdir} -I../../../cman/lib
+INCLUDE= -I${top_srcdir}/include -I${top_srcdir}/config -I${incdir} -I../../../cman/lib -I../../../group/lib
include ${top_srcdir}/make/defines.mk
@@ -27,15 +24,20 @@
CFLAGS+= -DFENCE_RELEASE_NAME=\"${RELEASE}\"
LDFLAGS+= -L../../../cman/lib
-LDLIBS+= -lcman
all: ${TARGET}
-fence_manual: ${fence_manual_SOURCE:.c=.o}
- ${CC} ${CFLAGS} ${LDFLAGS} ${fence_manual_SOURCE:.c=.o} ${LOADLIBES} ${LDLIBS} -o $@
+fence_manual: manual.o ../../../group/lib/libgroup.a
+ $(CC) $(LDFLAGS) -o $@ $^ -lcman
+
+manual.o: manual.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+fence_ack_manual: ack.o
+ ${CC} -o $@ $^
-fence_ack_manual: ${fence_ack_manual_SOURCE:.c=.o}
- ${CC} ${CFLAGS} ${LDFLAGS} ${fence_ack_manual_SOURCE:.c=.o} ${LOADLIBES} ${LDLIBS} -o $@
+ack.o: ack.c
+ $(CC) $(CFLAGS) -c -o $@ $<
copytobin: all
cp ${TARGET} ${top_srcdir}/bin
--- cluster/fence/agents/manual/manual.c 2005/05/25 08:18:18 1.6
+++ cluster/fence/agents/manual/manual.c 2006/06/20 18:23:25 1.7
@@ -28,6 +28,7 @@
#include "copyright.cf"
#include "libcman.h"
+#include "libgroup.h"
/* FIFO_DIR needs to agree with the same in manual/ack.c */
@@ -46,6 +47,8 @@
char agent[256];
char victim[256];
+int victim_nodeid;
+
cman_node_t nodes[MAX_NODES];
char *prog_name;
@@ -239,7 +242,7 @@
return 1;
}
-int check_cluster(void)
+int check_cman(void)
{
cman_handle_t ch;
int i, error, rv = 0, count = 0;
@@ -258,8 +261,10 @@
if (strlen(nodes[i].cn_name) == strlen(victim) &&
!strncmp(nodes[i].cn_name, victim, strlen(victim))) {
- if (nodes[i].cn_member)
+ if (nodes[i].cn_member) {
rv = 1;
+ victim_nodeid = nodes[i].cn_nodeid;
+ }
break;
}
}
@@ -268,6 +273,30 @@
return rv;
}
+int check_groupd(void)
+{
+ group_data_t data;
+ int i, rv;
+
+ memset(&data, 0, sizeof(data));
+
+ rv = group_get_group(-1, "groupd", &data);
+ if (rv)
+ return 0;
+
+ for (i = 0; i < data.member_count; i++) {
+ if (data.members[i] == victim_nodeid)
+ return 1;
+ }
+
+ return 0;
+}
+
+int check_cluster(void)
+{
+ return check_cman() && check_groupd();
+}
+
void cleanup(void)
{
memset(fname, 0, 256);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-06-20 18:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-20 18:23 [Cluster-devel] cluster/fence/agents/manual Makefile manual.c teigland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).