Bug 1600330 - The dumped filterbinding can not pass the xml validate
Summary: The dumped filterbinding can not pass the xml validate
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-12 01:55 UTC by yalzhang@redhat.com
Modified: 2018-10-30 09:59 UTC (History)
4 users (show)

Fixed In Version: libvirt-4.5.0-4.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-30 09:58:24 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 None None None 2018-10-30 09:59:15 UTC

Description yalzhang@redhat.com 2018-07-12 01:55:42 UTC
Description of problem:
The dumped filterbinding can not pass the xml validate

Version-Release number of selected component (if applicable):
libvirt-4.5.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start a vm with interface defined with nwfilter
# virsh dumpxml rhel  | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:a1:99:dc'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. check the network ports which have filters associated with them
# virsh nwfilter-binding-list 
 Port Dev              Filter               
------------------------------------------------------------------
 vnet0                 clean-traffic       

3. Output the network filter binding XML for the network device vnet0
# virsh nwfilter-binding-dumpxml vnet0
<filterbinding>
  <owner>
    <name>rhel</name>
    <uuid>2e44e082-272f-49f3-b853-92620ad7a3aa</uuid>
  </owner>
  <portdev name='vnet0'/>
  <mac address='52:54:00:a1:99:dc'/>
  <filterref filter='clean-traffic'>
    <parameter name='MAC' value='52:54:00:a1:99:dc'/>
  </filterref>
</filterbinding>

4. validate the dumped xml by virt-xml-validate, it fails
# virsh nwfilter-binding-dumpxml vnet0 > filterbinding.xml
# virt-xml-validate filterbinding.xml
filterbinding.xml:1: element filterbinding: Relax-NG validity error : Expecting element filter, got filterbinding
filterbinding.xml fails to validate

Actual results:
step 4, the dumped xml can not pass the xml validate

Expected results:
the dumped xml can pass the xml validate

Additional info:

Comment 2 John Ferlan 2018-07-19 18:05:35 UTC
Patch posted upstream:

https://www.redhat.com/archives/libvir-list/2018-July/msg00816.html

Comment 3 John Ferlan 2018-07-19 20:19:43 UTC
Now pushed upstream:

$ git show
commit a47d053720f3b4965184bc9a5a87a86d301957ea
Author: Han Han <hhan@redhat.com>
Date:   Fri Jul 13 09:39:29 2018 +0800

    virt-xml-validate: Add schema for nwfilterbinding
    
...
    
    Add nwfilterbinding schema in virt-xml-validate for autoprobing.
    Add document of nwfilterbinding schema in tools/virt-xml-validate.pod.
    
    Signed-off-by: Han Han <hhan@redhat.com>
    Reviewed-by: John Ferlan <jferlan@redhat.com>


$ git describe a47d053720f3b4965184bc9a5a87a86d301957ea
v4.5.0-193-ga47d053720
$

Comment 6 yalzhang@redhat.com 2018-07-26 05:52:42 UTC
test on libvirt-4.5.0-4.el7.x86_64, the result is as expected, set this bug to be verified.

1. collect all the built-in nwfilter name in a file called 'test'
# virsh nwfilter-list > test
# cat test
allow-arp           
allow-dhcp          
allow-dhcp-server 
...

2. prepare xmls included different filters
# cat run.sh
#!/bin/bash

k=1
while read line; do 
echo "<interface type='network'>
      <source network='default'/>
<filterref filter='$line'/>
    </interface> " > vnet$k
((k++))
done < test

#./run.sh

3. Find the interface with 'allow-dhcp-server' filter, edit the file to add the dhcp server parameter
# cat vnet3
<interface type='network'>
      <source network='default'/>
<filterref filter='allow-dhcp-server'>
<parameter name='DHCPSERVER' value='192.168.122.1'/>
</filterref>
    </interface>

4. prepare configs with parameters:
# cat vnet18
<interface type='bridge'>
<source bridge='br0'/>
    <mac address='00:16:3e:5d:c7:9e'/>
    <filterref filter='clean-traffic'>
      <parameter name='IP' value='10.0.0.1'/>
      <parameter name='IP' value='10.0.0.2'/>
      <parameter name='IP' value='10.0.0.3'/>
    </filterref>
  </interface>

# cat vnet19
<interface type='bridge'>
  <source bridge='br0'/>
  <filterref filter='clean-traffic'>
    <parameter name='CTRL_IP_LEARNING' value='dhcp'/>
  </filterref>
</interface>

# for i in {1..19}; do virsh attach-device rhel vnet$i --config; done
# virsh start rhel
# for i in {1..19}; do virsh nwfilter-binding-dumpxml  vnet$i > binding$i; virt-xml-validate binding$i;done
binding1 validates
binding2 validates
binding3 validates
binding4 validates
binding5 validates
binding6 validates
binding7 validates
binding8 validates
binding9 validates
binding10 validates
binding11 validates
binding12 validates
binding13 validates
binding14 validates
binding15 validates
binding16 validates
binding17 validates
binding18 validates
binding19 validates

Comment 8 errata-xmlrpc 2018-10-30 09:58:24 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/RHSA-2018:3113


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