cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: jbrassow@sourceware.org <jbrassow@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/resources lvm.sh
Date: 9 May 2007 20:48:35 -0000	[thread overview]
Message-ID: <20070509204835.19134.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	jbrassow at sourceware.org	2007-05-09 20:48:35

Modified files:
	rgmanager/src/resources: lvm.sh 

Log message:
	If misconfigured, HA LVM + mirroring can cause data corruption.  We should
	attempt to catch configuration errors before allowing LVM resources to start.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/lvm.sh.diff?cvsroot=cluster&r1=1.6&r2=1.7

--- cluster/rgmanager/src/resources/lvm.sh	2007/05/09 18:00:44	1.6
+++ cluster/rgmanager/src/resources/lvm.sh	2007/05/09 20:48:35	1.7
@@ -432,6 +432,32 @@
 	return $OCF_SUCCESS
 }
 
+ha_lvm_proper_setup_check()
+{
+	# First, let's check that they have setup their lvm.conf correctly
+	if ! lvm dumpconfig activation/volume_list >& /dev/null ||
+	   ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then
+		ocf_log err "lvm.conf improperly configured for HA LVM."
+		return $OCF_ERR_GENERIC
+	fi
+
+	# Next, we need to ensure that their initrd has been updated
+	if [ -e /boot/initrd-`uname -r`.img ]; then
+		if [ "$(find /boot/initrd-`uname -r`.img -newer /etc/lvm/lvm.conf)" == "" ]; then
+			ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf"
+			return $OCF_ERR_GENERIC
+		fi
+	else
+		# Best guess...
+		if [ "$(find /boot/*.img -newer /etc/lvm/lvm.conf)" == "" ]; then
+			ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf"
+			return $OCF_ERR_GENERIC
+		fi
+	fi
+
+	return $OCF_SUCCESS
+}
+
 case $1 in
 start)
 	if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then
@@ -439,6 +465,8 @@
 		exit 0
 	fi
 
+	ha_lvm_proper_setup_check || exit 1
+		
 	if [ -z $OCF_RESKEY_lv_name ]; then
 		vg_activate start || exit 1
 	else
@@ -462,6 +490,10 @@
 		exit 0
 	fi
 
+	if ! ha_lvm_proper_setup_check; then
+		ocf_log err "WARNING: An improper setup can cause data corruption!"
+	fi
+
 	if [ -z $OCF_RESKEY_lv_name ]; then
 		vg_activate stop || exit 1
 	else



             reply	other threads:[~2007-05-09 20:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 20:48 jbrassow [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-06 17:43 [Cluster-devel] cluster/rgmanager/src/resources lvm.sh jbrassow
2008-02-06 16:40 jbrassow
2008-01-03 20:56 jbrassow
2007-07-02 21:59 jbrassow
2007-07-02 21:59 jbrassow
2007-07-02 21:58 jbrassow
2007-05-29 14:37 jbrassow
2007-05-29 14:35 jbrassow
2007-05-29 14:33 jbrassow
2007-05-09 20:51 jbrassow
2007-05-09 20:50 jbrassow
2007-05-09 18:04 jbrassow
2007-05-09 18:03 jbrassow
2007-05-09 18:00 jbrassow
2007-04-18 19:14 jbrassow
2007-04-18 18:14 jbrassow
2007-04-18 18:09 jbrassow
2007-04-18 17:02 jbrassow
2007-03-08 19:37 jbrassow
2007-02-15 22:49 lhh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070509204835.19134.qmail@sourceware.org \
    --to=jbrassow@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).