Bug 1876577

Summary: Modifying bond active slave fails over "failed: Can't reapply 'active_slave' bond option"
Product: Red Hat Enterprise Linux 8 Reporter: msheena
Component: NetworkManagerAssignee: Thomas Haller <thaller>
Status: CLOSED ERRATA QA Contact: Vladimir Benes <vbenes>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.3CC: acardace, atragler, bgalvani, dholler, lrintel, mburman, rkhan, sukulkar, thaller, till, vbenes
Target Milestone: rcKeywords: Automation, Regression, Triaged
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: NetworkManager-1.28.0-0.1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 13:29:41 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:

Description msheena 2020-09-07 15:02:06 UTC
Description of problem
======================
Given I have a RHEL 8.3 machine with a bond in mode 1 comprised of 2 slaves: enp2s0f1, enp2s0f2 where enp2s0f2 is the active slave
When I run the command:
nmcli dev mod bond01 +bond.options active_slave=enp2s0f1
Then I get a return-code of 6 and a message:
Error: Reapplying connection to device 'bond01' (/org/freedesktop/NetworkManager/Devices/3) failed: Can't reapply 'active_slave' bond option

Version-Release number of selected component (if applicable)
============================================================
Red Hat Enterprise Linux release 8.3 Beta (Ootpa) (4.18.0-235.el8.x86_64)
NetworkManager-1.26.0-7.el8.x86_64
nmstate-0.3.4-12.el8.noarch

How reproducible
================
100%

Steps to Reproduce
==================
1. Create a bond in mode 1 with two slaves
2. Run the command nmcli dev mod <bond_name> +bond.options active_slave=<non active slave>

Actual results
==============
Active slave substitution fails and the message outputted is:
Error: Reapplying connection to device 'bond01' (/org/freedesktop/NetworkManager/Devices/3) failed: Can't reapply 'active_slave' bond option

Expected results
================
Active slave is changed successfully

Additional info
===============
The command:
ifenslave -c bond01 enp2s0f1
works successfully and changes the active slave.

This is a regression from RHEL 8.2.1 NetworkManager-1.22.8-5.el8_2.x86_64 nmstate-0.2.10-1.el8.noarch

Comment 2 Thomas Haller 2020-09-07 16:06:54 UTC
odd, I would have thought this should be fixed with bug 1847814.

by: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/ac6f21cae442bb35b08337f14a97d6ae3f71b52a

which is also backported to latest rhel-8.3:

Changelog:

  * Tue Aug 11 2020 Antonio Cardace <acardace> - 1:1.26.0-4
  - bond: fix Reapply does not update bond options (rh #1847814)




It's because [1] does not whitelist active_slave as a property that can be changed via reapply.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/2cb40f6e36ce8db8257b07e15fe1bb9a47ce64f3/src/devices/nm-device-bond.c#L544


Presumably, this was not done to only support reapply of options that can be changed without taking the interface down.
However, "active_slave" does not appear to require the interface to be up -- so this is wrong.


Also, not the discussion at https://bugzilla.redhat.com/show_bug.cgi?id=1856640#c19 about active_slave. I think setting that option doesn't work well anyway, and well deprecate this property. Set instead "primary" option.

Comment 3 Michael Burman 2020-09-09 08:14:33 UTC
(In reply to Thomas Haller from comment #2)
> odd, I would have thought this should be fixed with bug 1847814.
> 
> by:
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/
> ac6f21cae442bb35b08337f14a97d6ae3f71b52a
> 
> which is also backported to latest rhel-8.3:
> 
> Changelog:
> 
>   * Tue Aug 11 2020 Antonio Cardace <acardace> - 1:1.26.0-4
>   - bond: fix Reapply does not update bond options (rh #1847814)
> 
> 
> 
> 
> It's because [1] does not whitelist active_slave as a property that can be
> changed via reapply.
> 
> [1]
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/
> 2cb40f6e36ce8db8257b07e15fe1bb9a47ce64f3/src/devices/nm-device-bond.c#L544
> 
> 
> Presumably, this was not done to only support reapply of options that can be
> changed without taking the interface down.
> However, "active_slave" does not appear to require the interface to be up --
> so this is wrong.
> 
> 
> Also, not the discussion at
> https://bugzilla.redhat.com/show_bug.cgi?id=1856640#c19 about active_slave.
> I think setting that option doesn't work well anyway, and well deprecate
> this property. Set instead "primary" option.

Hi Thomas, thanks for the hint.
So far the active_slave worked for just fine, stopped working right after we moved to rhel8.3
I tried the primary option instead and it works as you said.
We will change our test accordingly, thanks. 
btw, if the active_slave gonna be deprecated or doesn't work properly as you say, it should be documented somehow and removed from the +bond.options --help

nmcli dev mod bond0 +bond.options --help
Error: failed to modify bond.options: '--help' not among [mode, miimon, downdelay, updelay, arp_interval, arp_ip_target, arp_validate, primary, primary_reselect, fail_over_mac, use_carrier, ad_select, xmit_hash_policy, resend_igmp, lacp_rate, active_slave, ad_actor_sys_prio, ad_actor_system, ad_user_port_key, all_slaves_active, arp_all_targets, min_links, num_grat_arp, num_unsol_na, packets_per_slave, tlb_dynamic_lb, lp_interval].

Comment 4 Beniamino Galvani 2020-09-09 08:28:15 UTC
I agree that the 'primary' option should be used instead; maybe, for backwards compatibility we should translate 'active_slave' into 'primary' as suggested in bug 1856640. At the same time, we should also emit a warning saying that 'active_slave' is deprecated, and remove it from documentation.

Comment 6 Thomas Haller 2020-09-11 10:03:30 UTC
the workaround is to avoid "active_slave" option. In NetworkManager 1.28+ ([1]) this will become a deprecated alias for "primary".
So, start already using only the "primary" option.

(one problem is, that the primary option only works with "active-backup" mode. That will also be fix with [1]).


[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/75ff7a6daf705957d91054ae435f57b49a2437cc

Comment 10 Vladimir Benes 2020-10-02 14:12:17 UTC
CI tests changed to cover this too:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/645

Comment 13 errata-xmlrpc 2021-05-18 13:29:41 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 (Moderate: NetworkManager and libnma security, bug fix, and enhancement update), 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-2021:1574