Hi,
On Thu, Mar 19, 2009 at 01:21:30PM +0100, Dominik Klein wrote:
> Dejan Muhamedagic wrote:
> > Hi,
> >
> > On Wed, Mar 18, 2009 at 11:37:27AM -0700, Neil Katin wrote:
> >>
> >> Dejan Muhamedagic wrote:
> >>> Hi,
> >>>
> >>> On Tue, Mar 17, 2009 at 11:56:04AM +0530, Arun G wrote:
> >>>> Hi,
> >>>> I observed below error message when I upgraded drbd to drbd-8.3.0 in
> >>>> heartbeat 2.1.4 cluster on 2.6.18-8.el5xen.
> >> -- snip --
> >>
> >>> Thanks for the patch. But do all supported drbd versions have the
> >>> role command?
> >>>
> >>> Thanks,
> >>>
> >>> Dejan
> >> No, only 8.3 has the change. 8.2 supports the old "state" argument, but
> >> prints a warning message out, and this warning message upsets the drbd OCF
> >> scripts parting of drbdadm's output.
> >
> > Since versions before 8.3 don't have the role command, I suppose
> > that 8.3 actually prints the warning.
> >
> >> drbdadm doesn't support a --version argument, but it does support a
> >> "status"
> >> command, which has version info in it. However, I am not sure if "drbdadm
> >> status"
> >> is guaranteed to not block or not, so I didn't want to have the OCF script
> >> depend
> >> on it.
> >
> > drbdadm | grep Version
> >
> > works for 8.2.7 and 8.0.14, so I guess that it is available in
> > other versions too.
> >
> >> So, I see three alternatives: add a new script "drbdadm8.3". Add an extra
> >> parameter
> >> saying "use role instead of status". Or call "drbdadm status" to
> >> dynamically detect
> >> our version.
> >>
> >> Do you see other choices? Do you have a preference for a particular
> >> alternative?
> >> I'm willing to code and test the patch if we can decide what we want.
> >
> > Let's see if we can figure out the version. Adding new RA would
> > be a maintenance issue. Adding new parameter would make
> > configuration depend on particular release.
> >
> > We could do something like this:
> >
> > drbdadm | grep Version | awk '{print $2}' |
> > awk -F. '
> > $1 != 8 { exit 2; }
>
> This should also allow version 7. People may still use v7. The drbdadm |
> grep thing also works. Tested with latest v7 in a vm.
>
> It prints
>
> # drbdadm | grep Version | awk '{print $2}'
> 0.7.25
>
> though.
OK. Can somebody please test the patch (attached).
Thanks,
Dejan
> Regards
> Dominik
diff -r 7b68f335ad30 resources/OCF/drbd
--- a/resources/OCF/drbd Tue Mar 24 14:48:41 2009 +0100
+++ b/resources/OCF/drbd Tue Mar 24 15:30:58 2009 +0100
@@ -232,9 +232,38 @@
return 1
}
-
+get_drbd_ver() {
+ # returns 2 for unsupported (not 0.7.x or < 8.x)
+ # returns 1 for versions prior to 8.3.x
+ # returns 0 otherwise
+ drbdadm | grep Version | awk '{print $2}' |
+ awk -F. '
+ {
+ if( $1 == "0" ) # 0.7.x
+ { v1 = $2; v2 = $3; }
+ else
+ { v1 = $1; v2 = $2; }
+ }
+ v1 < 7 { exit 2; }
+ v1 == 7 || (v1 == 8 && v2 < 3) { exit 1; } # use status
+ # otherwise use role
+ '
+}
+get_status_cmd() {
+ get_drbd_ver
+ rc=$?
+ if [ $rc -ge 2 ]; then
+ ocf_log err "Cannot parse output of 'drbdadm | grep Version'"
+ exit $OCF_ERR_GENERIC
+ elif [ $rc -eq 1 ]; then
+ echo status
+ else
+ echo role
+ fi
+}
drbd_get_status() {
- DRBD_STATE=$(do_drbdadm state $RESOURCE)
+ cmd=`get_status_cmd`
+ DRBD_STATE=$(do_drbdadm "$cmd" $RESOURCE)
DRBD_STATE_LOCAL=$(echo $DRBD_STATE | sed -e 's#/.*##')
DRBD_STATE_REMOTE=$(echo $DRBD_STATE | sed -e 's#.*/##')
DRBD_CSTATE=$(do_drbdadm cstate $RESOURCE)
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems