Bug 1810339

Summary: Don't show unavailable bond options for the current mode
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: low    
Version: 8.2CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-0.3.2-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 03:08:25 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 Mingyu Shi 2020-03-05 02:14:51 UTC
Description of problem:
Now nmstate only prints the options that diff with default value of libnm. But in fact some options are only available on the specific modes. Such as 'ad_actor_sys_prio' has a default value of 65535 on libnm, it is only available for mode 802.3ad and set as empty for the other modes. In such a circumstance, it will be printed maybe because of it's empty value diffs with 65535.

Version-Release number of selected component (if applicable):
nmstate-0.2.6-1.el8.noarch
NetworkManager-1.22.8-3.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
# cat bond1.yaml
---
interfaces:
- name: bond1
  type: bond
  state: up
  link-aggregation:
    mode: active-backup

1. nmstatectl set bond1.yaml
2. nmstatectl show bond1
3. You can see the following two options are printed, but they are only available on 802.3ad mode.
ad_actor_sys_prio: ''
ad_user_port_key: ''

Actual results:
ad_actor_sys_prio and ad_user_port_key reported.

Expected results:
Don't report any unavailable options

Additional info:

Comment 1 Gris Ge 2020-03-13 13:04:11 UTC
This is decorative and NetworkManager intend to change a lot on this bond options handling in RHEL 8.3.

Moving bug to RHEL 8.3.

Comment 4 Mingyu Shi 2020-06-23 10:56:17 UTC
verion:
nmstate-0.3.2-1.el8.noarch
NetworkManager-1.26.0-0.1.el8.x86_64
DISTRO=RHEL-8.3.0-20200616.0
Linux hp-dl388g8-08.rhts.eng.pek2.redhat.com 4.18.0-214.el8.x86_64 #1 SMP Fri Jun 12 08:55:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


#do the following:
rmiface ()
{ 
    echo interfaces: > /tmp/rmiface_temp.yaml;
    for ifname in "$@";
    do
        if echo $ifname | grep --color=auto %; then
            ifilter=`echo $ifname | sed 's/%/.*/g'`;
            iflist=`nmstatectl show | grep "^- name: $ifilter" | awk '{print $3}'`;
            for iface in $iflist;
            do
                echo -e "- name: $iface\n  state: absent" >> /tmp/rmiface_temp.yaml;
            done;
        else
            echo -e "- name: $ifname\n  state: absent" >> /tmp/rmiface_temp.yaml;
        fi;
    done;
    nmstatectl set /tmp/rmiface_temp.yaml
}

for mode in balance-tlb balance-alb balance-rr active-backup balance-xor broadcast 802.3ad; do
    echo =============================================== $mode ==================================================
    cat << EOF > $mode.yaml
interfaces:
- name: bond0
  type: bond
  state: up
  link-aggregation:
    mode: $mode
    slaves:
    - veth1
    - veth0
EOF
    nmstatectl set $mode.yaml
    nmstatectl show bond0 > state-$mode.yaml
    rmiface bond0
done

# when done, check state-*.yaml, for all the modes, there is only one option 'miimon', and if you change the mode of an existing bond without explicitly set values, it will set all the options to default

Comment 7 errata-xmlrpc 2020-11-04 03:08:25 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 (nmstate 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/RHBA-2020:4696