cluster: RHEL6 - ccs_update_schema: relax requirements on fence-agents and resource-agents

Fabio M. Di Nitto fabbione at fedoraproject.org
Wed Jul 13 08:04:10 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d9368170f72b6a5763a1478170c428e87f0b863c
Commit:        d9368170f72b6a5763a1478170c428e87f0b863c
Parent:        9c0b853e2fd82d6439690e34c85b24570945acb9
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Mon Jul 11 11:23:44 2011 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Tue Jul 12 08:13:20 2011 +0200

ccs_update_schema: relax requirements on fence-agents and resource-agents

It is indeed possible to have clusters without fence or resource agents
installed. Config should still validate and relaxng be valid.

Resolves: rhbz#680930

Reviewed-by: Lon Hohberger <lhh at redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 config/tools/xml/ccs_update_schema.in |   66 +++++++++++++++++++++++++++++++--
 1 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/config/tools/xml/ccs_update_schema.in b/config/tools/xml/ccs_update_schema.in
index ce6cf8d..b01cd94 100644
--- a/config/tools/xml/ccs_update_schema.in
+++ b/config/tools/xml/ccs_update_schema.in
@@ -114,20 +114,53 @@ generate_hash() {
 	fi
 }
 
+create_ras_stubs() {
+	lecho " ras: cannot find rng files. Creating stubs"
+	touch "$outputdir/resources.rng.hash"
+	cat > "$outputdir/resources.rng.cache" << EOF
+<!-- STUB resource-agents definitions -->
+<define name="SERVICE">
+ <element name="service" rha:description="Stub service">
+  <optional>
+   <ref name="CHILDREN"/>
+  </optional>
+ </element>
+</define>
+<define name="VM" >
+ <element name="vm" rha:description="Stub VM">
+  <optional>
+   <ref name="CHILDREN"/>
+  </optional>
+ </element>
+</define>
+<define name="CHILDREN">
+ <zeroOrMore>
+  <choice>
+   <ref name="SERVICE"/>
+   <ref name="VM"/>
+  </choice>
+ </zeroOrMore>
+</define>
+<!-- end STUB resource-agents definitions -->
+EOF
+}
+
 generate_ras() {
 	outputdir="$1"
 	raslist=""
 
 	lecho " ras: checking required files"
 
+	doras_stub=""
 	for i in ra2rng.xsl ra2ref.xsl \
 		 resources.rng.head resources.rng.mid resources.rng.tail; do
 		if [ ! -f "$rngdir/$i" ]; then
-			echo "Unable to find $rngdir/$i" >&2
-			return 1
+			doras_stub=yes
 		fi
 	done
 
+	[ "$doras_stub" = yes ] && create_ras_stubs && return 0
+
 	lecho " ras: looking for agents"
 
 	if [ -d "$rasdir" ]; then
@@ -178,19 +211,44 @@ generate_ras() {
 	cat $rngdir/resources.rng.tail >> "$outputdir/resources.rng.cache"
 }
 
+create_fas_stubs() {
+	lecho " fas: cannot find rng files. Creating stubs"
+	touch "$outputdir/fence_agents.rng.hash"
+	cat > "$outputdir/fence_agents.rng.cache" << EOF
+<!-- STUB fence-agents definitions -->
+<define name="FENCEDEVICEOPTIONS">
+ <element name="service" rha:description="Stub fence device options">
+  <optional>
+   <ref name="STUBFENCEDEVICEOPTIONS"/>
+  </optional>
+ </element>
+</define>
+<define name="STUBFENCEDEVICEOPTIONS">
+ <zeroOrMore>
+  <choice>
+   <ref name="FENCEDEVICEOPTIONS"/>
+  </choice>
+ </zeroOrMore>
+</define>
+<!-- end STUB fence-agents definitions -->
+EOF
+}
+
 generate_fas() {
 	outputdir="$1"
 	faslist=""
 
 	lecho " fas: checking required files"
 
+	dofas_stub=""
 	for i in fence2rng.xsl fence.rng.head fence.rng.tail; do
 		if [ ! -f "$rngdir/$i" ]; then
-			echo "Unable to find $rngdir/$i" >&2
-			return 1
+			dofas_stub=yes
 		fi
 	done
 
+	[ "$dofas_stub" = yes ] && create_fas_stubs && return 0
+
 	lecho " fas: looking for agents"
 
 	if [ -d "$fasdir" ]; then


More information about the cluster-commits mailing list