Re: [Pacemaker] About a combination with OpenAIS.

2009-06-11 Thread Steven Dake
On Thu, 2009-06-11 at 12:30 +0200, Dejan Muhamedagic wrote:
> Hi Hideo-san,
> 
> On Thu, Jun 11, 2009 at 03:17:08PM +0900, renayama19661...@ybb.ne.jp wrote:
> > Hi,
> > 
> > I understood the cause of the problem.
> > 
> > An init script in WhiteTank was a problem.
> > I work definitely when I use an init script for Pacemaker which Mr. Andrew 
> > made.
> > 
> > I hope a right init script to be included.
> 
> Perhaps you would be better off with the versions released by
> Andrew (from the OBS). I'm not sure myself, it's just that
> openais API was moving until recently, so it may be a problem to
> match releases. Of course, if this combination works for you
> then it's fine.
> 
> Thanks,
> 
> Dejan
> 

The openais whitetank abi hasn't changed much for years. The init script
could be a problem however.  Is there a special version required by Suse
linux?  I thought we had all the proper init scripts upstream to work
with Pacemaker and SUSE.

Thanks
-steve



___
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker


Re: [Pacemaker] how to determin crm version / features from within a RA

2009-06-11 Thread Lars Ellenberg
attaching revised generic shell level version compare scriptlet
plus cib/crm detection logic.

hopefully it is more less instransparent what is going on now,
and clear why the eval for the cibadmin -Ql | sed thingy is ok.

the shell version compare may be useful for inclusion into the
"ocf" shell function library -- if it turns out to even work on
non-linux shell, sed and sort ;)
whatever it is good for.

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
#!/bin/sh

# two parameters
# version1 version2
# return value:
# 0: version1 = version2 by string compare
# 1: version1 < version2 by "version compare"
# 2: version1 > version2 by "version compare"
# 3: something in that funny little tr + sed + sort construct went wrong
version_cmp()
{
# make both version parameters start non-numeric
local v1="$1" v2="$2" result l sed_script sort_keys

# short cut
if [ "x$v1" = "x$v2" ]; then
return 0
fi

# strip leading and trailing spaces.
# all embeded spaces to underscores.
# versions should not contain spaces!
# insert spaces separators around numeric values
sed_script="s/^ *//; s/ *$//;s/ /_/g; s/[0-9]\+/ & /g"
# tr to strip newlines in arguments, even though you should not call
# this function with embeded newlines in arguments!

v1=$(echo "$v1" | tr '\n' ' ' | sed -e "$sed_script")
v2=$(echo "$v2" | tr '\n' ' ' | sed -e "$sed_script")
set -- $v1 x
l=$#
set -- $v2 x
if [ $l -lt $# ] ; then l=$#; fi
# $v1 and $v2 contain space separated alternating non-numeric and
# numeric parts, starting with a non-numeric one, which possibly
# is empty; therefore the extra 'x' on the set -- lines above.
# $l now contains the maximum "column" number.
# generate that many sort key arguments:
# -k1,1 -k2,2n -k3,3 -k4,4n -k5,5 ...
sort_keys=$(seq $l | sed -e 's/.*/ -k&,&/;2~2 s/$/n/')

# capture which value sort places in the first line.
# the -s is "stabilize", and should actually not be neccessary
result=$( ( echo "$v1" ; echo "$v2" ) |
LANG=C LC_ALL=C sort -t " " -s $sort_keys |
head -n1)
case "$result" in
"$v1")
return 1;; # v1 < v2
"$v2")
return 2;; # v2 < v1
*)
return 3;; # oops, what happened here?
esac
}

# for those that rather have a boolean result
# three parameters
# compare_version $v1 $op $v2
# where op is one of lt|le|eq|ge|gt
# return value:
# 0: requested relation evaluates to true
# 1: requested relation evaluates to false
# anything else: problem evaluating expression
compare_versions()
{
local v1="$1" op="$2" v2="$3" rc

case "$op" in
lt|le|eq|ge|gt)
:;;
*)
echo >&2 "bad relation '$op'"
return 2
;;
esac

version_cmp "$v1" "$v2"
rc=$?
case $rc in
0)
case "$op" in
eq|[lg]e)
return 0;;
*)
return 1;;
esac;;
1)
case "$op" in
l[te])
return 0;;
*)
return 1;;
esac ;;
2)
case "$op" in
g[te])
return 0;;
*)
return 1;;
esac ;;
*)
return $rc ;;
esac
}

 excercise it:
# version_cmp "$1" "$2"
# case $? in
#   0) echo "'$1' = '$2'" ;;
#   1) echo "'$1' < '$2'" ;;
#   2) echo "'$1' > '$2'" ;;
#   *) echo "something went wrong: '$1' =?= '$2'" ;;
# esac
# version compare ends

# now use it.
# does not yet evaluate _CIB_VALIDATE_WITH, but we could trigger on it.
#
_DC_VERSION=""
_CIB_VALIDATE_WITH=""
eval $(cibadmin -Ql |
sed -n -e '/^/q;' \
-e '
# find the right nvpair,
# capture the first part of its value into a variable assignment
# no need to quote [0-9.:]
/^[[:space:]]*&2 "problem reading cib :("
exit 1;;
2.*)_DC_VERSION=0:$_DC_VERSION;;
1.*)_DC_VERSION=1:$_DC_VERSION;;
esac

required_crm_version=0:2.1.3
if compare_versions $_DC_VERSION lt $required_crm_version ; then
echo "sorry, I need a $required_crm_version crm"
exit 1
else
echo "fine, $_DC_VERSION is newer than required $required_crm_version 
crm version"
fi
___
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker


Re: [Pacemaker] how to determin crm version / features from within a RA

2009-06-11 Thread Dejan Muhamedagic
On Wed, Jun 10, 2009 at 08:44:20PM +0200, Lars Ellenberg wrote:
> On Wed, Jun 10, 2009 at 04:42:32PM +0200, Dejan Muhamedagic wrote:
> > On Wed, Jun 10, 2009 at 04:26:31PM +0200, Andrew Beekhof wrote:
> > > On Wed, Jun 10, 2009 at 3:53 PM, Lars
> > > Ellenberg wrote:
> > > > taking this to the pacemaker list...
> > > >
> > > > On Wed, Jun 10, 2009 at 02:53:24PM +0200, Andrew Beekhof wrote:
> > > >> since 1.0.4, giving --version to almost any of the crm tools will give
> > > >> you the current version number.
> > > >> it also includes the supported stacks and (if built correctly) the Hg
> > > >> changeset used.
> > > >
> > > > unfortunately all of them also print the full help text to stdout
> > > 
> > > They dont here...
> > > Were the packages built with getopt-long?
> > > 
> > > > _and_ exit 0 for unrecognized options.
> > > 
> > > Ok, thats bad.  I'll get that fixed.  (I can see this part locally too)
> > > 
> > > > so I need to parse the output to see if I actually got the version,
> > > > and which one.
> > > >
> > > > maybe I can go for the dc-version?
> > > >
> > > > but wait:
> > > > cibadmin -Ql -o crm_config | grep cib-bootstrap-options-dc-version
> > > >
> > > > pacemaker:
> > > >  > > > value="1.0.4-3917b11b3a14+ stable-1.0 tip"/>
> > > > heartbeat 2.1.4:
> > > >  > > > value="2.1.4-node: --node-hash--"/>
> > > >
> > > > darn.
> > > > special case version compare:
> > > > ?1 > 2 for extremly legacy values of 2.
> > > 
> > > I think its going to be many years before we see a pacemaker version
> > > starting with 2.
> > > So thats a valid pacemaker/legacy check.
> > > 
> > > > so...
> > > > what is the most easy way to reliably distinguish
> > > > legacy heartbeat crm 2.0.7, 2.0.8, 2.1.3, 2.1.4
> > > > pacemaker crm 0.6, 1.0, 1.x, 2.y (once it is there)
> > > > regardless of cluster stack?
> > > >
> > > > or more specifically, I'd like to be able to see am I running on legacy
> > > > heartbeat crm, or pacemaker crm, and then "require" a version. ?I don't
> > > > really care for what comm layer is in use.
> > > 
> > > crmadmin has always supported the --version option, so i think parsing
> > > that is one option.
> > > and if its not working correctly now, then I'll get it fixed for the
> > > next version.
> > > 
> > > the other alternative is to set what value CRM_FEATURE_SET had at the
> > > time of the various releases and look for the reskey meta feature set
> > > thingy in the RA.
> > > it changed reasonably often in the early days and was definitely bumped 
> > > for 1.0
> > 
> > IIRC, you also mentioned that the validate-with attribute is only
> > available as of pacemaker 1.x. That's what I used in the crm
> > shell.
> 
> great.

:-D

> so, to summarize, I hacked up a compare_version.
> and I think I even avoided bashisms! that is once in a life time :)

Exemplary ;-)

> comments?
> overkill?
> useful?

Yes. Unfortunately, the thing got quite complicated. Some
comments:

sort_keys=$(seq $l | sed -e 's/.*/ -k&,&/;2~2 s/$/n/')

Won't even try to unravel this magic.

eval $(cibadmin -Ql |
sed -n -e '1 s/^http://www.linbit.com
> 
> DRBD? and LINBIT? are registered trademarks of LINBIT, Austria.


> ___
> Pacemaker mailing list
> Pacemaker@oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker


___
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker


Re: [Pacemaker] About a combination with OpenAIS.

2009-06-11 Thread Dejan Muhamedagic
Hi Hideo-san,

On Thu, Jun 11, 2009 at 03:17:08PM +0900, renayama19661...@ybb.ne.jp wrote:
> Hi,
> 
> I understood the cause of the problem.
> 
> An init script in WhiteTank was a problem.
> I work definitely when I use an init script for Pacemaker which Mr. Andrew 
> made.
> 
> I hope a right init script to be included.

Perhaps you would be better off with the versions released by
Andrew (from the OBS). I'm not sure myself, it's just that
openais API was moving until recently, so it may be a problem to
match releases. Of course, if this combination works for you
then it's fine.

Thanks,

Dejan

> Regards,
> Hideo Yamauchi.
> 
> --- renayama19661...@ybb.ne.jp wrote:
> 
> > Hi,
> > 
> > I am going to check the operation by a combination of Pacemaker and OpenAIS.
> > 
> > In reference to a page(http://www.clusterlabs.org/wiki/Install), I made 
> > environment from a
> > source.
> > 
> > The source which I used was the following versions.
> >  * OpenAIS(http://svn.fedorahosted.org/svn/openais/branches/whitetank) - I 
> > got it today.
> >  * Pacemaker(Pacemaker-1-0-c2853a7fed2e.tar.bz2) - I got it today.
> > 
> > I made environment and, in one node, started a Dummy resource.
> > I shutdown this node, but the Dummy resource was not stopped.
> > 
> > The following log appeared then.
> > ---
> > Jun 11 14:11:14 ais-1 attrd: [23142]: ERROR: ais_dispatch: Receiving 
> > message body failed: (-1)
> > unknown: Resource temporarily unavailable (11)
> > Jun 11 14:11:14 ais-1 attrd: [23142]: ERROR: ais_dispatch: AIS connection 
> > failed
> > Jun 11 14:11:14 ais-1 attrd: [23142]: CRIT: attrd_ais_destroy: Lost 
> > connection to OpenAIS
> > service!
> > Jun 11 14:11:14 ais-1 attrd: [23142]: info: main: Exiting...
> > Jun 11 14:11:14 ais-1 attrd: [23142]: ERROR: attrd_cib_connection_destroy: 
> > Connection to the CIB
> > terminated...
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: attrd_connection_destroy: Lost 
> > connection to attrd
> > Jun 11 14:11:14 ais-1 cib: [23140]: ERROR: ais_dispatch: Receiving message 
> > body failed: (-1)
> > unknown:
> > Resource temporarily unavailable (11)
> > Jun 11 14:11:14 ais-1 cib: [23140]: ERROR: ais_dispatch: AIS connection 
> > failed
> > Jun 11 14:11:14 ais-1 cib: [23140]: ERROR: cib_ais_destroy: AIS connection 
> > terminated
> > Jun 11 14:11:14 ais-1 mgmtd: [23145]: CRIT: cib_native_dispatch: Lost 
> > connection to the CIB
> > service
> > [23140/callback].
> > Jun 11 14:11:14 ais-1 mgmtd: [23145]: CRIT: cib_native_dispatch: Lost 
> > connection to the CIB
> > service
> > [23140/command].
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: cib_native_msgready: Lost 
> > connection to the CIB
> > service
> > [23140].
> > Jun 11 14:11:14 ais-1 stonithd: [23139]: ERROR: ais_dispatch: Receiving 
> > message body failed:
> > (-1)
> > unknown: Resource temporarily unavailable (11)
> > Jun 11 14:11:14 ais-1 crmd: [23144]: CRIT: cib_native_dispatch: Lost 
> > connection to the CIB
> > service
> > [23140/callback].
> > Jun 11 14:11:14 ais-1 stonithd: [23139]: ERROR: ais_dispatch: AIS 
> > connection failed
> > Jun 11 14:11:14 ais-1 crmd: [23144]: CRIT: cib_native_dispatch: Lost 
> > connection to the CIB
> > service
> > [23140/command].
> > Jun 11 14:11:14 ais-1 stonithd: [23139]: ERROR: AIS connection terminated
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: crmd_cib_connection_destroy: 
> > Connection to the CIB
> > terminated...
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: do_log: FSA: Input I_ERROR from
> > crmd_cib_connection_destroy() received in state S_IDLE
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: do_state_transition: State 
> > transition S_IDLE ->
> > S_RECOVERY
> > [ input=I_ERROR cause=C_FSA_INTERNAL origin=crmd_cib_connection_destroy ]
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: do_recover: Action A_RECOVER 
> > (0100) not
> > supported
> > Jun 11 14:11:14 ais-1 crmd: [23144]: WARN: do_election_vote: Not voting in 
> > election, we're in
> > state
> > S_RECOVERY
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: do_dc_release: DC role released
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: pe_connection_destroy: 
> > Connection to the Policy
> > Engine
> > released
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: do_te_control: Transitioner is 
> > now inactive
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: do_te_control: Disconnecting 
> > STONITH...
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: 
> > tengine_stonith_connection_destroy: Fencing daemon
> > disconnected
> > Jun 11 14:11:14 ais-1 crmd: [23144]: notice: Not currently connected.
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: do_log: FSA: Input I_TERMINATE 
> > from do_recover()
> > received
> > in state S_RECOVERY
> > Jun 11 14:11:14 ais-1 crmd: [23144]: info: do_state_transition: State 
> > transition S_RECOVERY ->
> > S_TERMINATE [ input=I_TERMINATE cause=C_FSA_INTERNAL origin=do_recover ]
> > Jun 11 14:11:14 ais-1 crmd: [23144]: ERROR: verify_stopped: Resou