From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/manual Makefile manual.c
Date: 20 Jun 2006 18:23:27 -0000 [thread overview]
Message-ID: <20060620182327.21558.qmail@sourceware.org> (raw)
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);
reply other threads:[~2006-06-20 18:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060620182327.21558.qmail@sourceware.org \
--to=teigland@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.