From 66fd45290c11def3d51ff6eb0165d88a1ce31141 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 28 Aug 2009 20:51:40 +0000 Subject: [PATCH] change clogd to cmirrord make pidfile locn configurable --- WHATS_NEW | 2 +- configure | 50 ++++++++++++++++++++++++++++++--------- configure.in | 28 ++++++++++++++++------ daemons/Makefile.in | 8 +++---- daemons/clogd/Makefile.in | 15 ++++-------- daemons/clogd/clogd.c | 6 ++--- lib/misc/configure.h.in | 3 +++ 7 files changed, 76 insertions(+), 36 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index d57fa7b7e..f527b0e33 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -5,7 +5,7 @@ Version 2.02.52 - Fix pvcreate string termination in duplicate uuid warning message. Fix pvcreate on a partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). - Added configure --enable-clogd to conditionally build the cluster log daemon. + Added configure --enable-cmirrord to build the cluster mirror log daemon. Make lvchange --refresh only take a read lock on volume group. Fix bug where non-blocking file locks could be granted in error. Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. diff --git a/configure b/configure index 8d36b447e..1aa2060b8 100755 --- a/configure +++ b/configure @@ -688,13 +688,13 @@ DEBUG COPTIMISE_FLAG CONFDIR CMDLIB -CLOGD CLVMD CLUSTER CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE CLDFLAGS BUILD_DMEVENTD +BUILD_CMIRRORD APPLIB MODPROBE_CMD MSGFMT @@ -814,7 +814,8 @@ with_mirrors enable_readline enable_realtime with_clvmd -enable_clogd +enable_cmirrord +with_cmirrord_pidfile enable_debug with_optimisation enable_profiling @@ -1502,7 +1503,7 @@ Optional Features: device-mapper is missing from the kernel --disable-readline Disable readline support --disable-realtime Disable realtime clock support - --enable-clogd Enable the cluster log daemon + --enable-cmirrord Enable the cluster mirror log daemon --enable-debug Enable debugging --enable-profiling Gather gcov profiling data --disable-devmapper Disable LVM2 device-mapper interaction @@ -1545,6 +1546,7 @@ Optional Packages: * all (autodetect) * none (disable build) TYPE=none + --with-cmirrord-pidfile=PATH cmirrord pidfile [/var/run/cmirrord.pid] --with-optimisation=OPT C optimisation flag [OPT=-O2] --with-localedir=DIR Translation files in DIR [PREFIX/share/locale] --with-confdir=DIR Configuration files in DIR [/etc] @@ -11653,19 +11655,45 @@ $as_echo "Enabling clvmd openais backend" >&6; } fi ################################################################################ -{ $as_echo "$as_me:$LINENO: checking whether to build cluster log daemon" >&5 -$as_echo_n "checking whether to build cluster log daemon... " >&6; } -# Check whether --enable-clogd was given. -if test "${enable_clogd+set}" = set; then - enableval=$enable_clogd; CLOGD=$enableval +{ $as_echo "$as_me:$LINENO: checking whether to build cluster mirror log daemon" >&5 +$as_echo_n "checking whether to build cluster mirror log daemon... " >&6; } +# Check whether --enable-cmirrord was given. +if test "${enable_cmirrord+set}" = set; then + enableval=$enable_cmirrord; CMIRRORD=$enableval +else + CMIRRORD=no fi -{ $as_echo "$as_me:$LINENO: result: $CLOGD" >&5 -$as_echo "$CLOGD" >&6; } +{ $as_echo "$as_me:$LINENO: result: $CMIRRORD" >&5 +$as_echo "$CMIRRORD" >&6; } + +BUILD_CMIRRORD=$CMIRRORD + +################################################################################ + -if [ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]; then +if test "x$BUILD_CMIRRORD" = xyes; then + +# Check whether --with-cmirrord-pidfile was given. +if test "${with_cmirrord_pidfile+set}" = set; then + withval=$with_cmirrord_pidfile; cat >>confdefs.h <<_ACEOF +#define CMIRRORD_PIDFILE "$withval" +_ACEOF + +else + cat >>confdefs.h <<_ACEOF +#define CMIRRORD_PIDFILE "/var/run/cmirrord.pid" +_ACEOF + +fi + +fi + +################################################################################ +if [ "x$BUILD_CMIRRORD" = xyes ]; then # # FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# FIXME: Merge this with the new clvmd logic # pkg_failed=no diff --git a/configure.in b/configure.in index 651ba6a34..cf74d0713 100644 --- a/configure.in +++ b/configure.in @@ -550,16 +550,30 @@ if test x$CLVMD = xall; then fi ################################################################################ -dnl -- Build cluster log daemon -AC_MSG_CHECKING(whether to build cluster log daemon) -AC_ARG_ENABLE(clogd, [ --enable-clogd Enable the cluster log daemon], -CLOGD=$enableval) -AC_MSG_RESULT($CLOGD) +dnl -- Build cluster mirror log daemon +AC_MSG_CHECKING(whether to build cluster mirror log daemon) +AC_ARG_ENABLE(cmirrord, [ --enable-cmirrord Enable the cluster mirror log daemon], +CMIRRORD=$enableval, CMIRRORD=no) +AC_MSG_RESULT($CMIRRORD) +BUILD_CMIRRORD=$CMIRRORD + +################################################################################ +dnl -- cmirrord pidfile +AH_TEMPLATE(CMIRRORD_PIDFILE, [Path to cmirrord pidfile.]) +if test "x$BUILD_CMIRRORD" = xyes; then + AC_ARG_WITH(cmirrord-pidfile, + [ --with-cmirrord-pidfile=PATH cmirrord pidfile [[/var/run/cmirrord.pid]] ], + [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"$withval") ], + [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"/var/run/cmirrord.pid") ]) +fi + +################################################################################ dnl -- Look for corosync libraries if required. -if [[ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]]; then +if [[ "x$BUILD_CMIRRORD" = xyes ]]; then # # FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# FIXME: Merge this with the new clvmd logic # PKG_CHECK_MODULES(CPG, libcpg, [], [AC_MSG_RESULT([no pkg for libcpg library, using -lcpg]); @@ -1007,6 +1021,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[[()]]' '{print $2}'` ################################################################################ AC_SUBST(APPLIB) +AC_SUBST(BUILD_CMIRRORD) AC_SUBST(BUILD_DMEVENTD) AC_SUBST(CCS_CFLAGS) AC_SUBST(CCS_LIBS) @@ -1017,7 +1032,6 @@ AC_SUBST(CLDNOWHOLEARCHIVE) AC_SUBST(CLDWHOLEARCHIVE) AC_SUBST(CLUSTER) AC_SUBST(CLVMD) -AC_SUBST(CLOGD) AC_SUBST(CMAN_CFLAGS) AC_SUBST(CMAN_LIBS) AC_SUBST(CMDLIB) diff --git a/daemons/Makefile.in b/daemons/Makefile.in index 4d8d36b49..bcbbfd397 100644 --- a/daemons/Makefile.in +++ b/daemons/Makefile.in @@ -21,16 +21,16 @@ ifneq ("@CLVMD@", "none") SUBDIRS = clvmd endif -ifeq ("@CLOGD@", "yes") - SUBDIRS += clogd +ifeq ("@BUILD_CMIRRORD@", "yes") + SUBDIRS += cmirrord endif -ifeq ("@DMEVENTD@", "yes") +ifeq ("@BUILD_DMEVENTD@", "yes") SUBDIRS += dmeventd endif include $(top_srcdir)/make.tmpl -ifeq ("@DMEVENTD@", "yes") +ifeq ("@BUILD_DMEVENTD@", "yes") device-mapper: dmeventd.device-mapper endif diff --git a/daemons/clogd/Makefile.in b/daemons/clogd/Makefile.in index be4c92363..ce13d0241 100644 --- a/daemons/clogd/Makefile.in +++ b/daemons/clogd/Makefile.in @@ -17,22 +17,17 @@ VPATH = @srcdir@ SOURCES = clogd.c cluster.c functions.c link_mon.c local.c logging.c -ifeq ("@DEBUG@", "yes") - DEFS += -DDEBUG -endif - -TARGETS = clogd +TARGETS = cmirrord include $(top_srcdir)/make.tmpl LDFLAGS += -L$(usrlibdir)/openais LIBS += -lcpg -lSaCkpt -ldevmapper -clogd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a - echo $(LIBS) - $(CC) -o clogd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ +cmirrord: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a + $(CC) -o cmirrord $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ $(LVMLIBS) $(LMLIBS) $(LIBS) install: $(TARGETS) - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clogd \ - $(usrsbindir)/clogd + $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) cmirrord \ + $(usrsbindir)/cmirrord diff --git a/daemons/clogd/clogd.c b/daemons/clogd/clogd.c index 6a32ed84a..bfb74fadc 100644 --- a/daemons/clogd/clogd.c +++ b/daemons/clogd/clogd.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) /* Parent can now exit, we're ready to handle requests */ kill(getppid(), SIGTERM); - LOG_PRINT("Starting clogd:"); + LOG_PRINT("Starting cmirrord:"); LOG_PRINT(" Built: "__DATE__" "__TIME__"\n"); LOG_DBG(" Compiled with debugging."); @@ -233,9 +233,9 @@ static void daemonize(void) open("/dev/null", O_WRONLY); /* reopen stdout */ open("/dev/null", O_WRONLY); /* reopen stderr */ - LOG_OPEN("clogd", LOG_PID, LOG_DAEMON); + LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON); - if (create_lockfile("/var/run/clogd.pid")) + if (create_lockfile(CMIRRORD_PIDFILE)) exit(EXIT_LOCKFILE); signal(SIGINT, &sig_handler); diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in index 955e32ca5..cd7858a68 100644 --- a/lib/misc/configure.h.in +++ b/lib/misc/configure.h.in @@ -6,6 +6,9 @@ /* Define to 1 to include built-in support for clustered LVM locking. */ #undef CLUSTER_LOCKING_INTERNAL +/* Path to cmirrord pidfile. */ +#undef CMIRRORD_PIDFILE + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ -- 2.43.5