Bug 1533830

Summary: team values should return to runner's default when empty value entered in nmcli
Product: Red Hat Enterprise Linux 7 Reporter: Vladimir Benes <vbenes>
Component: NetworkManagerAssignee: Francesco Giudici <fgiudici>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: atragler, bgalvani, fgiudici, jreznik, lmiksik, lrintel, rkhan, sukulkar, thaller
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: NetworkManager-1.10.2-11.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 13:35:58 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:
Attachments:
Description Flags
libnm-core: ensure alignment of team.config and other team properties none

Description Vladimir Benes 2018-01-12 10:35:03 UTC
Description of problem:
when 
nmcli> set team.runner-agg-select-policy
Allowed values for 'runner-agg-select-policy' property: lacp_prio, lacp_prio_stable, bandwidth, count, port_config
Enter 'runner-agg-select-policy' value: 
nmcli> print
<snip>
team.config:                            {"runner": {"name": "lacp", "tx_hash": ["eth", "ipv4", "ipv6"], "tx_balancer": {"balancing_interval": 0}, "agg_select_policy": "count"}}
team.notify-peers-count:                0 (disabled)
team.notify-peers-interval:             0 (default)
team.mcast-rejoin-count:                0 (disabled)
team.mcast-rejoin-interval:             0 (default)
team.runner:                            lacp
team.runner-hwaddr-policy:              --
team.runner-tx-hash:                    eth,ipv4,ipv6
team.runner-tx-balancer:                --
team.runner-tx-balancer-interval:       0
team.runner-active:                     yes
team.runner-fast-rate:                  no
team.runner-sys-prio:                   255 (default)
team.runner-min-ports:                  0 (default)
team.runner-agg-select-policy:          --
^^ here it should go to default value for the runner as -- is incorrect and it leads to inconsistent state

nmcli> sa
Connection 'team' (f2cf351b-a3a0-4e63-979b-7103c716a205) successfully updated.
nmcli> ac
Error: connection is not saved. Type 'save' first.

This issue is quite generic and should work with all values that has some defaults (so here min-ports,sys-prio, etc)  

Version-Release number of selected component (if applicable):
1.10.3

Comment 1 Francesco Giudici 2018-01-19 11:52:26 UTC
Created attachment 1383340 [details]
libnm-core: ensure alignment of team.config and other team properties

There are two different behaviors here:
1) string properties specific to runners (runner-hwaddr-policy,  runner-tx-hash and runner-agg-select-policy) and runner-tx-hash: when set in nmcli editor, the alignment with the team.config property is not performed. When performed (when saving for instance) the alignment routine is run, bringing back the expected default value (runner dependent). This caused nmcli editor to report "connection is not saved" when quitting as the connection did not changed indeed despite the save. Moreover, what previewed with the "print" command was wrong.

2) integer properties set to no value, would set '0'. This would be properly shown with "print" and saved when "save" is call.
Note that 0 is a legit value there.
The right way to set them to their default value, is to set them with the "default" keyword. What we should expect when setting them to "", could be argued. I would let this as is.

So, addressing just point 1.

Please review attached patch.

Comment 2 Thomas Haller 2018-01-22 10:27:21 UTC
(In reply to Francesco Giudici from comment #1)
> Created attachment 1383340 [details]
> libnm-core: ensure alignment of team.config and other team properties

lgtm

Comment 3 Francesco Giudici 2018-01-22 18:19:53 UTC
(In reply to Thomas Haller from comment #2)
> (In reply to Francesco Giudici from comment #1)
> > Created attachment 1383340 [details]
> > libnm-core: ensure alignment of team.config and other team properties
> 
> lgtm

Thanks.
Merged upstream on master and nm-1-10
https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=381c1a19b6d1903ec3d791df8d8a933fd9c306f3
https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=fa3efd3ed6d91447d24e6f3f3d6c58180a0c36f0

Comment 7 errata-xmlrpc 2018-04-10 13:35:58 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/RHBA-2018:0778