From 81410c8f097d568c732d90e07284218ac297fe8d Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 19 Jan 2010 02:04:33 +0000 Subject: [PATCH] And more fixes for cmirror build. --- configure | 3 +- configure.in | 1 + man/Makefile.in | 11 ++++- man/cmirrord.8.in | 5 ++ scripts/Makefile.in | 2 +- scripts/cmirrord_init_red_hat.in | 83 +++++++++++++++++--------------- 6 files changed, 63 insertions(+), 42 deletions(-) create mode 100644 man/cmirrord.8.in diff --git a/configure b/configure index 85d073091..af36ab81b 100755 --- a/configure +++ b/configure @@ -15531,7 +15531,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'` ################################################################################ -ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/lvm2_monitoring_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile" +ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_monitoring_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -16157,6 +16157,7 @@ do "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "po/Makefile") CONFIG_FILES="$CONFIG_FILES po/Makefile" ;; "scripts/clvmd_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/clvmd_init_red_hat" ;; + "scripts/cmirrord_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/cmirrord_init_red_hat" ;; "scripts/lvm2_monitoring_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_init_red_hat" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; diff --git a/configure.in b/configure.in index 68edb5f4e..bf74e5798 100644 --- a/configure.in +++ b/configure.in @@ -1175,6 +1175,7 @@ liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat +scripts/cmirrord_init_red_hat scripts/lvm2_monitoring_init_red_hat scripts/Makefile test/Makefile diff --git a/man/Makefile.in b/man/Makefile.in index 0b96e230d..dfe95e6e0 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -32,7 +32,16 @@ MAN8=lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.8 \ vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \ vgimport.8 vgimportclone.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 \ vgrename.8 vgs.8 vgscan.8 vgsplit.8 $(FSADMMAN) -MAN8CLUSTER=clvmd.8 cmirrord.8 + +ifneq ("@CLVMD@", "none") + MAN8CLUSTER=clvmd.8 +else + MAN8CLUSTER= +endif +ifeq ("@BUILD_CMIRRORD@", "yes") + MAN8CLUSTER+=cmirrord.8 +endif + MAN8DM=dmsetup.8 MAN5DIR=${mandir}/man5 MAN8DIR=${mandir}/man8 diff --git a/man/cmirrord.8.in b/man/cmirrord.8.in new file mode 100644 index 000000000..b5818aa49 --- /dev/null +++ b/man/cmirrord.8.in @@ -0,0 +1,5 @@ +.TH CMIRRORD 8 "LVM TOOLS #VERSION#" "Red Hat Inc" \" -*- nroff -*- +.SH NAME +cmirrord +.SH SYNOPSIS +.B cmirrord diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 33a10c172..867f0ee7d 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -30,4 +30,4 @@ endif install_lvm2: install -DISTCLEAN_TARGETS += clvmd_init_red_hat lvm2_monitoring_init_red_hat +DISTCLEAN_TARGETS += clvmd_init_red_hat cmirrord_init_red_hat lvm2_monitoring_init_red_hat diff --git a/scripts/cmirrord_init_red_hat.in b/scripts/cmirrord_init_red_hat.in index c367f53e5..997495a74 100755 --- a/scripts/cmirrord_init_red_hat.in +++ b/scripts/cmirrord_init_red_hat.in @@ -1,71 +1,71 @@ #!/bin/bash # # chkconfig: - 22 78 -# description: Loads/Unloads dm-log-clustered module +# description: Starts and stops cmirrord # +# For Red-Hat-based distributions such as Fedora, RHEL, CentOS. # ### BEGIN INIT INFO # Provides: cmirrord -# Required-Start: $network $time -# Required-Stop: $network $time +# Required-Start: $network $time $local_fs +# Required-Stop: $network $time $local_fs # Short-Description: Starts and stops cmirrord -# Description: Starts and stops the cluster mirror log daemon +# Description: Starts and stops the cluster mirror log daemon ### END INIT INFO . /etc/init.d/functions -# set secure PATH -PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin" +DAEMON=cmirrord + +LOCK_FILE="/var/lock/subsys/$DAEMON" start() { - echo -n "Starting clustered mirror log server:" - ps -C cmirrord >& /dev/null || cmirrord >& /dev/null + if ! pidof $DAEMON > /dev/null + then + echo -n "Starting $DAEMON: " + daemon $DAEMON $CLVMDOPTS + rtrn=$? + echo + if [ $rtrn -ne 0 ] + then + break + fi + fi + return $rtrn +} + +stop() +{ + echo -n "Stopping $DAEMON:" + killproc $DAEMON -TERM rtrn=$? - if [ $rtrn -eq 0 ]; then - success "startup" - else - failure "startup" - fi - # need the extra echo to properly terminate the line - echo return $rtrn } -stop() +wait_for_finish() { - echo -n "Stopping clustered mirror log server:" - killall cmirrord >& /dev/null - for ((i=0; $i < 10; i++)); do - if ! ps -C cmirrord >& /dev/null; then - break; - fi + count=0 + + while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ] + do sleep 1 + count=$((count + 1)) done - - if [ $i -ge 10 ]; then - failure "shutdown" - echo + + if [ `pidof $DAEMON` ] + then return 1 else - success "shutdown" + return 0 fi - - echo - return $rtrn } cmirror_status() { - ps -C cmirrord >& /dev/null - if [ $? -ne 0 ]; then - echo "Cluster log server is not running. (Cluster mirrors will not work.)" - return 1 - fi - - return 0 + status $DAEMON } rtrn=1 @@ -75,16 +75,21 @@ case "$1" in start) start rtrn=$? + [ $rtrn = 0 ] && touch $LOCK_FILE ;; stop) stop rtrn=$? + [ $rtrn = 0 ] && rm -f $LOCK_FILE ;; restart) - $0 stop - $0 start + if stop + then + wait_for_finish + start + fi rtrn=$? ;; -- 2.43.5