Bug 1473952 - Reconnect interface to a new master
Reconnect interface to a new master
Status: CLOSED DUPLICATE of bug 1548265
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Beniamino Galvani
Desktop QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-22 13:41 EDT by Petr Horáček
Modified: 2018-03-24 05:44 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-03-24 05:44:44 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 Petr Horáček 2017-07-22 13:41:24 EDT
Description of problem:
When changing an 802-3-ethernet connection's master from bridge to a bond it is not reconnected unless reactivated explicitly (although 802-3-ethernet connection has autoconnect set to true and bond connection has autoconnect-slaves set to 1). Not sure if it is a bug, mistake in config or a missing feature.


Version-Release number of selected component (if applicable):
CentOS Linux release 7.3.1611 (Core)
NetworkManager 1.4.0

How reproducible:
Always

Steps to Reproduce:
1. Create an 802-3-ethernet and bridge connections, 802-3-ethernet connection master is set to the bridge.
2. Interfaces are now autoconnected eth0-br1
3. Create a new connection for bond and change 802-3-ethernet connection master to this new bond.

Actual results:
802-3-ethernet master is still set to bridge.

Expected results:
802-3-ethernet master is set to bond1.

Reproducer script:
import uuid
import dbus

bus = dbus.SystemBus()
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Settings')
settings = dbus.Interface(proxy, 'org.freedesktop.NetworkManager.Settings')

ethernet_conn_settings = dbus.Dictionary({
    'connection': dbus.Dictionary({
        'id': 'test-eth0',
        'interface-name': 'eth0',
        'uuid': str(uuid.uuid4()),
        'type': '802-3-ethernet',
        'autoconnect': True,
        'autoconnect-priority': 100,
        'master': 'br0',
        'slave-type': 'bridge'
    })
})
bridge_conn_settings = dbus.Dictionary({
    'connection': dbus.Dictionary({
        'id': 'test-br0',
        'interface-name': 'br0',
        'uuid': str(uuid.uuid4()),
        'type': 'bridge',
        'autoconnect': True,
        'autoconnect-priority': 100,
        'autoconnect-slaves': True
    })
})
settings.AddConnection(ethernet_conn_settings)
settings.AddConnection(bridge_conn_settings)

import time
time.sleep(10)

bond_conn_settings = dbus.Dictionary({
    'connection': dbus.Dictionary({
        'id': 'test-bond1',
        'interface-name': 'bond1',
        'uuid': str(uuid.uuid4()),
        'type': 'bond',
        'autoconnect': True,
        'autoconnect-priority': 100,
        'master': 'br0',
        'slave-type': 'bridge',
        'autoconnect-slaves': True
    })
})
ethernet_conn = None
ethernet_conn_uuid = None
for conn in settings.ListConnections():
    con_proxy = bus.get_object('org.freedesktop.NetworkManager', conn)
    settings_connection = dbus.Interface(con_proxy, 'org.freedesktop.NetworkManager.Settings.Connection')
    config = settings_connection.GetSettings()
    if str(config['connection']['id']) == 'test-eth0':
        ethernet_conn = settings_connection
        ethernet_conn_uuid = str(config['connection']['uuid'])
ethernet_conn_settings['connection'].update({
    'slave-type': 'bond',
    'master': 'bond1',
    'uuid': ethernet_conn_uuid
})
ethernet_conn.Update(ethernet_conn_settings)
settings.AddConnection(bond_conn_settings)

After running this `ip link` returns:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:e6:eb:82 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:e6:eb:82 brd ff:ff:ff:ff:ff:ff
4: bond1: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue master br0 state DOWN mode DEFAULT qlen 1000
    link/ether 8e:9c:29:a5:54:4d brd ff:ff:ff:ff:ff:ff

ethernet connection:
[root@localhost tmp]# nmcli con show test-eth0 
...
connection.master:                      bond1
connection.slave-type:                  bond
...
Comment 2 Beniamino Galvani 2017-07-26 10:43:16 EDT
This is probably fixed by commit:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=632dd26288601c8564e1363f9bbf2f1f96d2dc53

Can you please try with a NetworkManager version that includes the commit (>= 1.6.0)? Thanks!
Comment 3 Petr Horáček 2017-08-01 15:42:16 EDT
Unfortunately, it is reproducible with NetworkManager-1.8.2-1.fc26.x86_64 as well.
Comment 4 Beniamino Galvani 2017-08-31 10:10:50 EDT
For the record, the script works with NM 1.8.0 but does not with 1.8.2 due to the following commit:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=0922a177385be188b9c9c8ad39c1068533f5a4b3
Comment 5 Beniamino Galvani 2017-09-28 08:30:03 EDT
In general when a connection is changed the new settings are effective
only after reactivation of the connection. Here the master of a slave
connection is changed while the connection is active and then the new
master (with autoconnect-slaves=yes) is brought up. The question is
whether NM should automatically reactivate the slave connection on the
new master.

In version 1.8.0, NM would unconditionally reactivate the slave when
autoconnect-slaves=yes. We noticed that this could lead to race
conditions: for example if a user activated the master and the slave
within short time, the slave auto-activation could preempt th slave
activation requested by user and make it fail, which is certainly
wrong.

This scenario was fixed in 1.8.2 and now NM doesn't disconnect an
active connection just to auto-connect it again. I believe this is an
acceptable behavior and I would suggest to change the script to
explicitly reactivate a connection when changes are done to it.

Any other opinions about this?
Comment 6 Beniamino Galvani 2018-03-24 05:44:44 EDT

*** This bug has been marked as a duplicate of bug 1548265 ***

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