Hi Dejan,
I send the patch which I thought about just to make sure.
Change 1) Changed validate-all to the parameter checks. And always call it.
Change 2) Chose vgck/vgdisplay by start processing and carried it out.
Best Regards,
Hideo Yamauchi.
--- On Mon, 2012/4/9, [email protected] <[email protected]>
wrote:
> Hi Dejan,
>
> Thank you for comments.
>
> > > I change validate-all and want to change it to always carry out
> > > validate-all.
> > > I abolish vgck/vgdisplay carried out in validate-all and intend to make
> > > only the check of the parameter simply.
> > >
> > > How do you think?
> >
> > Isn't it that validate-all may be really necessary only in the
> > start action? The repeating monitor is scheduled only after a
> > successful start.
>
> It may be surely necessary as you say.
> However, I think validate-all to unify it so that it is always carried out.
>
> How about what the check of vgck/vgdisplay chooses it in a parameter and can
> carry out?
>
>
> Best Regards,
> Hideo Yamauchi.
>
> --- On Fri, 2012/4/6, Dejan Muhamedagic <[email protected]> wrote:
>
> > Hi Hideo-san,
> >
> > On Fri, Apr 06, 2012 at 10:50:39AM +0900, [email protected] wrote:
> > > Hi Dejan,
> > >
> > > I change validate-all and want to change it to always carry out
> > > validate-all.
> > > I abolish vgck/vgdisplay carried out in validate-all and intend to make
> > > only the check of the parameter simply.
> > >
> > > How do you think?
> >
> > Isn't it that validate-all may be really necessary only in the
> > start action? The repeating monitor is scheduled only after a
> > successful start.
> >
> > Cheers,
> >
> > Dejan
> >
> > > Best Regards,
> > > Hideo Yamauchi.
> > >
> > > --- On Fri, 2012/4/6, Dejan Muhamedagic <[email protected]> wrote:
> > >
> > > > Hi Hideo-san,
> > > >
> > > > On Thu, Apr 05, 2012 at 11:32:05AM +0900, [email protected]
> > > > wrote:
> > > > > Hi Dejan,
> > > > >
> > > > > I agree to your patch.
> > > >
> > > > Thank you for the reply.
> > > >
> > > > BTW, the monitor was shamelessly stolen from Vladislav.
> > > >
> > > > Applied.
> > > >
> > > > ocft test passed (after some struggle and eventually fixing the
> > > > ocft source).
> > > >
> > > > Cheers,
> > > >
> > > > Dejan
> > > >
> > > > > Best Regards,
> > > > > Hideo Yamauchi.
> > > > >
> > > > > --- On Thu, 2012/4/5, Dejan Muhamedagic <[email protected]> wrote:
> > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > This is a proposed set of two patches which would eliminate use
> > > > > > of LVM commands in the monitor path. We already discussed the
> > > > > > issue elsewhere and I don't see any point in keeping
> > > > > > vgck/vgdisplay given that they don't result in better monitoring
> > > > > > under normal circumstances. And if the circumstances are such
> > > > > > that the new monitoring fails, I think that there'll be many
> > > > > > more problems on the node than a failed volume group.
> > > > > >
> > > > > > Cheers,
> > > > > >
> > > > > > Dejan
> > > > > >
> > > > > _______________________________________________________
> > > > > Linux-HA-Dev: [email protected]
> > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > Home Page: http://linux-ha.org/
> > > > _______________________________________________________
> > > > Linux-HA-Dev: [email protected]
> > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > Home Page: http://linux-ha.org/
> > > >
> > > _______________________________________________________
> > > Linux-HA-Dev: [email protected]
> > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > Home Page: http://linux-ha.org/
> >
> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
diff -r 730a17fbd770 heartbeat/LVM
--- a/heartbeat/LVM Mon Apr 09 08:53:13 2012 +0900
+++ b/heartbeat/LVM Mon Apr 09 08:54:04 2012 +0900
@@ -87,6 +87,14 @@
logical volumes.
</longdesc>
<shortdesc lang="en">Activate VG even with partial PV only</shortdesc>
+<content type="string" default="false" />
+</parameter>
+
+<parameter name="detail_volume_check" unique="0" required="0">
+<longdesc lang="en">
+If set, carry out the detailed volume check by the vgck/vgdisplay command at
the time of starting.
+</longdesc>
+<shortdesc lang="en">Details volume check</shortdesc>
<content type="string" default="false" />
</parameter>
@@ -219,6 +227,10 @@
ocf_run vgchange $vgchange_options $1 || return $OCF_ERR_GENERIC
if LVM_status $1; then
+ if ocf_is_true "$OCF_RESKEY_detail_volume_check" ; then
+ # Detailed volume check
+ LVM_volume_check_detail || return $OCF_NOT_RUNNNING
+ fi
: OK Volume $1 activated just fine!
return $OCF_SUCCESS
else
@@ -256,13 +268,60 @@
#
LVM_validate_all() {
check_binary $AWK
+ check_binary vgscan
+ check_binary vgck
+ check_binary vgdisplay
+ check_binary vgchange
+
+ if
+ [ -z "$OCF_RESKEY_volgrpname" ]
+ then
+ ocf_log err "You must identify the volume group name!"
+ return $OCF_ERR_CONFIGURED
+ fi
+
+ # Get the LVM version number, for this to work we assume(thanks to panjiam):
+ #
+ # LVM1 outputs like this
+ #
+ # # vgchange --version
+ # vgchange: Logical Volume Manager 1.0.3
+ # Heinz Mauelshagen, Sistina Software 19/02/2002 (IOP 10)
+ #
+ # LVM2 and higher versions output in this format
+ #
+ # # vgchange --version
+ # LVM version: 2.00.15 (2004-04-19)
+ # Library version: 1.00.09-ioctl (2004-03-31)
+ # Driver version: 4.1.0
+
+ LVM_VERSION=`vgchange --version 2>&1 | \
+ $AWK '/Logical Volume Manager/ {print $5"\n"; exit; }
+ /LVM version:/ {printf $3"\n"; exit;}'`
+ rc=$?
+
+ if
+ ( [ $rc -ne 0 ] || [ -z "$LVM_VERSION" ] )
+ then
+ ocf_log err "LVM: $1 could not determine LVM version. Try 'vgchange
--version' manually and modify $0 ?"
+ return $OCF_ERR_INSTALLED
+ fi
+ LVM_MAJOR="${LVM_VERSION%%.*}"
+
+ return $OCF_SUCCESS
+}
+
+#
+# Detailed volume check
+#
+LVM_volume_check_detail() {
# Off-the-shelf tests...
VGOUT=`vgck ${VOLUME} 2>&1`
if [ $? -ne 0 ]; then
ocf_log err "Volume group [$VOLUME] does not exist or contains error!
${VGOUT}"
- exit $OCF_ERR_GENERIC
+ return $OCF_ERR_GENERIC
fi
# Double-check
@@ -276,7 +335,7 @@
if [ $? -ne 0 ]; then
ocf_log err "Volume group [$VOLUME] does not exist or contains error!
${VGOUT}"
- exit $OCF_ERR_GENERIC
+ return $OCF_ERR_GENERIC
fi
return $OCF_SUCCESS
@@ -304,40 +363,8 @@
*) ;;
esac
-if
- [ -z "$OCF_RESKEY_volgrpname" ]
-then
- ocf_log err "You must identify the volume group name!"
- exit $OCF_ERR_CONFIGURED
-fi
-
-# Get the LVM version number, for this to work we assume(thanks to panjiam):
-#
-# LVM1 outputs like this
-#
-# # vgchange --version
-# vgchange: Logical Volume Manager 1.0.3
-# Heinz Mauelshagen, Sistina Software 19/02/2002 (IOP 10)
-#
-# LVM2 and higher versions output in this format
-#
-# # vgchange --version
-# LVM version: 2.00.15 (2004-04-19)
-# Library version: 1.00.09-ioctl (2004-03-31)
-# Driver version: 4.1.0
-
-LVM_VERSION=`vgchange --version 2>&1 | \
- $AWK '/Logical Volume Manager/ {print $5"\n"; exit; }
- /LVM version:/ {printf $3"\n"; exit;}'`
-rc=$?
-
-if
- ( [ $rc -ne 0 ] || [ -z "$LVM_VERSION" ] )
-then
- ocf_log err "LVM: $1 could not determine LVM version. Try 'vgchange
--version' manually and modify $0 ?"
- exit $OCF_ERR_INSTALLED
-fi
-LVM_MAJOR="${LVM_VERSION%%.*}"
+# Everything except usage and meta-data must pass the validate test
+LVM_validate_all || exit $?
VOLUME=$OCF_RESKEY_volgrpname
OP_METHOD=$1
@@ -357,7 +384,7 @@
exit $?;;
validate-all) LVM_validate_all
- ;;
+ exit $?;;
*) usage
exit $OCF_ERR_UNIMPLEMENTED;;
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/