mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
7a8fa6aaab
the background polldaemon is allowed to start. It can be used standalone or in conjunction with --refresh or --available y. Control over when the background polldaemon starts will be particularly important for snapshot-merge of a root filesystem. Dracut will be updated to activate all LVs with: --poll n The lvm2-monitor initscript will start polling with: --poll y NOTE: Because we currently have no way of knowing if a background polldaemon is active for a given LV the following limitations exist and have been deemed acceptable: 1) it is not possible to stop an active polldaemon; so the lvm2-monitor initscript doesn't stop running polldaemon(s) 2) redundant polldaemon instances will be started for all specified LVs if vgchange or lvchange are repeatedly used with '--poll y' Signed-off-by: Mike Snitzer <snitzer@redhat.com>
120 lines
2.4 KiB
Bash
120 lines
2.4 KiB
Bash
#!/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-monitor
|
|
# 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 or progress polling
|
|
### END INIT INFO
|
|
|
|
. /etc/init.d/functions
|
|
|
|
DAEMON=lvm2_monitor
|
|
|
|
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 --poll 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
|