Bug 1348198

Summary: [RFE] cannot easily change active_slave
Product: Red Hat Enterprise Linux 7 Reporter: Vladimir Benes <vbenes>
Component: NetworkManagerAssignee: Beniamino Galvani <bgalvani>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: aloughla, atragler, bgalvani, lrintel, rkhan, sukulkar, thaller
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: NetworkManager-1.8.0-0.4.rc1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1428420 (view as bug list) Environment:
Last Closed: 2017-08-01 09:17:07 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:
Bug Depends On:    
Bug Blocks: 1299103, 1393481, 1428420    

Description Vladimir Benes 2016-06-20 12:23:22 UTC
Description of problem:
when I add a bond with two slaves and add active slave option I cannot switch it more than one time.

[root@wlan-r2s5 NetworkManager]# nmcli connection add type bond 
Connection 'bond' (f57d0507-99f3-4e2d-91c6-9b1bcf4571c5) successfully added.
[root@wlan-r2s5 NetworkManager]# nmcli connection add type ethernet ifname eth1 master nm-bond 
Connection 'ethernet-eth1' (68ec93c1-d2dd-4581-bff7-fd21e957c0c1) successfully added.
[root@wlan-r2s5 NetworkManager]# nmcli connection add type ethernet ifname eth2 master nm-bond 
Connection 'ethernet-eth2' (356e1d0b-bc1e-4c00-aa8d-658d08675a95) successfully added.

[root@wlan-r2s5 NetworkManager]# nmcli connection modify bond connection.autoconnect-slaves 1 bond.options "mode=active-backup,active_slave=eth2"

[root@wlan-r2s5 NetworkManager]# cat /proc/net/bonding/nm-bond 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1


[root@wlan-r2s5 NetworkManager]# nmcli connection up id bond 
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
[root@wlan-r2s5 NetworkManager]# cat /proc/net/bonding/nm-bond 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
    ^^^^ this is OK

MII Status: up

[root@wlan-r2s5 NetworkManager]# nmcli connection modify bond connection.autoconnect-slaves 1 bond.options "mode=active-backup,active_slave=eth1"
[root@wlan-r2s5 NetworkManager]# nmcli connection up id bond 
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
[root@wlan-r2s5 NetworkManager]# cat /proc/net/bonding/nm-bond 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
    ^^^^ so far so good

so I changed it back to eth2 again and this doesn't work anymore
[root@wlan-r2s5 NetworkManager]# nmcli connection modify bond connection.autoconnect-slaves 1 bond.options "mode=active-backup,active_slave=eth2"
[root@wlan-r2s5 NetworkManager]# nmcli connection up id bond 
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)
[root@wlan-r2s5 NetworkManager]# cat /proc/net/bonding/nm-bond 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
                 ^^^^^^^^^^^^^^ this is wrong


[root@wlan-r2s5 NetworkManager]# cat /etc/sysconfig/network-scripts/ifcfg-bond 
DEVICE=nm-bond
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=bond
UUID=f57d0507-99f3-4e2d-91c6-9b1bcf4571c5
ONBOOT=yes
BONDING_OPTS="mode=active-backup active_slave=eth2"
                           ^^^^ this seems to be correct

some device disconnect of whole setup may help sometimes but this doesn't work everytime

when I disconnect everything and connect bond master with slaves together I get 
Currently Active Slave: eth1
even if:
BONDING_OPTS="mode=active-backup active_slave=eth2"

I can of course juggle with slaves but I think NM should respect that option and that connection should be set as currently active slave
 
Version-Release number of selected component (if applicable):
NetworkManager-1.4.0-0.1.git20160606.b769b4df.el7.x86_64

Comment 1 Thomas Haller 2016-06-20 12:38:34 UTC
I wonder if the "active_slave" setting in a connection make sense.

To me a ~connection~ is some a static description of configuration, while the active-slave is a setting that matters to a device (at runtime, so to say).



We already have ways to set properties on the device:

  nmcli device modify $IFACE <autoconnect|managed> 

maybe

  nmcli device modify $IFACE active-slave $SLAVE

would be a good fit.

Comment 2 Vladimir Benes 2016-06-20 13:45:06 UTC
(In reply to Thomas Haller from comment #1)
> I wonder if the "active_slave" setting in a connection make sense.
> 
> To me a ~connection~ is some a static description of configuration, while
> the active-slave is a setting that matters to a device (at runtime, so to
> say).
>
this is now valid option of BONDING_OPTS (not sure if it was ever supported by network script) so it's quite wrong if it's set when bond is created and then upped and there is something else in /sys/class/net/nm-bond/bonding/active_slave
 
> 
> 
> We already have ways to set properties on the device:
> 
>   nmcli device modify $IFACE <autoconnect|managed> 
> 
> maybe
> 
>   nmcli device modify $IFACE active-slave $SLAVE
> 
> would be a good fit.

yeah, maybe it may be nice to have these modifications here just valid at runtime.

Comment 3 Thomas Haller 2016-07-03 20:46:27 UTC
would be nice to do this via:

  nmcli device modify bond0 bond.active_slave eth0



the problem is, that nmcli treads bond options in an clumsy way, where there is only one "bond.options" property. So, in the current scheme, above command would look like

  nmcli device modify bond0 +bond.options "active_slave=eth0"

which is pretty bad.

Comment 4 Beniamino Galvani 2017-03-03 13:06:33 UTC
I would prefer to avoid adding other device properties for each bond options that can be changed at runtime. In my opinion the reapply facility is the way to go, even if the syntax might not be the easiest one for bonds.

Pushed branch bg/bond-reapply-rh1348198 for review.

Comment 5 Thomas Haller 2017-03-04 10:28:27 UTC
Branch looks good to me as is

Comment 6 Thomas Haller 2017-03-04 15:11:44 UTC
(In reply to Beniamino Galvani from comment #4)
> I would prefer to avoid adding other device properties for each bond options
> that can be changed at runtime. In my opinion the reapply facility is the
> way to go, even if the syntax might not be the easiest one for bonds.

I fully agree with this.

And I think our reapply mechanism and the settings-connection/applied-connection split is pretty awesome with lots of potential uses (like this feature).

Comment 9 errata-xmlrpc 2017-08-01 09:17:07 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/RHSA-2017:2299