Bug 855573 - failure to define interface with netmask of more than 24 bits
failure to define interface with netmask of more than 24 bits
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: netcf (Show other bugs)
17
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Laine Stump
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-08 23:15 EDT by Laine Stump
Modified: 2012-10-14 23:39 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 848722
Environment:
Last Closed: 2012-10-14 23:39:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Laine Stump 2012-09-08 23:15:48 EDT
+++ This bug was initially created as a clone of Bug #848722 +++

Description of problem:
could not build bridge interface use virsh iface-define
# virsh iface-define br0.xml 
error: Failed to define interface from br0.xml
error: internal error could not get interface XML description: XSLT transformation failed - runtime error: file /usr/share/netcf/xml/initscripts-get.xsl line 196 element node

Version-Release number of selected component (if applicable):
# virsh version
Compiled against library: libvir 0.9.10
Using library: libvir 0.9.10
Using API: QEMU 0.9.10
Running hypervisor: QEMU 0.12.1

How reproducible:
1. prepare interface xml:
# cat br0.xml 
<interface type="bridge" name="br0">
  <start mode="onboot"/>
  <protocol family="ipv4">
    <ip address="118.123.12.65" prefix="25"/>
    <route gateway="118.123.12.1"/>
  </protocol>
  <bridge stp="on" delay="0">
    <interface type="ethernet" name="eth0">
    </interface>
  </bridge>
</interface>
2. define with this xml
# virsh iface-define br0.xml 

Actual results:
error: Failed to define interface from br0.xml
error: internal error could not get interface XML description: XSLT transformation failed - runtime error: file /usr/share/netcf/xml/initscripts-get.xsl line 196 element node

Expected results:
Interface br0 defined from br0.xml

Additional info:

--- Additional comment from jdenemar@redhat.com on 2012-08-17 06:54:02 EDT ---

virsh version doesn't really tell us much. Could you run the following command and paste the result here?

    rpm -qa | grep 'libvirt\|netcf'

--- Additional comment from laine@redhat.com on 2012-08-17 14:27:26 EDT ---

And more importantly, please install the "netcf" package (by default, only "netcf-libs" is installed, then as root, run:

   # ncftool -d dumpxml eth0

This should print out a more detailed message about why netcf is failing the xslt transform. Usually this is due to a system config file (e.g. one of the files in /etc/modprobe.d) that has a construct that isn't properly understood by augeas.

The output of the above ncftool command should tell us the troublesome file; if you can then also attach the contents of that file, we can hopefully figure out the problem.

(btw, starting with RHEL6.3, there is a simpler method of bridging an ethernet interface. Instead of writing your own XML, you can just do this:

   # virsh iface-bridge eth0 br0

(I would recommend having NetworkManager disabled when you do it - NM is getting better at cooperating with netcf, but it's still problematic.)

--- Additional comment from itxx00@gmail.com on 2012-08-20 22:16:06 EDT ---

(In reply to comment #2)
> virsh version doesn't really tell us much. Could you run the following
> command and paste the result here?
> 
>     rpm -qa | grep 'libvirt\|netcf'

# rpm -qa|grep 'libvirt\|netcf'
libvirt-0.9.10-21.el6_3.3.x86_64
netcf-0.1.9-2.el6.x86_64
netcf-libs-0.1.9-2.el6.x86_64
libvirt-client-0.9.10-21.el6_3.3.x86_64
libvirt-python-0.9.10-21.el6_3.3.x86_64
libvirt-java-0.4.7-1.el6_3.1.noarch

(In reply to comment #3)
> And more importantly, please install the "netcf" package (by default, only
> "netcf-libs" is installed, then as root, run:
> 
>    # ncftool -d dumpxml eth0
> 
# ncftool -d dumpxml eth0
<?xml version="1.0"?>
<interface type="ethernet" name="eth0">
  <start mode="onboot"/>
  <protocol family="ipv4">
    <ip address="118.123.12.65" prefix="25"/>
    <route gateway="118.123.12.1"/>
  </protocol>
</interface>

> This should print out a more detailed message about why netcf is failing the
> xslt transform. Usually this is due to a system config file (e.g. one of the
> files in /etc/modprobe.d) that has a construct that isn't properly
> understood by augeas.
> 
# ls /etc/modprobe.d/
anaconda.conf  blacklist.conf  blacklist-kvm.conf  dist-alsa.conf  dist.conf  dist-oss.conf


> (btw, starting with RHEL6.3, there is a simpler method of bridging an
> ethernet interface. Instead of writing your own XML, you can just do this:
> 
>    # virsh iface-bridge eth0 br0
> 
# virsh iface-bridge eth0 br0
error: Failed to define new bridge interface br0
error: internal error could not get interface XML description: XSLT transformation failed - runtime error: file /usr/share/netcf/xml/initscripts-get.xsl line 196 element node

> (I would recommend having NetworkManager disabled when you do it - NM is
> getting better at cooperating with netcf, but it's still problematic.)

we have not install the NetworkManager on this server.
thanks.

--- Additional comment from laine@redhat.com on 2012-08-22 23:57:45 EDT ---

Okay, now I understand what's happening. The function ipcalc_netmask in netcf had a bug for any netmask > 24. This bug is fixed in the following upstream commit:

commit d340f2dfcd6461c9743dccdabe3b610f5fbc8fe8
Author: Jens Nyberg I <jens.i.nyberg@ericsson.com>
Date:   Wed Nov 30 12:01:09 2011 -0500

    Fix ipcalc_netmask
    
    1) make the bitmask creation simpler to understand.
    
    2) effectively increase string length for inet_ntop result by 1 (it
       already takes the terminating NULL into account).

Moving to POST.

--- Additional comment from itxx00@gmail.com on 2012-08-23 08:32:33 EDT ---

(In reply to comment #5)
> Okay, now I understand what's happening. The function ipcalc_netmask in
> netcf had a bug for any netmask > 24. This bug is fixed in the following
> upstream commit:
> 
> commit d340f2dfcd6461c9743dccdabe3b610f5fbc8fe8
> Author: Jens Nyberg I <jens.i.nyberg@ericsson.com>
> Date:   Wed Nov 30 12:01:09 2011 -0500
> 
>     Fix ipcalc_netmask
>     
>     1) make the bitmask creation simpler to understand.
>     
>     2) effectively increase string length for inet_ntop result by 1 (it
>        already takes the terminating NULL into account).
> 
> Moving to POST.

Thanks very much.^^
Comment 1 Fedora Update System 2012-09-08 23:27:40 EDT
netcf-0.2.2-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/netcf-0.2.2-1.fc17
Comment 2 Fedora Update System 2012-09-10 18:23:27 EDT
Package netcf-0.2.2-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing netcf-0.2.2-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-13735/netcf-0.2.2-1.fc17
then log in and leave karma (feedback).
Comment 3 Cole Robinson 2012-10-14 23:39:54 EDT
netcf-0.2.2 is now in F17 stable

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