1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvm.static no longer interacts with dmeventd unless explicitly asked to.

This commit is contained in:
Alasdair Kergon 2007-01-24 23:43:27 +00:00
parent 24f4552bbe
commit 20db8ffcae
6 changed files with 122 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.20 - Version 2.02.20 -
=================================== ===================================
lvm.static no longer interacts with dmeventd unless explicitly asked to.
Add field definitions to report help text. Add field definitions to report help text.
Remove unnecessary cmd arg from target_*monitor_events(). Remove unnecessary cmd arg from target_*monitor_events().
Add private variable to dmeventd shared library interface. Add private variable to dmeventd shared library interface.

View File

@ -653,6 +653,10 @@ int monitor_dev_for_events(struct cmd_context *cmd,
struct lv_segment *seg; struct lv_segment *seg;
int (*monitor_fn) (struct lv_segment *s, int e); int (*monitor_fn) (struct lv_segment *s, int e);
/* skip dmeventd code altogether */
if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
return 1;
/* /*
* Nothing to do if dmeventd configured not to be used. * Nothing to do if dmeventd configured not to be used.
*/ */

View File

@ -90,6 +90,8 @@ int ignorelockingfailure(void);
int lockingfailed(void); int lockingfailed(void);
int security_level(void); int security_level(void);
int mirror_in_sync(void); int mirror_in_sync(void);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void); int dmeventd_monitor_mode(void);
/* Suppress messages to stdout/stderr (1) or everywhere (2) */ /* Suppress messages to stdout/stderr (1) or everywhere (2) */

View File

@ -0,0 +1,98 @@
#!/bin/bash
#
# Copyright (C) 2007 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
#
### BEGIN INIT INFO
# Provides:
### END INIT INFO
. /etc/init.d/functions
VGCHANGE="/usr/sbin/vgchange"
start()
{
for ret in 0
do
# TODO do we want to separate out already active groups only?
VGS=`vgs --noheadings -o name`
for vg in $VGS
do
if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg
then
ret=$?
fi
done
done
return $ret
}
stop()
{
for ret in 0
do
# TODO do we want to separate out already active groups only?
VGS=`vgs --noheadings -o name`
for vg in $VGS
do
if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor n $vg
then
ret=$?
fi
done
done
}
ret=1
# See how we were called.
case "$1" in
start)
start
ret=$?
;;
stop)
stop
ret=$?
;;
restart)
if stop
then
start
fi
ret=$?
;;
status)
# TODO anyone with an idea how to dump monitored volumes?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
;;
esac
exit $ret

View File

@ -94,7 +94,8 @@ static int lvchange_monitoring(struct cmd_context *cmd,
if (lv->status & PVMOVE) if (lv->status & PVMOVE)
return 1; return 1;
if (!monitor_dev_for_events(cmd, lv, dmeventd_monitor_mode())) if ((dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) &&
!monitor_dev_for_events(cmd, lv, dmeventd_monitor_mode()))
stack; stack;
return 1; return 1;
@ -591,7 +592,9 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED; return ECMD_FAILED;
} }
init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR)); init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG,
cmd->is_static ?
DMEVENTD_MONITOR_IGNORE : DEFAULT_DMEVENTD_MONITOR));
/* access permission change */ /* access permission change */
if (arg_count(cmd, permission_ARG)) { if (arg_count(cmd, permission_ARG)) {

View File

@ -105,7 +105,8 @@ static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg
{ {
int active, monitored; int active, monitored;
if ((active = lvs_in_vg_activated(vg))) { if ((active = lvs_in_vg_activated(vg)) &&
dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) {
monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode()); monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
log_print("%d logical volume(s) in volume group " log_print("%d logical volume(s) in volume group "
"\"%s\" %smonitored", "\"%s\" %smonitored",
@ -146,11 +147,13 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
if (activate && (active = lvs_in_vg_activated(vg))) { if (activate && (active = lvs_in_vg_activated(vg))) {
log_verbose("%d logical volume(s) in volume group \"%s\" " log_verbose("%d logical volume(s) in volume group \"%s\" "
"already active", active, vg->name); "already active", active, vg->name);
monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode()); if (dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) {
log_verbose("%d existing logical volume(s) in volume " monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
"group \"%s\" %smonitored", log_verbose("%d existing logical volume(s) in volume "
monitored, vg->name, "group \"%s\" %smonitored",
dmeventd_monitor_mode() ? "" : "un"); monitored, vg->name,
dmeventd_monitor_mode() ? "" : "un");
}
} }
if (activate && _activate_lvs_in_vg(cmd, vg, available)) if (activate && _activate_lvs_in_vg(cmd, vg, available))
@ -532,7 +535,9 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED; return ECMD_FAILED;
} }
init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR)); init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG,
cmd->is_static ?
DMEVENTD_MONITOR_IGNORE : DEFAULT_DMEVENTD_MONITOR));
if (arg_count(cmd, available_ARG)) if (arg_count(cmd, available_ARG))
r = _vgchange_available(cmd, vg); r = _vgchange_available(cmd, vg);