Blob Blame History Raw
commit 44f59b0698a3d82d3362da4c68a0d188f14f97da
Author: Marek 'marx' Grac <mgrac@redhat.com>
Date:   Thu Oct 10 10:57:19 2013 +0200

    fencing: Add schema for fence agents metadata (relax ng)
    
    Add a metadata schema which reflects current state. In order to simplify it
    few minor changes were done to fence agents.

diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 3561456..83029e3 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -915,10 +915,11 @@ static void print_xml_metadata(char *pname) {
          "option (lanplus / -P) and increase wait after operation to "
          "4 seconds (power_wait=4 / -T 4)");
   printf("</longdesc>\n");
+  printf("<vendor-url>http://www.intel.com</vendor-url>\n");
   printf("%s\n","<parameters>");
 
   for (i=0;i<(sizeof(xml_parameters)/sizeof(struct xml_parameter_s));i++) {
-    printf("\t<parameter name=\"%s\" unique=\"0\">\n",xml_parameters[i].name);
+    printf("\t<parameter name=\"%s\" unique=\"0\" required=\"%d\">\n",xml_parameters[i].name, xml_parameters[i].required);
 
     printf("\t\t<getopt mixed=\"%s\" />\n",xml_parameters[i].getopt);
     if (xml_parameters[i].default_value == NULL) {
diff --git a/fence/agents/lib/metadata.rng b/fence/agents/lib/metadata.rng
new file mode 100644
index 0000000..2566fee
--- /dev/null
+++ b/fence/agents/lib/metadata.rng
@@ -0,0 +1,65 @@
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+
+<start><element name="resource-agent">
+	<attribute name="name" />
+	<attribute name="shortdesc" />
+
+	<zeroOrMore>
+		<element name="symlink">
+			<attribute name="name" />
+			<attribute name="shortdesc" />
+		</element>
+	</zeroOrMore>
+
+	<element name="longdesc"> <text /> </element>
+	<element name="vendor-url"> <text /> </element>
+
+	<element name="parameters"> <oneOrMore>
+		<element name="parameter">
+			<attribute name="name" />
+			<attribute name="unique"> <ref name="boolean-values" /> </attribute>
+			<attribute name="required"> <ref name="boolean-values" />  </attribute>
+
+			<element name="getopt">
+				<attribute name="mixed" />
+			</element>
+			<element name="content">
+				<attribute name="type">
+					<choice>
+						<value>boolean</value>
+						<value>string</value>
+					</choice>
+				</attribute>
+				<optional>
+					<attribute name="default"> <text /> </attribute>
+				</optional>
+			</element>
+
+			<oneOrMore> <element name="shortdesc">
+				<attribute name="lang" />
+				<text />
+			</element> </oneOrMore>
+		</element>
+	</oneOrMore> </element>
+
+	<element name="actions"> <oneOrMore>
+		<element name="action">
+			<attribute name="name" />
+			<optional>
+				<attribute name="on_target"> <ref name="boolean-values" /> </attribute>
+			</optional>
+			<optional>
+				<attribute name="automatic"> <ref name="boolean-values" /> </attribute>
+			</optional>
+		</element>
+	</oneOrMore> </element>
+</element></start>
+
+<define name="boolean-values">
+	<choice>
+		<value>0</value>
+		<value>1</value>
+	</choice>
+</define>
+
+</grammar>
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 9dc3e4d..6d2c649 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -133,6 +133,7 @@ def main():
 	docs = { }
 	docs["shortdesc"] = "Fence agent for IBM LPAR"
 	docs["longdesc"] = ""
+	docs["vendorurl"] = "http://www.ibm.com"
 	show_docs(options, docs)
 
 	if 0 == options.has_key("--managed"):
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 2585f9e..c959417 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -705,6 +705,7 @@ sub print_metadata ()
     print "<resource-agent name=\"fence_scsi\"" .
           " shortdesc=\"fence agent for SCSI-3 persistent reservations\">\n";
     print "<longdesc>fence_scsi</longdesc>\n";
+    print "<vendor-url>http://www.t10.org</vendor-url>\n";
     print "<parameters>\n";
     print "\t<parameter name=\"aptpl\" unique=\"0\" required=\"0\">\n";
     print "\t\t<getopt mixed=\"-a\"/>\n";
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index ccbd6e2..ac8dc7b 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -78,6 +78,7 @@ all work. \
 \n.P\n\
 By default, virsh needs root account to do properly work. So you \
 must allow ssh login in your sshd_config."
+	docs["vendorurl"] = "http://libvirt.org"
 	show_docs(options, docs)
 
 	## Operate the fencing device
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 7ba8533..064624a 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -214,6 +214,7 @@ It uses the XenAPI, supplied by Citrix, to establish an XML-RPC sesssion \
 to a XenServer host. Once the session is established, further XML-RPC \
 commands are issued in order to switch on, switch off, restart and query \
 the status of virtual machines running on the host." 
+	docs["vendorurl"] = "http://www.xenproject.org"
 	show_docs(options, docs)
 
 	xenSession = connect_and_login(options)
diff --git a/make/fenceman.mk b/make/fenceman.mk
index e6df9f0..d4f3b4e 100644
--- a/make/fenceman.mk
+++ b/make/fenceman.mk
@@ -2,6 +2,7 @@
 	set -e && \
 	PYTHONPATH=$(abs_srcdir)/../lib:$(abs_builddir)/../lib \
 		python $^ -o metadata > .$@.tmp && \
+	xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
 	xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
 
 clean-man:
diff --git a/make/fencemanc.mk b/make/fencemanc.mk
index 9c904b6..27e1aae 100644
--- a/make/fencemanc.mk
+++ b/make/fencemanc.mk
@@ -1,6 +1,7 @@
 %.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
 	set -e && \
 		./$^ -o metadata > .$@.tmp && \
+	xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
 	xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
 
 clean-man:
diff --git a/make/fencemanperl.mk b/make/fencemanperl.mk
index 74c1508..ed7c9cc 100644
--- a/make/fencemanperl.mk
+++ b/make/fencemanperl.mk
@@ -1,6 +1,7 @@
 %.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
 	set -e && \
 		perl $(TARGET) -o metadata > .$@.tmp && \
+	xmllint --noout --relaxng $(top_srcdir)/fence/agents/lib/metadata.rng .$@.tmp && \
 	xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
 
 clean-man: