
renayama19661014 at ybb
Oct 3, 2011, 2:33 PM
Post #8 of 8
(287 views)
Permalink
|
|
Re: [Patch]Patch for LVM resource agents.
[In reply to]
|
|
Hi Dejan, Many Thanks!! Hideo Yamauchi. --- On Tue, 2011/10/4, Dejan Muhamedagic <dejan [at] suse> wrote: > Hi Hideo-san, > > On Fri, Sep 30, 2011 at 11:17:19AM +0900, renayama19661014 [at] ybb wrote: > > Hi Dejan, > > > > Sorry.... > > > > I sent the main body which was not a patch. > > I send it again. > > Patch applied. > > Cheers, > > Dejan > > > Best Regards, > > Hideo Yamauchi. > > > > --- On Fri, 2011/9/30, renayama19661014 [at] ybb <renayama19661014 [at] ybb> wrote: > > > > > Hi Dejan, > > > > > > Sorry.... > > > > > > There was still a mistake to the patch which I sent a while ago. > > > With the patch which I sent a while ago, precious detailed log is canceled. > > > Furthermore, I send the patch which I revised. > > > > > > Best Regards, > > > Hideo Yamauchi. > > > > > > > > > --- On Fri, 2011/9/30, renayama19661014 [at] ybb <renayama19661014 [at] ybb> wrote: > > > > > > > Hi Dejan, > > > > > > > > > > ocft test reports this: > > > > > > > > > > > > 'LVM' case 7: FAILED. Agent returns unexpected value: 'OCF_NOT_RUNNING'. See details below: > > > > > > 2011/09/29_17:00:49 WARNING: LVM Volume ocft-vg is not available (stopped). Using volume group(s) on command line > > > > > > Finding volume group "ocft-vg" > > > > > > --- Volume group --- > > > > > > VG Name ocft-vg > > > > > > System ID > > > > > > Format lvm2 > > > > > > Metadata Areas 1 > > > > > > Metadata Sequence No 2 > > > > > > VG Access read/write > > > > > > VG Status resizable > > > > > > MAX LV 0 > > > > > > Cur LV 1 > > > > > > Open LV 0 > > > > > > Max PV 0 > > > > > > Cur PV 1 > > > > > > Act PV 1 > > > > > > VG Size 4.00 MiB > > > > > > PE Size 4.00 KiB > > > > > > Total PE 1024 > > > > > > Alloc PE / Size 150 / 600.00 KiB > > > > > > Free PE / Size 874 / 3.41 MiB > > > > > > VG UUID csVKm6-Bzdp-s40E-9O2S-uttx-PrcW-fq6Wtz > > > > > > > > > > > > --- Logical volume --- > > > > > > LV Name /dev/ocft-vg/ocft-lv > > > > > > VG Name ocft-vg > > > > > > LV UUID XjMtXj-DLzy-J8Rb-6Bfb-HNoM-7o6x-VOPnMG > > > > > > LV Write Access read/write > > > > > > LV Status NOT available > > > > > > LV Size 600.00 KiB > > > > > > Current LE 150 > > > > > > Segments 1 > > > > > > Allocation inherit > > > > > > Read ahead sectors auto > > > > > > > > > > > > --- Physical volumes --- > > > > > > PV Name /dev/loop0 > > > > > > PV UUID z6deWo-42uN-HPrZ-nLC4-wrba-34IZ-N98cmL > > > > > > PV Status allocatable > > > > > > Total PE / Free PE 1024 / 874 > > > > > > > > > > > > 2011/09/29_17:00:49 INFO: LVM Volume ocft-vg is offline > > > > > > > > > > > > That's for double stop, I think. OTOH, ocf-tester says that it > > > > > > passed all tests. Somebody's lying :) > > > > > > > > I do not know a lot about ocft. > > > > I carried out ocft with -v option. > > > > * It is LVM which applied the patch which I attached to this email to have carried out. > > > > > > > > [root [at] bl460g1 heartbeat]# /usr/sbin/ocft test -v LVM > > > > Initialing LVM...done > > > > (snip) > > > > Starting 'LVM' case 7 'monitor when running': > > > > Setting agent environment: export OCFT_pv=/var/run/resource-agents/ocft-LVM-pv > > > > Setting agent environment: export OCFT_vg=ocft-vg > > > > Setting agent environment: export OCFT_lv=ocft-lv > > > > Setting agent environment: export OCFT_loop=/dev/loop0 > > > > Setting agent environment: export OCF_RESKEY_volgrpname=ocft-vg > > > > Running agent: ./LVM stop ----> ????? > > > > Running agent: ./LVM monitor > > > > Checking return value: FAILED. The return value 'OCF_NOT_RUNNING' != 'OCF_SUCCESS'. See details below: > > > > 2011/09/30_10:16:49 INFO: LVM Volume ocft-vg is offline > > > > (snip) > > > > > > > > After stop of LVM was carried out on 'monitor when running' test, monitor seems to be carried out. > > > > > > > > Is not it a problem of ocft? > > > > > > > > > > When I tried by hand to stop a running VG: > > > > > > > > > > > > # OCF_RESKEY_volgrpname=$OCFT_vg /usr/lib/ocf/resource.d/heartbeat/LVM stop > > > > > > INFO: Deactivating volume group ocft-vg > > > > > > INFO: 0 logical volume(s) in volume group "ocft-vg" now active > > > > > > ERROR: LVM Volume ocft-vg is not available (stopped). Using volume group(s) on command line > > > > > > Finding volume group "ocft-vg" > > > > > > ... > > > > > > # echo $? > > > > > > 0 > > > > > > > > > > > > The exit code is OK, but there's an error message. Further stops > > > > > > produced the same. Can you please verify this. > > > > > > > > > > > > Hence, there seems to be a problem with the ocft test case. > > > > > > > > This was a mistake of my patch. > > > > I attached the patch which I revised. > > > > > > > > Best Regards, > > > > Hideo Yamauchi. > > > > > > > > > > > > > > > > --- On Fri, 2011/9/30, renayama19661014 [at] ybb <renayama19661014 [at] ybb> wrote: > > > > > > > > > Hi Dejan, > > > > > > > > > > Thank you for comment. > > > > > I confirm your information and revise a patch again. > > > > > > > > > > Best Regards, > > > > > Hideo Yamauchi. > > > > > > > > > > --- On Fri, 2011/9/30, Dejan Muhamedagic <dejan [at] suse> wrote: > > > > > > > > > > > Hi Hideo-san, > > > > > > > > > > > > On Mon, Sep 12, 2011 at 02:44:22PM +0900, renayama19661014 [at] ybb wrote: > > > > > > > Hi All, > > > > > > > > > > > > > > We made the patch of the LVM resource agent at the next point of view. > > > > > > > > > > > > > > Point 1) The LVM resource agent outputs the details of the log at the time of the error for a system administrator. > > > > > > > Point 2) The LVM resource agent uses OCF variable for a return code. > > > > > > > Point 3) With a patch, the LVM resource agent merge status processing and report_status processing. > > > > > > > > > > > > > > * We did not revise it about TODO of vgimport/vgexport in the LVM resource agent. > > > > > > > > > > > > > > Please examine this patch. > > > > > > > > > > > > ocft test reports this: > > > > > > > > > > > > 'LVM' case 7: FAILED. Agent returns unexpected value: 'OCF_NOT_RUNNING'. See details below: > > > > > > 2011/09/29_17:00:49 WARNING: LVM Volume ocft-vg is not available (stopped). Using volume group(s) on command line > > > > > > Finding volume group "ocft-vg" > > > > > > --- Volume group --- > > > > > > VG Name ocft-vg > > > > > > System ID > > > > > > Format lvm2 > > > > > > Metadata Areas 1 > > > > > > Metadata Sequence No 2 > > > > > > VG Access read/write > > > > > > VG Status resizable > > > > > > MAX LV 0 > > > > > > Cur LV 1 > > > > > > Open LV 0 > > > > > > Max PV 0 > > > > > > Cur PV 1 > > > > > > Act PV 1 > > > > > > VG Size 4.00 MiB > > > > > > PE Size 4.00 KiB > > > > > > Total PE 1024 > > > > > > Alloc PE / Size 150 / 600.00 KiB > > > > > > Free PE / Size 874 / 3.41 MiB > > > > > > VG UUID csVKm6-Bzdp-s40E-9O2S-uttx-PrcW-fq6Wtz > > > > > > > > > > > > --- Logical volume --- > > > > > > LV Name /dev/ocft-vg/ocft-lv > > > > > > VG Name ocft-vg > > > > > > LV UUID XjMtXj-DLzy-J8Rb-6Bfb-HNoM-7o6x-VOPnMG > > > > > > LV Write Access read/write > > > > > > LV Status NOT available > > > > > > LV Size 600.00 KiB > > > > > > Current LE 150 > > > > > > Segments 1 > > > > > > Allocation inherit > > > > > > Read ahead sectors auto > > > > > > > > > > > > --- Physical volumes --- > > > > > > PV Name /dev/loop0 > > > > > > PV UUID z6deWo-42uN-HPrZ-nLC4-wrba-34IZ-N98cmL > > > > > > PV Status allocatable > > > > > > Total PE / Free PE 1024 / 874 > > > > > > > > > > > > 2011/09/29_17:00:49 INFO: LVM Volume ocft-vg is offline > > > > > > > > > > > > That's for double stop, I think. OTOH, ocf-tester says that it > > > > > > passed all tests. Somebody's lying :) > > > > > > > > > > > > When I tried by hand to stop a running VG: > > > > > > > > > > > > # OCF_RESKEY_volgrpname=$OCFT_vg /usr/lib/ocf/resource.d/heartbeat/LVM stop > > > > > > INFO: Deactivating volume group ocft-vg > > > > > > INFO: 0 logical volume(s) in volume group "ocft-vg" now active > > > > > > ERROR: LVM Volume ocft-vg is not available (stopped). Using volume group(s) on command line > > > > > > Finding volume group "ocft-vg" > > > > > > ... > > > > > > # echo $? > > > > > > 0 > > > > > > > > > > > > The exit code is OK, but there's an error message. Further stops > > > > > > produced the same. Can you please verify this. > > > > > > > > > > > > Hence, there seems to be a problem with the ocft test case. > > > > > > > > > > > > Cheers, > > > > > > > > > > > > Dejan > > > > > > > > > > > > > Best Regards, > > > > > > > Hideo Yamauchi. > > > > > > > diff -r fc1e82852f7a heartbeat/LVM > > > > > > > --- a/heartbeat/LVM Wed Aug 31 01:39:02 2011 +0900 > > > > > > > +++ b/heartbeat/LVM Mon Sep 12 14:29:36 2011 +0900 > > > > > > > @@ -123,22 +123,17 @@ > > > > > > > # Return LVM status (silently) > > > > > > > # > > > > > > > LVM_status() { > > > > > > > - if > > > > > > > - [ "$LVM_MAJOR" -eq "1" ] > > > > > > > - then > > > > > > > - vgdisplay $1 2>&1 | grep -i 'Status.*available' 2>&1 >/dev/null > > > > > > > - return $? > > > > > > > - else > > > > > > > - vgdisplay -v $1 2>&1 | grep -i 'Status[ \t]*available' 2>&1 >/dev/null > > > > > > > - return $? > > > > > > > + local rc > > > > > > > + loglevel="debug" > > > > > > > + > > > > > > > + # Set the log level of the error message > > > > > > > + if [ "X${2}" == "X" ]; then > > > > > > > + loglevel="err" > > > > > > > + if ocf_is_probe; then > > > > > > > + loglevel="warn" > > > > > > > + fi > > > > > > > fi > > > > > > > -} > > > > > > > - > > > > > > > -# > > > > > > > -# Report on LVM volume status to stdout... > > > > > > > -# > > > > > > > -LVM_report_status() { > > > > > > > - > > > > > > > + > > > > > > > if > > > > > > > [ "$LVM_MAJOR" -eq "1" ] > > > > > > > then > > > > > > > @@ -150,16 +145,16 @@ > > > > > > > echo "$VGOUT" | grep -i 'Status[ \t]*available' >/dev/null > > > > > > > rc=$? > > > > > > > fi > > > > > > > - > > > > > > > - if > > > > > > > - [ $rc -eq 0 ] > > > > > > > - then > > > > > > > - : Volume $1 is available > > > > > > > - else > > > > > > > - ocf_log debug "LVM Volume $1 is not available (stopped)" > > > > > > > - return $OCF_NOT_RUNNING > > > > > > > + if [ $rc -ne 0 ]; then > > > > > > > + ocf_log $loglevel "LVM Volume $1 is not available (stopped). ${VGOUT}" > > > > > > > + fi > > > > > > > + > > > > > > > + if [ "X${2}" == "X" ]; then > > > > > > > + # status call return > > > > > > > + return $rc > > > > > > > fi > > > > > > > > > > > > > > + # Report on LVM volume status to stdout... > > > > > > > if > > > > > > > echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null > > > > > > > then > > > > > > > @@ -167,8 +162,9 @@ > > > > > > > else > > > > > > > ocf_log debug "Volume $1 is available read-only (running)" > > > > > > > fi > > > > > > > - > > > > > > > + > > > > > > > return $OCF_SUCCESS > > > > > > > + > > > > > > > } > > > > > > > > > > > > > > # > > > > > > > @@ -176,6 +172,7 @@ > > > > > > > # > > > > > > > # > > > > > > > LVM_monitor() { > > > > > > > + local rc > > > > > > > if > > > > > > > LVM_status $1 > > > > > > > then > > > > > > > @@ -185,9 +182,14 @@ > > > > > > > return $OCF_NOT_RUNNING > > > > > > > fi > > > > > > > > > > > > > > - vgck $1 >/dev/null 2>&1 > > > > > > > + VGOUT=`vgck $1 2>&1` > > > > > > > + rc=$? > > > > > > > + if [ $rc -ne 0 ]; then > > > > > > > + ocf_log err "LVM Volume $1 is not found. ${VGOUT}:${rc}" > > > > > > > + return $OCF_ERR_GENERIC > > > > > > > + fi > > > > > > > > > > > > > > - return $? > > > > > > > + return $OCF_SUCCESS > > > > > > > } > > > > > > > > > > > > > > # > > > > > > > @@ -232,10 +234,10 @@ > > > > > > > > > > > > > > vgdisplay "$1" 2>&1 | grep 'Volume group .* not found' >/dev/null && { > > > > > > > ocf_log info "Volume group $1 not found" > > > > > > > - return 0 > > > > > > > + return $OCF_SUCCESS > > > > > > > } > > > > > > > ocf_log info "Deactivating volume group $1" > > > > > > > - ocf_run vgchange -a ln $1 || return 1 > > > > > > > + ocf_run vgchange -a ln $1 || return $OCF_ERR_GENERIC > > > > > > > > > > > > > > if > > > > > > > LVM_status $1 > > > > > > > @@ -256,10 +258,10 @@ > > > > > > > check_binary $AWK > > > > > > > > > > > > > > # Off-the-shelf tests... > > > > > > > - vgck "$VOLUME" >/dev/null 2>&1 > > > > > > > + VGOUT=`vgck ${VOLUME} 2>&1` > > > > > > > > > > > > > > if [ $? -ne 0 ]; then > > > > > > > - ocf_log err "Volume group [$VOLUME] does not exist or contains error!" > > > > > > > + ocf_log err "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}" > > > > > > > exit $OCF_ERR_GENERIC > > > > > > > fi > > > > > > > > > > > > > > @@ -267,13 +269,13 @@ > > > > > > > if > > > > > > > [ "$LVM_MAJOR" -eq "1" ] > > > > > > > then > > > > > > > - vgdisplay "$VOLUME" >/dev/null 2>&1 > > > > > > > + VGOUT=`vgdisplay ${VOLUME} 2>&1` > > > > > > > else > > > > > > > - vgdisplay -v "$VOLUME" >/dev/null 2>&1 > > > > > > > + VGOUT=`vgdisplay -v ${VOLUME} 2>&1` > > > > > > > fi > > > > > > > > > > > > > > if [ $? -ne 0 ]; then > > > > > > > - ocf_log err "Volume group [$VOLUME] does not exist or contains error!" > > > > > > > + ocf_log err "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}" > > > > > > > exit $OCF_ERR_GENERIC > > > > > > > fi > > > > > > > > > > > > > > @@ -350,7 +352,7 @@ > > > > > > > stop) LVM_stop $VOLUME > > > > > > > exit $?;; > > > > > > > > > > > > > > - status) LVM_report_status $VOLUME > > > > > > > + status) LVM_status $VOLUME $1 > > > > > > > exit $?;; > > > > > > > > > > > > > > monitor) LVM_monitor $VOLUME > > > > > > > > > > > > > _______________________________________________________ > > > > > > > Linux-HA-Dev: Linux-HA-Dev [at] lists > > > > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > > > > > > > Home Page: http://linux-ha.org/ > > > > > > > > > > > > > > > > > _______________________________________________________ > > > > > Linux-HA-Dev: Linux-HA-Dev [at] lists > > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > > > > > Home Page: http://linux-ha.org/ > > > > > > > diff -r fc1e82852f7a heartbeat/LVM > > --- a/heartbeat/LVM Wed Aug 31 01:39:02 2011 +0900 > > +++ b/heartbeat/LVM Fri Sep 30 11:07:52 2011 +0900 > > @@ -123,22 +123,21 @@ > > # Return LVM status (silently) > > # > > LVM_status() { > > - if > > - [ "$LVM_MAJOR" -eq "1" ] > > - then > > - vgdisplay $1 2>&1 | grep -i 'Status.*available' 2>&1 >/dev/null > > - return $? > > - else > > - vgdisplay -v $1 2>&1 | grep -i 'Status[ \t]*available' 2>&1 >/dev/null > > - return $? > > + local rc > > + loglevel="debug" > > + > > + # Set the log level of the error message > > + if [ "X${2}" == "X" ]; then > > + loglevel="err" > > + if ocf_is_probe; then > > + loglevel="warn" > > + else > > + if [ ${OP_METHOD} == "stop" ]; then > > + loglevel="info" > > + fi > > + fi > > fi > > -} > > - > > -# > > -# Report on LVM volume status to stdout... > > -# > > -LVM_report_status() { > > - > > + > > if > > [ "$LVM_MAJOR" -eq "1" ] > > then > > @@ -151,15 +150,16 @@ > > rc=$? > > fi > > > > - if > > - [ $rc -eq 0 ] > > - then > > - : Volume $1 is available > > - else > > - ocf_log debug "LVM Volume $1 is not available (stopped)" > > - return $OCF_NOT_RUNNING > > + if [ $rc -ne 0 ]; then > > + ocf_log $loglevel "LVM Volume $1 is not available (stopped). ${VGOUT}" > > + fi > > + > > + if [ "X${2}" == "X" ]; then > > + # status call return > > + return $rc > > fi > > > > + # Report on LVM volume status to stdout... > > if > > echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null > > then > > @@ -167,8 +167,9 @@ > > else > > ocf_log debug "Volume $1 is available read-only (running)" > > fi > > - > > + > > return $OCF_SUCCESS > > + > > } > > > > # > > @@ -176,6 +177,7 @@ > > # > > # > > LVM_monitor() { > > + local rc > > if > > LVM_status $1 > > then > > @@ -185,9 +187,14 @@ > > return $OCF_NOT_RUNNING > > fi > > > > - vgck $1 >/dev/null 2>&1 > > + VGOUT=`vgck $1 2>&1` > > + rc=$? > > + if [ $rc -ne 0 ]; then > > + ocf_log err "LVM Volume $1 is not found. ${VGOUT}:${rc}" > > + return $OCF_ERR_GENERIC > > + fi > > > > - return $? > > + return $OCF_SUCCESS > > } > > > > # > > @@ -232,10 +239,10 @@ > > > > vgdisplay "$1" 2>&1 | grep 'Volume group .* not found' >/dev/null && { > > ocf_log info "Volume group $1 not found" > > - return 0 > > + return $OCF_SUCCESS > > } > > ocf_log info "Deactivating volume group $1" > > - ocf_run vgchange -a ln $1 || return 1 > > + ocf_run vgchange -a ln $1 || return $OCF_ERR_GENERIC > > > > if > > LVM_status $1 > > @@ -256,10 +263,10 @@ > > check_binary $AWK > > > > # Off-the-shelf tests... > > - vgck "$VOLUME" >/dev/null 2>&1 > > + VGOUT=`vgck ${VOLUME} 2>&1` > > > > if [ $? -ne 0 ]; then > > - ocf_log err "Volume group [$VOLUME] does not exist or contains error!" > > + ocf_log err "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}" > > exit $OCF_ERR_GENERIC > > fi > > > > @@ -267,13 +274,13 @@ > > if > > [ "$LVM_MAJOR" -eq "1" ] > > then > > - vgdisplay "$VOLUME" >/dev/null 2>&1 > > + VGOUT=`vgdisplay ${VOLUME} 2>&1` > > else > > - vgdisplay -v "$VOLUME" >/dev/null 2>&1 > > + VGOUT=`vgdisplay -v ${VOLUME} 2>&1` > > fi > > > > if [ $? -ne 0 ]; then > > - ocf_log err "Volume group [$VOLUME] does not exist or contains error!" > > + ocf_log err "Volume group [$VOLUME] does not exist or contains error! ${VGOUT}" > > exit $OCF_ERR_GENERIC > > fi > > > > @@ -340,7 +347,7 @@ > > LVM_MAJOR="${LVM_VERSION%%.*}" > > > > VOLUME=$OCF_RESKEY_volgrpname > > - > > +OP_METHOD=$1 > > # What kind of method was invoked? > > case "$1" in > > > > @@ -350,7 +357,7 @@ > > stop) LVM_stop $VOLUME > > exit $?;; > > > > - status) LVM_report_status $VOLUME > > + status) LVM_status $VOLUME $1 > > exit $?;; > > > > monitor) LVM_monitor $VOLUME > > > _______________________________________________________ > > Linux-HA-Dev: Linux-HA-Dev [at] lists > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > > Home Page: http://linux-ha.org/ > > _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev [at] lists http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
|