cluster/rgmanager/src/resources lvm.sh
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: jbrassow at sourceware.org 2007-07-02 21:59:34
Modified files:
rgmanager/src/resources: lvm.sh
Log message:
<Previous check-in>
Require vg_name to be unique. Allowing multiple LVs from the same VG on different machines can lead to races when updating metadata during device failures.
</Previous check-in>
We can do better. This patch puts the validation in lvm.sh so that it can print out a understandable error message.
rgmanager/src/resources/lvm.sh +12 -1
@@ -71,7 +71,7 @@ <content type="string"/> </parameter> - <parameter name="vg_name" required="1" unique="1"> + <parameter name="vg_name" required="1"> <longdesc lang="en"> If you can see this, your GUI is broken. </longdesc>
@@ -465,6 +465,17 @@ exit 0 fi + if ! lvs $OCF_RESKEY_vg_name >& /dev/null; then + lv_count=0 + else + lv_count=`lvs --noheadings -o name $OCF_RESKEY_vg_name | grep -v _mlog | grep -v _mimage | grep -v nconsistent | wc -l` + fi + if [ $lv_count -gt 1 ]; then + ocf_log err "HA LVM requires Only one logical volume per volume group." + ocf_log err "There are currently $lv_count logical volumes in $OCF_RESKEY_vg_name" + ocf_log err "Failing HA LVM start of $OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name" + exit $OCF_ERR_GENERIC + fi ha_lvm_proper_setup_check || exit 1 if [ -z $OCF_RESKEY_lv_name ]; then