Nir Soffer has uploaded a new change for review.
Change subject: fcp: Deactivate vdsm volume groups during boot ......................................................................
fcp: Deactivate vdsm volume groups during boot
When using FC storage, physical volumes are connected during boot, and vdsm volume groups are auto-activated by /etc/rc.sysinit and/or /etc/init.d/netfs. This is abnormal situation that vdsm cannot handle, and leads to data corruption.
This patch adds a new init script that deactivate FC volume groups during boot.
This script must also be used during installation or ugprade. It is safe to invoke it multiple times; it will modify volume groups only on the first run.
On RHEL 6.5 we can use new activation skipping option instead of this script. I'll address this in a separate patch.
Change-Id: I8f72a68ad09566ba222aa45448c78d1577c40d21 Bug-Url: https://bugzilla.redhat.com/1009812 Signed-off-by: Nir Soffer nsoffer@redhat.com --- A init/sysvinit/vdsm-deactivate-vgs.init 1 file changed, 88 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/20720/1
diff --git a/init/sysvinit/vdsm-deactivate-vgs.init b/init/sysvinit/vdsm-deactivate-vgs.init new file mode 100644 index 0000000..0b56c43 --- /dev/null +++ b/init/sysvinit/vdsm-deactivate-vgs.init @@ -0,0 +1,88 @@ +#! /bin/sh +# +# Copyright 2013 Red Hat, Inc. and/or its affiliates. +# +# Licensed to you under the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. See the files README and +# LICENSE_GPL_v2 which accompany this distribution. +# + +# chkconfig: 2345 98 00 +# +### BEGIN INIT INFO +# Provides: vdsm-deacivate-vgs +# Required-Start: $syslog $network +# Should-Start: $time +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: dactivate VDS management server logical volumes +# Short-Description: dactivate VDS management server logical volumes +### END INIT INFO + +. /etc/init.d/functions + +run_file="var/run/vdsm/lvm/deactivate-vgs" +prog="vdsm-deactivate-vgs" +retval=0 + +log_failure_msg() +{ + printf "$@"; failure "$@"; echo; +} + +log_success_msg() +{ + printf "$@"; success "$@"; echo; +} + +is_first_run() +{ + test ! -f $run_file +} + +set_was_run() +{ + touch $run_file +} + +deactivate_vdsm_vgs() +{ + local vgs_info=$(/sbin/lvm vgs --noheadings -o vg_name,tags) + if [ $? -ne 0 ]; then + log_failure_msg "$prog: error checking vgs" + return 1 + fi + + local vdsm_vgs=$(echo $vgs_info | /bin/awk '/MDT_TYPE=FCP/ {print $1}') + if [ $? -ne 0 ]; then + log_failure_msg "$prog: error filtering vgs" + return 1 + fi + + if ! lvm vgchange -a n $vdsm_vgs; then + log_failure_msg "$prog: error deactivating vdsm vgs" + return 1 + fi + + log_success_msg "$prog: deactivated vdsm vgs" + return 0 +} + +case "$1" in + start) + if is_first_run; then + set_was_run + deactivate_vdsm_vgs + retval=$? + fi + ;; + stop) + ;; + *) + echo "Usage: $0 {start|stop}" + retval=2 +esac + +exit $retval