[Pacemaker] crmsh resource update issue

Dejan Muhamedagic dejanmm at fastmail.fm
Tue Oct 2 14:40:39 UTC 2012


Hi,

On Tue, Oct 02, 2012 at 03:41:32PM +0300, Vladislav Bogdanov wrote:
> Hi Dejan,
> 
> 28.09.2012 14:07, Dejan Muhamedagic wrote:
> ...
> > 
> > OK. Silly me. Sorry for the non-vi users ;-) Thanks for the
> > patch!
> > 
> > Dejan
> > 
> 
> One more patch to fix lrmadmin disfunction with 1.1.8.

But this fixes support for RH fence-agents, if I'm not wrong.

> It is a little bit intrusive, but I'm definitely not a python coder :)

That's no problem.

> You can just take it as a reference.

Definitely useful. Thanks!

> diff -urNp a/modules/ra.py b/modules/ra.py
> --- a/modules/ra.py     2012-09-13 12:47:48.000000000 +0000
> +++ b/modules/ra.py     2012-09-27 08:01:19.965097194 +0000
> @@ -76,7 +70,10 @@ class RaOS(object):
>              l = stdout2list("%s/resource.d/%s/%s meta-data" % \
>                  (os.environ["OCF_ROOT"],ra_provider,ra_type))
>          elif ra_class == "stonith":
> -            l = stdout2list("stonith -m -t %s" % ra_type)
> +            if ra_type.startswith("fence_") and os.path.exists("/usr/sbin/%s" %  ra_type):
> +                l = stdout2list("/usr/sbin/%s -o metadata" % ra_type)
> +            else:
> +                l = stdout2list("stonith -m -t %s" % ra_type)

>          return l
>      def providers(self, ra_type,ra_class = "ocf"):
>          'List of providers for a class:type.'
> @@ -97,8 +103,13 @@ class RaOS(object):
>              l = os_types_list("/etc/init.d/*")
>          elif ra_class == "stonith":
>              l = stdout2list("stonith -L")
> +            l.extend(os_types_list("/usr/sbin/fence_*"))
>          l = list(set(l))
>          l.sort()
> +        if ra_class == "stonith":
> +            for ra in ("fence_ack_manual", "fence_pcmk", "fence_legacy"):
> +                if l.count(ra):
> +                    l.remove(ra)
>          return l
>  
>  def can_use_lrmadmin():
> @@ -114,10 +124,8 @@ def can_use_lrmadmin():
>  def ra_if():
>      if vars.ra_if:
>          return vars.ra_if
> -    if can_use_lrmadmin():
> -        vars.ra_if = RaLrmd()

There's actually a point in using lrmadmin/lrmd because lrmd used
to provide the meta-data for lsb class.

> -    if not vars.ra_if or not vars.ra_if.good:
> -        vars.ra_if = RaOS()
> +
> +    vars.ra_if = RaOS()
>      return vars.ra_if
>  
>  def ra_classes():
> @@ -458,11 +466,16 @@ class RAInfo(object):
>                  if p in self.skip_op_attr:
>                      continue
>                  n_ops[n_op][p] = v
> +
>          for req_op in self.required_ops:
>              if req_op not in n_ops:
> -                n_ops[req_op] = {}
> +                if not (self.ra_class == "stonith" and op in ("start", "stop")):
> +                    n_ops[req_op] = {}
> +
>          intervals = {}
>          for op in n_ops:
> +            if self.ra_class == "stonith" and op in ("start", "stop"):
> +                continue

Cool!

Many thanks!

Cheers,

Dejan

>              if op not in self.actions():
>                  common_warn("%s: action %s not advertised in meta-data, it may not be supported by the RA" % (id,op))
>                  rc |= 1
> ---
> 
> Best,
> Vladislav
> 
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> 
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list