[ClusterLabs Developers] bug? in heartbeat/LVM OCF script

Chris Friesen chris.friesen at windriver.com
Tue Jun 21 13:03:12 EDT 2016


On 06/20/2016 05:50 PM, Chris Friesen wrote:
> 
> Hi,
> 
> The heartbeat/LVM OCF script uses the following logic for the LVM_status() routine:
> 
> if [ -d /dev/$1 ]; then
>      test "`cd /dev/$1 && ls`" != ""
>      rc=$?
>      if [ $rc -ne 0 ]; then
>          ocf_exit_reason "VG $1 with no logical volumes is not supported by this RA!"
>      fi
> fi

<snip>

> I think it would be better to query the activity directly, using something like
> "lvs -o name,selected  -S lv_active=active,vg_name=<volume_group>"

I'm testing with the following code instead of the above snippet and it seems to work okay:

        # Ask lvm whether the volume group is active.  This maps to
        # the question "Are there any logical volumes that are active in
        # the specified volume group?".
        lvs --noheadings -o selected  -S lv_active=active,vg_name=${1}|grep -q 1
        if [ $? -ne 0 ]; then
                ocf_log $loglevel "LVM Volume $1 is not available (stopped)"
                rc=$OCF_NOT_RUNNING
        else
                rc=0
                case $(get_vg_mode) in
                1) # exclusive with tagging.
                        # If vg is running, make sure the correct tag is present. Otherwise we
                        # can not guarantee exclusive activation.
                        if ! check_tags; then


The alternative would be to leave the original snippet and add this test if the directory
is present.

Chris




More information about the Developers mailing list