Bug 1414404 - virt-xml-validate fail to validate interface xml
Summary: virt-xml-validate fail to validate interface xml
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: chhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-18 12:30 UTC by yalzhang@redhat.com
Modified: 2017-08-02 00:01 UTC (History)
3 users (show)

Fixed In Version: libvirt-3.2.0-1.el7.x86_64
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1436300 (view as bug list)
Environment:
Last Closed: 2017-08-01 17:21:45 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1436300 0 unspecified CLOSED update interface.rng to match the same file in libvirt 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Internal Links: 1436300

Description yalzhang@redhat.com 2017-01-18 12:30:35 UTC
Description of problem:
virt-xml-validate fail to validate interface xml

Version-Release number of selected component (if applicable):
# rpm -q libvirt netcf
libvirt-2.5.0-1.el7.x86_64
netcf-0.2.8-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. dump the xml file of the existing physical interface;
# virsh iface-dumpxml enp0s25
<interface type='ethernet' name='enp0s25'>
  <protocol family='ipv4'>
    <ip address='10.66.5.0' prefix='22'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::1e6f:65ff:fe06:bc81' prefix='64'/>
  </protocol>
  <link speed='1000' state='up'/>
  <mac address='1c:6f:65:06:bc:81'/>
</interface>

# virsh iface-dumpxml enp0s25 > net

2. virt-xml-validate failed to validate the xml file
# virt-xml-validate net
net:1: element interface: Relax-NG validity error : Expecting an element start, got nothing
net:1: element interface: Relax-NG validity error : Invalid sequence in interleave
net:1: element interface: Relax-NG validity error : Element interface failed to validate content
net fails to validate

Actual results:
virt-xml-validate fail to validate file dumped by iface-dumpxml 

Expected results:
virt-xml-validate should successfully validate the file dumped by iface-dumpxml

Additional info:
Edit the physical interface by "virsh iface-edit" will not do the validation(no error pop up).
# virsh iface-edit enp0s25
Interface enp0s25 XML configuration edited.
I think "iface-edit" should do the validation because the xml has been edited.

Comment 1 Jaroslav Suchanek 2017-01-19 10:32:43 UTC
Is this for netcf component or not? In any case, seems like the validation is
expecting some <start mode='xx'/> element.

Comment 2 Laine Stump 2017-01-19 18:09:06 UTC
There are RNG files in both libvirt and netcf. In this case it's the copy in libvirt, but the two should match.

I believe there are some missing <interleave> elements in the interface RNG

Comment 3 Laine Stump 2017-03-27 04:56:24 UTC
Actually it was much simpler than that - the <start> element should be optional but it isn't. I've sent patches upstream to both libvirt and netcf to remedy this:

https://www.redhat.com/archives/libvir-list/2017-March/msg01262.html

https://lists.fedorahosted.org/archives/list/netcf-devel@lists.fedorahosted.org/thread/OCLPQ2WBSH7NPCHTYSWTCIVQ6QVWAUIR/

Comment 4 yalzhang@redhat.com 2017-04-06 13:51:03 UTC
verified on libvirt-3.2.0-1.el7.x86_64, the result is as expected.

1. 
# cat -n /usr/share/libvirt/schemas/interface.rng
..
281   <define name="startmode">
282     <optional>
283       <element name="start">
284         <attribute name="mode">
285           <choice>
286             <value>onboot</value>
287             <value>none</value>
288             <value>hotplug</value>
289             <!-- Jim Fehlig lists the following that SuSe supports:
290                  manual, ifplug, nfsroot -->
291           </choice>
292         </attribute>
293       </element>
294     </optional>
295   </define>
...

2. 
# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 enp0s25              active     1c:6f:65:06:bc:81
 eth0                 inactive   
 lo                   active     00:00:00:00:00:00
# virsh iface-dumpxml enp0s25 > /tmp/net
# virt-xml-validate /tmp/net
/tmp/net validates

Comment 5 errata-xmlrpc 2017-08-01 17:21:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 6 errata-xmlrpc 2017-08-02 00:01:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846


Note You need to log in before you can comment on or make changes to this bug.