On Fri, May 20, 2005 at 12:40:52PM +0100, Nikos Gkorogiannis wrote: > Package: heartbeat > Version: 1.2.3-9 > Severity: normal > Tags: patch > > > The script /etc/ha.d/resource.d/LVM will not work with LVM2 utilities > due to changes in output and command line arguments. The attached patch > fixes it. > > Thanks > Nikos
[snip] > 105,106c105,106 > < vgdisplay $1 | grep -i 'Status.*available' >/dev/null > < > --- > > vgdisplay -v $1 | grep -i 'Status[ \t]*available' >/dev/null > > > 114c114 > < VGOUT=`vgdisplay $1 2>&1` > --- > > VGOUT=`vgdisplay -v $1 2>&1` > 116c116 > < echo "$VGOUT" | grep -i 'Status.*available' >/dev/null > --- > > echo "$VGOUT" | grep -i 'Status[ \t]*available' &>/dev/null > 124c124 > < echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null > --- > > echo "$VGOUT" | grep -i 'Access.*read/write' &>/dev/null > 158c158 > < run vgscan $1 > --- > > run vgscan Hi, I am thinking that the attached patch might be better as it will allow both the new-style and old-style LVM commands to work. Are you able to test this? -- Horms
Index: heartbeat/resource.d/LVM.in =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/resource.d/Attic/LVM.in,v retrieving revision 1.2.4.1 diff -p -u -r1.2.4.1 LVM.in --- heartbeat/resource.d/LVM.in 20 Apr 2004 05:05:29 -0000 1.2.4.1 +++ heartbeat/resource.d/LVM.in 10 Jun 2005 07:46:28 -0000 @@ -102,8 +102,15 @@ LVM_methods() { # LVM_status() { - vgdisplay $1 | grep -i 'Status.*available' >/dev/null - + if + [ "$LVM_VERSION" -eq "200" ] + then + vgdisplay -v $1 | grep -i 'Status[ \t]*available' &>/dev/null + return $? + else + vgdisplay $1 | grep -i 'Status.*available' >/dev/null + return $? + fi } # @@ -111,15 +118,27 @@ LVM_status() { # LVM_report_status() { - VGOUT=`vgdisplay $1 2>&1` + if + [ "$LVM_VERSION" -eq "200" ] + then + VGOUT=`vgdisplay -v $1 2>&1` + echo "$VGOUT" | grep -i 'Status[ \t]*available' >/dev/null + rc=$? + else + VGOUT=`vgdisplay $1 2>&1` + echo "$VGOUT" | grep -i 'Status.*available' >/dev/null + rc=$? + fi + if - echo "$VGOUT" | grep -i 'Status.*available' >/dev/null + [ $rc -eq 0 ] then : Volume $1 is available else echo "LVM Volume $1 is not available (stopped)" return 1 fi + if echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null then @@ -155,7 +174,15 @@ LVM_monitor() { LVM_start() { ha_log "Activating volume group $1" - run vgscan $1 + + if + [ "$LVM_VERSION" -eq "200" ] + then + run vgscan + else + run vgscan $1 + fi + run vgchange -a y $1 || return 1 if @@ -196,6 +223,15 @@ if then LVM_methods exit $? +fi + +LVM_VERSION=`/sbin/lvmiopversion` +rc=$? +if + [ $rc -ne 0 ] +then + ha_log "ERROR: LVM: $1 could not determine LVM version" + return $rc fi VOLUME=$1