Brian Rak
2015-Mar-10 15:31 UTC
[libvirt-users] Issues with XML validation after upgrade to 1.2.12
After we upgraded to 1.2.12, we've been having issues with libvirt... it
complains that our formerly valid guest definitions are now invalid:
error: Failed to start domain XXXX
error: internal error: Cannot instantiate filter due to unresolvable
variables or unavailable list elements: DHCPSERVER
We looked into this, and found that it's the XML validation that's
failing:
# xmllint --noout --relaxng "/share/libvirt/schemas/domain.rng"
XXXX.xml --recover
Relax-NG validity error : Extra element devices in interleave
test.xml:1: element domain: Relax-NG validity error : Element domain
failed to validate content
test.xml fails to validate
And, a minimal domain XML to reproduce it (this won't boot, but it shows
the issue):
<domain type='kvm' id='65'>
<name>XXXX</name>
<uuid>b602b5f2-b9d7-43bd-a949-acc7eeeb9f8f</uuid>
<memory unit='KiB'>1048576</memory>
<devices>
<interface type='bridge'>
<filterref filter='myfilter'>
<parameter name='CTRL_IP_LEARNING' value='none'/>
<parameter name='DHCPSERVER'
value='104.156.226.10'/>
<parameter name='IP' value='104.207.129.11'/>
<parameter name='IP6_ADDR'
value='2001:19f0:300:2102::'/>
<parameter name='IP6_MASK' value='64'/>
</filterref>
</interface>
</devices>
</domain>
The cause seems to be having multiple parameters in a <filterref> block.
We applied the following patch to fix it:
diff -ur src_clean/docs/schemas/domaincommon.rng
src/docs/schemas/domaincommon.rng
--- src_clean/docs/schemas/domaincommon.rng 2015-01-23
06:46:24.000000000 -0500
+++ src/docs/schemas/domaincommon.rng 2015-03-10 11:30:42.057441342 -0400
@@ -4468,6 +4468,7 @@
<data type="NCName"/>
</attribute>
<optional>
+ <zeroOrMore>
<element name="parameter">
<attribute name="name">
<ref name="filter-param-name"/>
@@ -4476,6 +4477,7 @@
<ref name="filter-param-value"/>
</attribute>
</element>
+ </zeroOrMore>
</optional>
</define>
Kashyap Chamarthy
2015-Mar-10 17:49 UTC
Re: [libvirt-users] Issues with XML validation after upgrade to 1.2.12
On Tue, Mar 10, 2015 at 11:31:17AM -0400, Brian Rak wrote:> After we upgraded to 1.2.12, we've been having issues with libvirt... it > complains that our formerly valid guest definitions are now invalid:Yeah, w/ 1.2.12, I've noticed similar XML validation errors. E.g. the XML fragment in the below email worked with 1.2.11, but failed with git as noted: http://www.redhat.com/archives/libvir-list/2015-February/msg00958.html Issue in the above case: 'virtio-mmio' address type was missing from the RNG schemas which was fixed in (1.2.13): http://www.redhat.com/archives/libvir-list/2015-February/msg01022.html -- [PATCH for 1.2.13] schema: Add virtio-mmio address type into RNG -- /kashyap> error: Failed to start domain XXXX > error: internal error: Cannot instantiate filter due to unresolvable > variables or unavailable list elements: DHCPSERVER > > We looked into this, and found that it's the XML validation that's failing: > > # xmllint --noout --relaxng "/share/libvirt/schemas/domain.rng" XXXX.xml > --recover > Relax-NG validity error : Extra element devices in interleave > test.xml:1: element domain: Relax-NG validity error : Element domain failed > to validate content > test.xml fails to validate > > And, a minimal domain XML to reproduce it (this won't boot, but it shows the > issue): > > <domain type='kvm' id='65'> > <name>XXXX</name> > <uuid>b602b5f2-b9d7-43bd-a949-acc7eeeb9f8f</uuid> > <memory unit='KiB'>1048576</memory> > <devices> > <interface type='bridge'> > <filterref filter='myfilter'> > <parameter name='CTRL_IP_LEARNING' value='none'/> > <parameter name='DHCPSERVER' value='104.156.226.10'/> > <parameter name='IP' value='104.207.129.11'/> > <parameter name='IP6_ADDR' value='2001:19f0:300:2102::'/> > <parameter name='IP6_MASK' value='64'/> > </filterref> > </interface> > </devices> > </domain> > > The cause seems to be having multiple parameters in a <filterref> block. > > We applied the following patch to fix it: > > diff -ur src_clean/docs/schemas/domaincommon.rng > src/docs/schemas/domaincommon.rng > --- src_clean/docs/schemas/domaincommon.rng 2015-01-23 > 06:46:24.000000000 -0500 > +++ src/docs/schemas/domaincommon.rng 2015-03-10 11:30:42.057441342 -0400 > @@ -4468,6 +4468,7 @@ > <data type="NCName"/> > </attribute> > <optional> > + <zeroOrMore> > <element name="parameter"> > <attribute name="name"> > <ref name="filter-param-name"/> > @@ -4476,6 +4477,7 @@ > <ref name="filter-param-value"/> > </attribute> > </element> > + </zeroOrMore> > </optional> > </define> >