RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1223688 - virt-xml-validate should accept both DHCPv4 and static IPv4 addresses concurrently
Summary: virt-xml-validate should accept both DHCPv4 and static IPv4 addresses concurr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-21 08:52 UTC by Hu Jianwei
Modified: 2015-11-19 06:31 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.16-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:31:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Hu Jianwei 2015-05-21 08:52:16 UTC
Description of problem:
virt-xml-validate should accept both DHCPv4 and static IPv4 addresses concurrently 

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

How reproducible:
100%

Steps to Reproduce:
[root@localhost ~]# cat eth1.xml 
<interface type='ethernet' name='eth1'>
  <start mode='none'/>
  <mac address='00:1B:21:27:4E:CE'/>
  <mtu size='1500'/>
  <protocol family='ipv4'>
    <dhcp/>
    <ip address='192.168.1.111' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <dhcp/>
    <ip address='2001:db8:ca2:2::1' prefix='64'/>
  </protocol>
</interface>
[root@localhost ~]# virt-xml-validate eth1.xml
Relax-NG validity error : Extra element protocol in interleave
eth1.xml:5: element protocol: Relax-NG validity error : Element interface failed to validate content
eth1.xml:3: element mac: Relax-NG validity error : Invalid sequence in interleave
eth1.xml fails to validate

Actual results:
As shown above steps, AFAIK,libvirt should be same as netcf, we need a patch for /usr/share/libvirt/schemas/interface.rng 

Expected results:
Fix it.

Additional info:
Please refer to below netcf bug:
Bug 1113983 - netcf should allow interfaces to be configured with both DHCPv4 and static IPv4 addresses at the same time
https://git.fedorahosted.org/cgit/netcf.git/commit/?id=0013d5a2ccf61e58b021feead6ed66813ee50f65

Using below schemas(/usr/share/libvirt/schemas/interface.rng), libvirt can handle the bug.
  <define name="protocol-ipv4">
    <element name="protocol">
      <attribute name="family">
        <value>ipv4</value>
      </attribute>
      <interleave>
        <optional>
          <ref name="dhcp-element"/>
        </optional>
            <oneOrMore>
              <element name="ip">
                <attribute name="address"><ref name="ipv4Addr"/></attribute>
                <optional>
                  <attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
                </optional>
              </element>
            </oneOrMore>
            <optional>
              <element name="route">
                <attribute name="gateway"><ref name="ipv4Addr"/></attribute>
              </element>
            </optional>
      </interleave>
    </element>
  </define>

[root@localhost ~]# virt-xml-validate eth1.xml
eth1.xml validates

Comment 2 Laine Stump 2015-05-21 14:21:45 UTC
You are correct. libvirt's interface.rng should mirror netcf's, but I forgot to update it when I added new capabilities to netcf.

Comment 3 Laine Stump 2015-05-21 17:53:18 UTC
Fix posted upstream, awaiting review:

https://www.redhat.com/archives/libvir-list/2015-May/msg00746.html

Comment 4 Laine Stump 2015-05-26 14:46:59 UTC
Pushed upstream, will be in 1.2.16:

commit ba5566e80f95618c3bb8ac327d4a1c370539166d
Author: Laine Stump <laine>
Date:   Thu May 21 11:26:52 2015 -0400

    interface: allow multiple IPv4 addresses + dhcp on a single interface

Comment 7 Shanzhi Yu 2015-07-21 09:05:14 UTC
Verify this bug with 
libvirt-client-1.2.17-2.el7.x86_64
libvirt-1.2.17-2.el7.x86_64


# virt-xml-validate /dev/stdin <<EOF
<interface type='ethernet' name='eth1'>
  <start mode='none'/>
  <mac address='00:1B:21:27:4E:CE'/>
  <mtu size='1500'/>
  <protocol family='ipv4'>
    <dhcp/>                                  
    <ip address='192.168.1.111' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <dhcp/>                                      
    <ip address='2001:db8:ca2:2::1' prefix='64'/>
  </protocol>
</interface>
EOF

/dev/stdin validates

# virt-xml-validate /dev/stdin <<EOF
<interface type='ethernet' name='eth1'>
  <start mode='none'/>
  <mac address='00:1B:21:27:4E:CE'/>
  <mtu size='1500'/>
  <protocol family='ipv4'>
    <dhcp/>
    <ip address='192.168.1.111' prefix='24'/>
  </protocol>
</interface>              
EOF         

/dev/stdin validates

# virt-xml-validate /dev/stdin <<EOF
<interface type='ethernet' name='eth1'>
  <start mode='none'/>
  <mac address='00:1B:21:27:4E:CE'/>
  <mtu size='1500'/>
  <protocol family='ipv6'>
    <dhcp/>
    <ip address='2001:db8:ca2:2::1' prefix='64'/>
  </protocol>                                    
</interface>                                    
EOF                                             

/dev/stdin validates

Comment 9 errata-xmlrpc 2015-11-19 06:31:27 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://rhn.redhat.com/errata/RHBA-2015-2202.html


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