Bug 1004364

Summary: libvirt network schema isn't valid
Product: Red Hat Enterprise Linux 7 Reporter: Pavel Hrdina <phrdina>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, bili, dyuan, honzhang, jiahu, jtomko
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.1.1-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1004365 (view as bug list) Environment:
Last Closed: 2014-06-13 10:41:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1004365    

Description Pavel Hrdina 2013-09-04 13:39:41 UTC
Description of problem:
The network.rng schema isn't valid. There is missing element "nat" for "forward" element. The new features have been added by commits 905629f4 and 1716e7a6.

Version-Release number of selected component (if applicable):
upstream

How reproducible:
100%

Steps to Reproduce:
1. virsh net-dumpxml default > default.xml
2. virt-xml-validate default.xml network

Actual results:
Relax-NG validity error : Extra element forward in interleave
default.xml:4: element forward: Relax-NG validity error : Element network failed to validate content
default.xml fails to validate

Expected results:
default.xml validates

Comment 2 Jiri Denemark 2013-09-05 07:51:29 UTC
*** Bug 1004627 has been marked as a duplicate of this bug. ***

Comment 3 Ján Tomko 2013-09-05 12:00:57 UTC
Now fixed upstream:
commit 437b7944a81b648a15c657fef184f3bcd2427dac
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-09-05 11:08:38 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-09-05 13:45:49 +0200

    Add '<nat>' element to '<forward>' network schemas
    
    Commits 905629f4 and 1716e7a6 have added support for specifying
    an IPv4 range and a port range to be used by NAT:
    <forward mode='nat'>
      <nat>
        <address start='10.20.30.40' end='10.20.30.44'/>
        <port start='60000' end='65432'/>
      </nat>
    </forward>
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1004364

git describe: v1.1.2-71-g437b794

Comment 5 Hu Jianwei 2013-09-09 06:33:04 UTC
The bug can reproduce on libvirt-1.1.1-3.el7, but can not reproduce on libvirt-1.1.1-4.el7.

Version:
libvirt-1.1.1-4.el7.x86_64
qemu-kvm-1.5.3-2.el7.x86_64
kernel-3.10.0-14.el7.x86_64

Verified steps:

1. Dump virtual network xml
[root@localhost ~]# virsh net-dumpxml default > default.xml 
[root@localhost ~]# cat default.xml 
<network connections='1'>
  <name>default</name>
  <uuid>ba6533c2-da83-4e95-bf67-5dac8ab3beee</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:b7:53:19'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

2. Validate the xml using virt-xml-validate command
[root@localhost ~]# virt-xml-validate default.xml network
default.xml validates

3. Other scenario in changes of patch.
[root@localhost ~]# cat 1.xml 
<network>
  <name>default</name>
  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
  <bridge name="virbr0"/>
  <forward mode="nat" dev="eth1">
    <nat>
      <address start='10.20.30.40' end='10.20.30.44'/>
      <port start='60000' end='65432'/>
    </nat>
  </forward>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
      <host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.10"/>
      <host mac="00:16:3e:3e:a9:1a" name="b.example.com" ip="192.168.122.11"/>
    </dhcp>
  </ip>
  <ip family="ipv4" address="192.168.123.1" netmask="255.255.255.0">
  </ip>
  <ip family="ipv6" address="2001:db8:ac10:fe01::1" prefix="64">
  </ip>
  <ip family="ipv6" address="2001:db8:ac10:fd01::1" prefix="64">
  </ip>
  <ip family="ipv4" address="10.24.10.1">
  </ip>
</network>
[root@localhost ~]# virt-xml-validate 1.xml network
1.xml validates
 
We can get the expected results, so changed to verified.

Comment 6 Ludek Smid 2014-06-13 10:41:24 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.