Blame SOURCES/bz1022529-ensure_validity_of_xml_metadata-1.patch

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