public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: RHEL5 - rgmanager: Implement wait-for-fence behavior Date: Thu, 28 Aug 2008 19:36:00 -0000 [thread overview] Message-ID: <20080828181250.66440120379@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=b856823dbc6310e3c4742bf986bf2fa991cdc334 Commit: b856823dbc6310e3c4742bf986bf2fa991cdc334 Parent: 288ee1d7d73d6d4b08dc2ae0d0fb66f70d23f2fd Author: Lon Hohberger <lhh@redhat.com> AuthorDate: Thu Aug 28 14:12:26 2008 -0400 Committer: Lon Hohberger <lhh@redhat.com> CommitterDate: Thu Aug 28 14:12:38 2008 -0400 rgmanager: Implement wait-for-fence behavior Changes to group/lib/Makefile are needed to make libgroup.so a shared object so as to not cause rgmanager to depend on a particular release of cman. Changes to group/lib/Makefile mirror what cman/lib/Makefile does to create shared libraries This change implements a wait to ensure fencing has completed prior to services in rgmanager being allowed to start. This is rhbz #459754 --- group/lib/Makefile | 17 ++++++++++++++--- rgmanager/src/daemons/Makefile | 6 +++--- rgmanager/src/daemons/main.c | 25 ++++++++++++++++++++++++- rgmanager/src/daemons/rg_event.c | 21 +++++++++++++++++++++ 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/group/lib/Makefile b/group/lib/Makefile index fb86073..733109a 100644 --- a/group/lib/Makefile +++ b/group/lib/Makefile @@ -13,25 +13,36 @@ SOURCE=libgroup.c LIBNAME=libgroup +SHAREDLIB=$(LIBNAME).so.${RELEASE_MAJOR}.${RELEASE_MINOR} STATICLIB=$(LIBNAME).a top_srcdir=.. UNINSTALL=${top_srcdir}/scripts/uninstall.pl -# include ${top_srcdir}/make/defines.mk +include ${top_srcdir}/make/defines.mk CFLAGS += -g -O -I. -fPIC -I../daemon -all: $(STATICLIB) +all: $(STATICLIB) $(SHAREDLIB) $(LIBNAME).a: libgroup.o ${AR} r libgroup.a libgroup.o -# ${RANLIB} libgroup.a + ${RANLIB} libgroup.a + +$(LIBNAME).so.${RELEASE_MAJOR}.${RELEASE_MINOR}: libgroup.o + $(CC) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(RELEASE_MAJOR) $^ libgroup.o: libgroup.c $(CC) $(CFLAGS) -c -o $@ $< -I../daemon install: all + install -d ${incdir} + install libgroup.h ${incdir} + install -d ${libdir} + install $(LIBNAME).a ${libdir} + install $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir} + ln -sf $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME).so + ln -sf $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME).so.$(RELEASE_MAJOR) uninstall: diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile index 5812fe6..b743de7 100644 --- a/rgmanager/src/daemons/Makefile +++ b/rgmanager/src/daemons/Makefile @@ -14,12 +14,12 @@ top_srcdir=../.. UNINSTALL=${top_srcdir}/scripts/uninstall.pl include ${top_srcdir}/make/defines.mk -INCLUDE += -I $(top_srcdir)/include -I $(top_srcdir)/../cman/lib -I $(top_srcdir)/../ccs/lib -I $(top_srcdir)/../dlm/lib +INCLUDE += -I $(top_srcdir)/include -I $(top_srcdir)/../cman/lib -I $(top_srcdir)/../ccs/lib -I $(top_srcdir)/../dlm/lib -I $(top_srcdir)/../group/lib INCLUDE += -I${incdir} -I/usr/include/libxml2 -I/usr/include/slang CFLAGS+= -g -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE -DWRAP_THREADS -Wall -Wextra -LDFLAGS+= -L ../clulib -L../../../cman/lib -L../../../ccs/lib -L../../../dlm/lib -L${libdir} -lclulib -lxml2 -lpthread -ldl -Wl,-wrap,pthread_create,-wrap,pthread_exit -rdynamic +LDFLAGS+= -L ../clulib -L../../../cman/lib -L../../../ccs/lib -L../../../dlm/lib -L../../../group/lib -L${libdir} -lclulib -lxml2 -lpthread -ldl -Wl,-wrap,pthread_create,-wrap,pthread_exit TARGETS=clurgmgrd clurmtabd rg_test all: ${TARGETS} @@ -41,7 +41,7 @@ clurgmgrd: rg_thread.o rg_locks.o main.o groups.o \ rg_event.o watchdog.o rg_state.o event_config.o \ slang_event.o service_op.o restart_counter.o \ ../clulib/libclulib.a - $(CC) -o $@ $^ $(INCLUDE) $(CFLAGS) $(LDFLAGS) -lccs -lcman -lpthread -ldlm -lslang + $(CC) -o $@ $^ $(INCLUDE) $(CFLAGS) $(LDFLAGS) -lccs -lcman -lgroup -lpthread -ldlm -lslang rg_script_test: slang_event.o $(CC) -o rg_script_test slang_event.o $(INCLUDE) $(CFLAGS) -lslang $(LDFLAGS) diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c index 8401bca..b722ab2 100644 --- a/rgmanager/src/daemons/main.c +++ b/rgmanager/src/daemons/main.c @@ -60,6 +60,9 @@ int svc_exists(char *); int watchdog_init(void); int32_t master_event_callback(char *key, uint64_t viewno, void *data, uint32_t datalen); +int node_has_fencing(int nodeid); +int fence_domain_joined(void); + int shutdown_pending = 0, running = 1, need_reconfigure = 0; char debug = 0; /* XXX* */ static int signalled = 0; @@ -909,7 +912,25 @@ clu_initialize(cman_handle_t *ch) while (cman_is_quorate(*ch) == 0) { sleep(1); } - clulog(LOG_NOTICE, "Quorum formed, starting\n"); + clulog(LOG_NOTICE, "Quorum formed\n"); + } + +} + + +void +wait_for_fencing(void) +{ + if (node_has_fencing(my_id()) && !fence_domain_joined()) { + clulog(LOG_INFO, "Waiting for fence domain join operation " + "to complete\n"); + + while (fence_domain_joined() == 0) + sleep(1); + clulog(LOG_INFO, "Fence domain joined\n"); + } else { + clulog(LOG_DEBUG, "Fence domain already joined " + "or no fencing configured\n"); } } @@ -1018,6 +1039,8 @@ main(int argc, char **argv) clulog(LOG_INFO, "I am node #%d\n", my_id()); + wait_for_fencing(); + /* We know we're quorate. At this point, we need to read the resource group trees from ccsd. diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c index f614668..f8fcc1e 100644 --- a/rgmanager/src/daemons/rg_event.c +++ b/rgmanager/src/daemons/rg_event.c @@ -27,6 +27,7 @@ #include <stdint.h> #include <vf.h> #include <members.h> +#include <libgroup.h> /** @@ -174,6 +175,26 @@ node_has_fencing(int nodeid) } +/* Shameless cut-and-paste from gfs_controld */ +int +fence_domain_joined(void) +{ + group_data_t data; + int rv; + + memset(&data, 0, sizeof(data)); + + rv = group_get_group(0, "default", &data); + + if (rv || strcmp(data.client_name, "fence")) + return 0; + + if (data.member == 1) + return 1; + return 0; +} + + /** Quick query to cman to see if a node has been fenced. */
reply other threads:[~2008-08-28 18:14 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=20080828181250.66440120379@lists.fedorahosted.org \ --to=lon@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).