]> sourceware.org Git - lvm2.git/commitdiff
Update lvm2_monitoring script.
authorAlasdair Kergon <agk@redhat.com>
Wed, 16 Sep 2009 23:22:40 +0000 (23:22 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 16 Sep 2009 23:22:40 +0000 (23:22 +0000)
WHATS_NEW
configure
configure.in
scripts/Makefile.in
scripts/lvm2_monitoring_init_red_hat.in [new file with mode: 0644]

index a9ae54648cf023948c9c77d82673b885eeba2eee..0255658e090e8cb6a9c6f7fa18a8733223b84326 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.53 - 
 =====================================
+  Update lvm2 monitoring script to lvm2_monitoring_init_red_hat.in.
   Fix lvm2app test to run under test/api subdirectory only when configured.
   Add vg_is_resizeable() and cleanup reference to VG_RESIZEABLE.
 
index b215b4941fb0ab586f2edc0d6ffee8377973ec66..970a1035636ccbb70bdfa8cd1a163da23bbd2642 100755 (executable)
--- a/configure
+++ b/configure
@@ -15404,7 +15404,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/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/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/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"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -16029,6 +16029,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/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" ;;
     "test/api/Makefile") CONFIG_FILES="$CONFIG_FILES test/api/Makefile" ;;
index e22f0db89d4fa7a870ec380b030a4cb89fa5e312..8a63e73651552b131093f049bfd319097db63127 100644 (file)
@@ -1159,6 +1159,7 @@ 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
index e845cca951d3c83e29e8001d0c2d7dae8e4e6b55..1b5cc66ab4e8d62ee8554c03cc306ae7d8b665a6 100644 (file)
@@ -29,4 +29,4 @@ endif
 
 install_lvm2: install
 
-DISTCLEAN_TARGETS += clvmd_init_red_hat
+DISTCLEAN_TARGETS += clvmd_init_red_hat lvm2_monitoring_init_red_hat
diff --git a/scripts/lvm2_monitoring_init_red_hat.in b/scripts/lvm2_monitoring_init_red_hat.in
new file mode 100644 (file)
index 0000000..18beae6
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/bash
+#
+# Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# This file is part of LVM2.
+# It is required for the proper handling of failures of LVM2 mirror
+# devices that were created using the -m option of lvcreate.
+#
+#
+# chkconfig: 12345 02 99
+# description: Starts and stops dmeventd monitoring for lvm2
+#
+# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
+#             
+### BEGIN INIT INFO
+# Provides: lvm2-monitoring
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 1 2 3 4 5
+# Default-Stop: 0 6
+# Short-Description: Monitoring of LVM2 mirrors, snapshots etc. using dmeventd
+### END INIT INFO
+
+. /etc/init.d/functions
+
+DAEMON=lvm2_monitoring
+
+exec_prefix=@exec_prefix@
+sbindir=@sbindir@
+
+VGCHANGE=${sbindir}/vgchange
+VGS=${sbindir}/vgs
+
+LOCK_FILE="/var/lock/subsys/$DAEMON"
+
+WARN=1
+
+start()
+{
+       ret=0
+       # TODO do we want to separate out already active groups only?
+       VGSLIST=`$VGS --noheadings -o name 2> /dev/null`
+       for vg in $VGSLIST
+       do
+           action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg || ret=$?
+       done
+
+       return $ret
+}
+
+
+stop()
+{
+       ret=0
+       # TODO do we want to separate out already active groups only?
+       if test "$WARN" = "1"; then
+          echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
+          return 1
+       fi
+       VGSLIST=`$VGS --noheadings -o name 2> /dev/null`
+       for vg in $VGSLIST
+       do
+           action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg || ret=$?
+       done
+       return $ret
+}
+
+rtrn=1
+
+# See how we were called.
+case "$1" in
+  start)
+       start
+       rtrn=$?
+       [ $rtrn = 0 ] && touch $LOCK_FILE
+       ;;
+
+  force-stop)
+       WARN=0
+       stop
+       rtrn=$?
+       [ $rtrn = 0 ] && rm -f $LOCK_FILE
+       ;;
+
+  stop)
+       test "$runlevel" = "0" && WARN=0
+       test "$runlevel" = "6" && WARN=0
+       stop
+       rtrn=$?
+       [ $rtrn = 0 ] && rm -f $LOCK_FILE
+       ;;
+
+  restart)
+       WARN=0
+       if stop
+       then
+               start
+       fi 
+       rtrn=$?
+       ;;
+
+  status)
+       # TODO anyone with an idea how to dump monitored volumes?
+       ;;
+
+  *)
+       echo $"Usage: $0 {start|stop|restart|status|force-stop}"
+       ;;
+esac
+
+exit $rtrn
This page took 0.065816 seconds and 5 git commands to generate.