[linux-lvm] ocf:lvm2:VolumeGroup RA Question

Marc Smith marc.smith at mcc.edu
Sun Sep 25 16:10:36 UTC 2016


Hi,

I'm using the "VolumeGroup" RA that comes with LVM2. On the machines
I'm testing with, we are currently using version 2_02_129 of LVM2.

My question is regarding this function in the VolumeGroup RA:

--snip--
VolumeGroup_status() {

    VGOUT=`vgdisplay -v $OCF_RESKEY_volgrpname 2>&1` || exit $OCF_ERR_GENERIC
    echo "$VGOUT" | grep -i 'Status[ \t]*available' >/dev/null
    rc=$?

    if [ $rc -eq 0 ]; then
    ocf_log debug "LVM Volume Group $OCF_RESKEY_volgrpname is
available (started)"
    else
    ocf_log debug "LVM Volume Group $OCF_RESKEY_volgrpname is not
available (stopped)"
    return $OCF_NOT_RUNNING
    fi

    if echo "$VGOUT" | grep -i 'Access.*read/write' >/dev/null; then
    ocf_log debug "Volume $OCF_RESKEY_volgrpname is available
read/write (running)"
    else
    ocf_log debug "Volume $OCF_RESKEY_volgrpname is available
read-only (running)"
    fi

    return $OCF_SUCCESS
}
--snip--

And what prompted me to question this function, is I noticed that
unless an LV is created on my VG, this function doesn't return
OCF_SUCCESS.

When looking at the vgdisplay output in the first few lines of the
function, there are several different output lines that contains the
string "Status" (assuming the command exists successfully):

# vgdisplay -v vmdk5 2>&1 | grep Status
  VG Status             resizable
  LV Status              available
  PV Status             allocatable

In the next line of the function where we grep for "Status" we don't
specify a specific line (eg, "VG Status", "LV Status", or "PV
Status").

My question is this: Is the intention that we only return OCF_SUCCESS
if a LV is available? In my setup, I'd like the resource to start/run
properly without having any LV created. Any harm in updating the RA to
look for "VG Status" and return success if it finds "resizable" -- I'm
not sure what the other status strings might be? Is "available" valid
for that line as well?


Thanks for your time.


--Marc




More information about the linux-lvm mailing list