os-net-config 0.2.4 fails to enable Linux bonds

Bug #1611471 reported by Dan Sneddon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-net-config
Fix Released
High
Dan Sneddon

Bug Description

os-net-config 0.2.4 contains a bug in the handling of bond/interface handling where it tries to bring up the bond before the slave interfaces are up. This results in an error, since the Linux bonding kernel module is not yet loaded. The correct order is to bring up the slave interfaces first, then the bond. This is how older versions of os-net-config handled Linux bonds. This behavior was probably introduced accidentally as a result of a recent patch.

The logic in impl_ifcfg.apply() will have to be refactored to bring slave interfaces up before Linux bonds.

Revision history for this message
Dan Sneddon (dsneddon) wrote :

### config.yaml ###
network_config:
  -
    type: linux_bond
    name: bond1
    members:
      -
        type: interface
        name: p2p1
        primary: true
      -
        type: interface
        name: p2p2

0.2.4 output:

[root@host06 ~]# os-net-config --debug -c config.yaml -m mapping.yaml
[...snip...]
[2016/08/09 03:22:05 PM] [INFO] Writing config /etc/sysconfig/network-scripts/ifcfg-p2p1
[2016/08/09 03:22:05 PM] [INFO] Writing config /etc/sysconfig/network-scripts/route-p2p2
[2016/08/09 03:22:05 PM] [INFO] Writing config /etc/sysconfig/network-scripts/route-bond1
[2016/08/09 03:22:05 PM] [INFO] Writing config /etc/sysconfig/network-scripts/route6-bond1
[2016/08/09 03:22:05 PM] [INFO] running ifup on interface: bond1
[2016/08/09 03:22:05 PM] [DEBUG] Running cmd (subprocess): /sbin/ifup bond1
[2016/08/09 03:22:05 PM] [DEBUG] CMD "/sbin/ifup bond1" returned: 1 in 0.199s
[2016/08/09 03:22:05 PM] [DEBUG] u'/sbin/ifup bond1' failed. Not Retrying.
Traceback (most recent call last):
  File "/usr/bin/os-net-config", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/os_net_config/cli.py", line 187, in main
    activate=not opts.no_activate)
  File "/usr/lib/python2.7/site-packages/os_net_config/impl_ifcfg.py", line 601, in apply
    self.ifup(linux_bond)
  File "/usr/lib/python2.7/site-packages/os_net_config/__init__.py", line 182, in ifup
    self.execute(msg, '/sbin/ifup', interface)
  File "/usr/lib/python2.7/site-packages/os_net_config/__init__.py", line 162, in execute
    processutils.execute(cmd, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 389, in execute
    cmd=sanitized_cmd)
oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
Command: /sbin/ifup bond1
Exit code: 1
Stdout: u'ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device bond1 does not seem to be present, delaying initialization.\n'
Stderr: u''

Changed in os-net-config:
status: New → Triaged
importance: Undecided → High
status: Triaged → In Progress
assignee: nobody → Dan Sneddon (dsneddon)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to os-net-config (master)

Fix proposed to branch: master
Review: https://review.openstack.org/353072

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-net-config (master)

Reviewed: https://review.openstack.org/353072
Committed: https://git.openstack.org/cgit/openstack/os-net-config/commit/?id=f96f8080284948b7d813ad1990a645fad504174f
Submitter: Jenkins
Branch: master

commit f96f8080284948b7d813ad1990a645fad504174f
Author: Dan Sneddon <email address hidden>
Date: Tue Aug 9 11:52:06 2016 -0700

    Fix Linux bond/slave ifup ordering

    The latest version of os-net-config is not reliably enabling bonding
    when there are no existing bonds on the system. This is due to an
    order-of-operations problem where it tries to bring up the bond
    before the slave interfaces. This can result in an error because
    the bonding module is not present.

    This change activates the bond only after the interfaces have been
    activated. This should ensure that the bonding module is loaded.

    Change-Id: I62e4b10a88168948ed59170285223fb4f8d8de88
    Fixes-bug: 1611471

Changed in os-net-config:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.