>>> Dejan Muhamedagic <[email protected]> schrieb am 05.07.2011 um 17:16 in
Nachricht <20110705151610.GA3822@squib>:
[...]

> > Now the funny thing is that you cahnged the DTD in an incompatible way 
> without changing the version number. That's very bad practice!
> 
> You're right, the version should've been changed. But, to the
> best of my knowledge, the dtd at www.opencf.org has never been
> used.

After searching for the fil in github without success, I found an easier way:
# rpm -ql resource-agents |grep dtd
/usr/share/resource-agents/ra-api-1.dtd

And for the records, here are the diffs between the old and the new version:
--- RA-API/ra-api-1.dtd 2011-07-06 08:38:33.000000000 +0200
+++ /usr/share/resource-agents/ra-api-1.dtd     2011-03-10 15:41:33.000000000 
+0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>

-<!ELEMENT resource-agent (version,parameters,actions,special) >
+<!ELEMENT resource-agent (version,longdesc,shortdesc,parameters?,actions) >
 <!ATTLIST resource-agent
          name  CDATA   #REQUIRED
          version CDATA   #IMPLIED>
@@ -14,6 +14,7 @@
 <!ELEMENT parameter (longdesc+,shortdesc+,content)>
 <!ATTLIST parameter
          name  CDATA   #REQUIRED
+        required  (1|0)   "0"
          unique        (1|0)   "0">

 <!ELEMENT longdesc ANY>
@@ -26,18 +27,14 @@

 <!ELEMENT content EMPTY>
 <!ATTLIST content
-         type  (string|integer|boolean)        #REQUIRED
+        type    (string|integer|boolean|time)        #REQUIRED
          default CDATA                         #IMPLIED>

 <!ELEMENT action EMPTY>
 <!ATTLIST action
-         name  (start|stop|recover|status|reload|meta-data|verify-all) 
#REQUIRED
+        name 
(start|stop|recover|monitor|restart|migrate_to|migrate_from|promote|demote|notify|status|reload|meta-data|usage|methods|validate-all)
 #REQUIRED
          timeout                                                              
CDATA    #REQUIRED
          interval                                                             
CDATA    #IMPLIED
          start-delay                                                          
CDATA    #IMPLIED
+        role            CDATA   #IMPLIED
          depth                                                                
CDATA    #IMPLIED>
-
-<!ELEMENT special ANY>
-<!ATTLIST special
-         tag   CDATA   #REQUIRED>
-


Still the DTD lacks comments to describe the semantics of the elements. For 
inspiration, you might look at the XHTML DTD (just one example):
<!-- attributes for elements that can get the focus
  accesskey   accessibility key character
  tabindex    position in tabbing order
  onfocus     the element got the focus
  onblur      the element lost the focus
-->
<!ENTITY % focus
 "accesskey   %Character;    #IMPLIED
  tabindex    %Number;       #IMPLIED
  onfocus     %Script;       #IMPLIED
  onblur      %Script;       #IMPLIED"
  >

While we are at it: The current specification seems to require "promote" and 
"demote":

($Id: ocf-tester,v 1.2 2006/08/14 09:38:20 andrew Exp $)
Beginning tests for ./whatever...
WARN: Can't check agent's permissions because we're not root; they should be 755
* rc=7: Monitoring an active resource should return 0
* rc=2: The notify action cannot fail and must return 0
* rc=2: Demoting a start resource should not fail
* rc=2: Promote failed
* rc=2: Demote failed
whatever[13899]: ERROR: ./saprouter demote not implemented
Aborting tests

The "Dummy RA" however doesn't provide those. Also the docs (dev-guides) 
(section 5.6) says the "promote" is optional. Also, I don't see why a non-root 
user cannot check the numeric file permissions of the RA. While wondering, I 
found the test being implemented as "su nobody -s /bin/sh $agent $action > 
/dev/null". In SLES there is a command "stat -c %a file" to print the octal 
file permissions. Why not use that? Requiring to be root, just to switch to a 
non-root user is somewhat strange.

I just found out that the RA dispatcher must return 3 (not 2) for unimplemented 
methods. Of course it would be better if the ocf-tester would actually consider 
the meta-data XML actions before trying to start them.

For fun I checked the RAs provided with the system (SLES11 SP1), and I found 
one bad RA:
/usr/lib/ocf/resource.d/heartbeat/SAPInstance
-:139: element resource-agent: validity error : Element resource-agent content 
does not follow the DTD, expecting (version , longdesc , shortdesc , 
parameters? , actions), got (version shortdesc longdesc parameters actions )
</resource-agent>
                 ^

Any advice on writing a correct RA? (Actually I managed to make my RA pass the 
ocf-tester in the meantime)

Reagrds,
Ulrich

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to