Bug 1436300

Summary: update interface.rng to match the same file in libvirt
Product: Red Hat Enterprise Linux 7 Reporter: Laine Stump <laine>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: yalzhang <yalzhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: chhu, dyuan, rbalakri, xuzhang, yalzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: netcf-0.2.8-3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1414404 Environment:
Last Closed: 2017-08-01 21:46:42 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:

Description Laine Stump 2017-03-27 15:27:13 UTC
+++ This bug was initially created as a clone of Bug #1414404 +++


The <start mode='blah'/> element in an interfact definition should be optional, but isn't. libvirt's RNG (schema for the XML) has been modified to make <start> optional (See Bug 1414404), and netcf needs to be modified in the same manner.

This is the libvirt patch:

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

And this is the netcf patch:

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

Comment 2 Laine Stump 2017-03-28 14:50:42 UTC
This is the upstream commit:

commit 1b76d1d0a027f933f79cb250fc461488ab7ccfe4
Author: Laine Stump <laine>
Date:   Mon Mar 27 00:49:09 2017 -0400

    make <start mode='blah'/>  optional

Comment 3 Laine Stump 2017-03-28 14:54:03 UTC
Resolved in this RHEL7.4-candidate build:

https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=546862

Comment 5 yalzhang@redhat.com 2017-04-06 12:55:11 UTC
Reproduce it on netcf-0.2.8-2.el7.x86_64

get a xml dumped by ncftool with startmode, then delete it the startmode, the ncftool can not validate it

1. the interface xml dumped by ncftool will always have startmode element 
# ncftool dumpxml enp0s25 > /tmp/net
# cat /tmp/net
<?xml version="1.0"?>
<interface type="ethernet" name="enp0s25">
  <start mode="none"/>
  <mac address="1c:6f:65:06:bc:81"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>

2. delete the startmode in /tmp/net
# vim /tmp/net 
# cat /tmp/net
<?xml version="1.0"?>
<interface type="ethernet" name="enp0s25">
  <mac address="1c:6f:65:06:bc:81"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>


3. netcf can not validate this xml
# ncftool define /tmp/net
error: XML invalid
error: Expecting an element start, got nothing

update to netcf-0.2.8-4.el7.x86_64

4. 
# ncftool define /tmp/net
Defined interface enp0s25

The ethernet-interface, vlan-interface, bridge-interface, bond-interface will refer to "startmode"

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

Comment 6 errata-xmlrpc 2017-08-01 21:46:42 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/RHBA-2017:2220