[Pacemaker] crmsh resource update issue

Vladislav Bogdanov bubble at hoster-ok.com
Tue Oct 2 12:41:32 UTC 2012


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.
It is a little bit intrusive, but I'm definitely not a python coder :)
You can just take it as a reference.

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()
-    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
             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




More information about the Pacemaker mailing list