Hi Hideo-san,
On Mon, Sep 12, 2011 at 02:44:22PM +0900, renayama19661014@ybb.ne.jp 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@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page:
http://linux-ha.org/