question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] network.managed bonding slaves

See original GitHub issue

Description When creating a bond interface with slaves after the first run we get a the following error.

          ID: bond1
    Function: network.managed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/site-packages/salt/state.py", line 1981, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1977, in wrapper
                  return f(*args, **kwargs)
                File "/var/cache/salt/minion/extmods/states/network.py", line 523, in managed
                  desired_slaves = kwargs['slaves'].split()
              AttributeError: 'list' object has no attribute 'split'
     Started: 14:28:30.762470
    Duration: 71.795 ms
     Changes:

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info).

eth0:
  network.managed:
    - enabled: True
    - type: slave
    - mtu: 1500
    - master: bond1

eth1:
  network.managed:
    - enabled: True
    - type: slave
    - mtu: 1500
    - master: bond1

bond1:
  network.managed:
    - type: bond
    - mode: 802.3ad
    - proto: none
    - enabled: True
    - slaves: eth0 eth1
    - require:
      - network: eth0
      - network: eth1
    - miimon: 100
    - arp_interval: 250
    - downdelay: 200
    - lacp_rate: fast
    - max_bonds: 1
    - updelay: 0
    - use_carrier: on
    - hashing-algorithm: layer2
    - mtu: 1500
    - autoneg: on

Steps to Reproduce the behavior (Include debug logs if possible and relevant)

salt 'hypervisor01' state.apply

Expected behavior

          ID: bond1
    Function: network.managed
      Result: True
     Comment: Interface bond1 is up to date.
     Started: 14:33:54.299361
    Duration: 74.395 ms
     Changes:

Why to resolve After logging the KWARGS I found that the ‘slaves’ is in a list for some strange reason.

{u'slaves': [u'ens1f0', u'ens1f1'], u'updelay': 0, u'test': False, u'autoneg': True, u'use_carrier': True, u'mode': u'802.3ad'}

I changed the following lines

515a516
>     log.warn(kwargs)
522c523,526
<             desired_slaves = kwargs['slaves'].split()
---
>             if isinstance(kwargs['slaves'], str):
>                 desired_slaves = kwargs['slaves'].split()
>             else:
>                 desired_slaves = kwargs['slaves']

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` Salt Version: Salt: 3000.3

Dependency Versions: cffi: 1.6.0 cherrypy: Not Installed dateutil: 1.5 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.7.2 libgit2: 0.26.3 M2Crypto: 0.31.0 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.6.2 mysql-python: Not Installed pycparser: 2.14 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.26.4 Python: 2.7.5 (default, Apr 2 2020, 13:16:51) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4

System Versions: dist: centos 7.8.2003 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1127.el7.x86_64 system: Linux version: CentOS Linux 7.8.2003 Core

</details>

**Additional context**
Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piterpunkcommented, May 5, 2021

It was fixed in 4f889c1799c5291f1664db116604893e83283b06

@sagetherage if my test is correct, this mean the target for Aluminium was, involuntary, reached.

0reactions
piterpunkcommented, May 5, 2021

Ok, I wrote the #59988 but while testing it I saw that this bug seems to be fixed sometime between 3000.3 and 3003.

I just built a new virtual machine with CentOS and install Salt with these commands:

    curl -fsSL https://bootstrap.saltproject.io -o install_salt.sh
    chmod +x install_salt.sh 
    ./install_salt.sh -P -M -x python3

Created a bond.sls state:

eth1:
  network.managed:
    - enabled: True
    - type: slave
    - mtu: 1500
    - master: bond1

eth3:
  network.managed:
    - enabled: True
    - type: slave
    - mtu: 1500
    - master: bond1

bond1:
  network.managed:
    - type: bond
    - mode: 802.3ad
    - proto: none
    - enabled: True
    - slaves: eth1 eth3
    - require:
      - eth1
      - eth3
    - miimon: 100
    - arp_interval: 250
    - downdelay: 200
    - lacp_rate: fast
    - max_bonds: 1
    - updelay: 0
    - use_carrier: on
    - hashing-algorithm: layer2
    - mtu: 1500
    - autoneg: on

The first run results:

local:
----------
          ID: eth1
    Function: network.managed
      Result: True
     Comment: Interface eth1 added.
     Started: 16:55:29.134233
    Duration: 74.524 ms
     Changes:   
              ----------
              interface:
                  Added network interface.
              status:
                  Interface eth1 is up
----------
          ID: eth3
    Function: network.managed
      Result: True
     Comment: Interface eth3 added.
     Started: 16:55:29.209090
    Duration: 72.32 ms
     Changes:   
              ----------
              interface:
                  Added network interface.
              status:
                  Interface eth3 is up
----------
          ID: bond1
    Function: network.managed
      Result: True
     Comment: Interface bond1 added.
     Started: 16:55:29.282343
    Duration: 6375.106 ms
     Changes:   
              ----------
              interface:
                  Added network interface.
              status:
                  Interface bond1 is up

Summary for local
------------                                                                                                                        
Succeeded: 3 (changed=3)
Failed:    0
------------
Total states run:     3                                                                                                             
Total run time:   6.522 s

The second run results:

local:
----------
          ID: eth1
    Function: network.managed
      Result: True
     Comment: Interface eth1 is up to date.
     Started: 16:55:51.268187
    Duration: 61.861 ms
     Changes:   
----------
          ID: eth3
    Function: network.managed
      Result: True
     Comment: Interface eth3 is up to date.
     Started: 16:55:51.330504
    Duration: 13.691 ms
     Changes:   
----------
          ID: bond1
    Function: network.managed
      Result: True
     Comment: Interface bond1 is up to date.
     Started: 16:55:51.345139
    Duration: 1954.085 ms
     Changes:   

Summary for local                                                                                                                   
------------                                                                                                                        
Succeeded: 3
Failed:    0
------------
Total states run:     3                                                                                                             
Total run time:   2.030 s

It looks like it’s all working fine.

salt --versions-report Salt Version: Salt: 3003

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.1 libgit2: Not Installed M2Crypto: 0.35.2 Mako: Not Installed msgpack: 0.6.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: Not Installed pycrypto: Not Installed pycryptodome: Not Installed pygit2: Not Installed Python: 3.6.8 (default, Nov 16 2020, 16:55:22) python-gnupg: Not Installed PyYAML: 3.13 PyZMQ: 17.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4

System Versions: dist: centos 7 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1160.15.2.el7.x86_64 system: Linux version: CentOS Linux 7 Core

Read more comments on GitHub >

github_iconTop Results From Across the Web

1548265 – Bond and slaves status are wrong when one of the ...
Host dguo-intel has an invalid bond interface (bond0 contains less than 2 active slaves) for the management network configuration.
Read more >
Bug #482419 “802.3ad interface bonding fails if started too ...
The following piece of code from the "setup_master()" function in /etc/network/if-pre-up.d/ifenslave will only setup a primary if the primary is ...
Read more >
Bug 540995 – Network interfaces won't join the bonding ...
-- A sketch of a solution: Look at the IP address and netmask of available interfaces. If two interfaces lie within the same...
Read more >
Bonding - Debian Wiki
the enslavement order seems to matter: if "bond-slaves" is specified the expected way (eth0 wlan0), then wlan0 will initially be the primary ...
Read more >
Network Device Bonding | Administration Guide
When using Corosync, the bonding device is not managed by the cluster ... It shows any Ethernet devices that have been configured as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found