Fix <cpu> element in domain XML schema

The current schema is more permissive than the XML parsing code in
libvirt. Precisely, 'match' attribute is optional in schema while in
reality its use is bound to <model> element:

- <cpu> element without 'match' attribute is allowed only if <topology>
  element is the only child element of <cpu>

- <cpu> element with 'match' attribute requires <model> element to be
  present; <topology> and <feature> elements are optional

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2010-02-09 15:53:03 +01:00
parent 6daa19da9a
commit 2073ed6f20

View File

@ -1313,52 +1313,69 @@
--> -->
<define name="cpu"> <define name="cpu">
<element name="cpu"> <element name="cpu">
<optional> <choice>
<attribute name="match"> <ref name="cpuTopology"/>
<choice> <group>
<value>minimum</value> <ref name="cpuMatch"/>
<value>exact</value> <interleave>
<value>strict</value> <ref name="cpuModel"/>
</choice> <optional>
</attribute> <ref name="cpuTopology"/>
</optional> </optional>
<interleave> <zeroOrMore>
<optional> <ref name="cpuFeature"/>
<element name="model"> </zeroOrMore>
<text/> </interleave>
</element> </group>
</optional> </choice>
<optional> </element>
<element name="topology"> </define>
<attribute name="sockets">
<ref name="positiveInteger"/> <define name="cpuMatch">
</attribute> <attribute name="match">
<attribute name="cores"> <choice>
<ref name="positiveInteger"/> <value>minimum</value>
</attribute> <value>exact</value>
<attribute name="threads"> <value>strict</value>
<ref name="positiveInteger"/> </choice>
</attribute> </attribute>
</element> </define>
</optional>
<zeroOrMore> <define name="cpuModel">
<element name="feature"> <element name="model">
<attribute name="policy"> <text/>
<choice> </element>
<value>force</value> </define>
<value>require</value>
<value>optional</value> <define name="cpuFeature">
<value>disable</value> <element name="feature">
<value>forbid</value> <attribute name="policy">
</choice> <choice>
</attribute> <value>force</value>
<attribute name="name"> <value>require</value>
<ref name="featureName"/> <value>optional</value>
</attribute> <value>disable</value>
<empty/> <value>forbid</value>
</element> </choice>
</zeroOrMore> </attribute>
</interleave> <attribute name="name">
<ref name="featureName"/>
</attribute>
<empty/>
</element>
</define>
<define name="cpuTopology">
<element name="topology">
<attribute name="sockets">
<ref name="positiveInteger"/>
</attribute>
<attribute name="cores">
<ref name="positiveInteger"/>
</attribute>
<attribute name="threads">
<ref name="positiveInteger"/>
</attribute>
</element> </element>
</define> </define>