Bug 1985629

Summary: simplify moving ovs port
Product: Red Hat Enterprise Linux 9 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: low    
Version: 9.1CC: ferferna, jiji, jishi, network-qe, sfaye, till
Target Milestone: betaKeywords: Triaged
Target Release: 9.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-2.2.2-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:30:59 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 2021-07-24 13:35:26 UTC
Description of problem:
When moving a port around bond, linux bridge, etc, people don't need to care about the old controller interface when applying the desired state.
Meanwhile, when moving an ovs port to another controller(such as a linux bridge), people have to deal with the ovs bridge(make it absent, or explicitly remove the target ovs port from `port` subtree). Please make it the same method.
Besides, sometimes nmstate gives a wrong reason when moving ovs port failed.

Version-Release number of selected component (if applicable):
nmstate-1.1.0-0.7.alpha7.el8.noarch
nispor-1.1.1-1.el8.x86_64
NetworkManager-1.32.2-1.el8.x86_64
openvswitch2.13-2.13.0-114.el8fdp.x86_64

How reproducible:
100%

Steps to Reproduce:
#step 1
nmstatectl apply << EOF -
interfaces:
- name: ovsbr0
  type: ovs-bridge
  state: up
  bridge:
    port:
    - name: veth0
    - name: ovsbr0
- name: veth0
  type: veth
  state: up
  veth:
    peer: veth0_p
EOF

#step 2, failed on verification
nmstatectl apply << EOF -
interfaces:
- name: br0
  type: linux-bridge
  state: up
  bridge:
    port:
    - name: veth0
EOF

#step 3, failed with wrong reason: "veth0 is already as port for interface br0"
nmstatectl apply << EOF -
interfaces:
- name: br0
  type: linux-bridge
  state: up
  bridge:
    port:
    - name: veth0
- name: ovsbr0
  type: ovs-bridge
  state: up
EOF

Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.1.0', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 74, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 353, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 417, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 87, in apply
    desired_state, ignored_ifnames, current_state, save_to_disk
  File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 51, in __init__
    gen_conf_mode,
  File "/usr/lib/python3.6/site-packages/libnmstate/ifaces/ifaces.py", line 165, in __init__
    self._pre_edit_validation_and_cleanup()
  File "/usr/lib/python3.6/site-packages/libnmstate/ifaces/ifaces.py", line 276, in _pre_edit_validation_and_cleanup
    self._validate_over_booked_port()
  File "/usr/lib/python3.6/site-packages/libnmstate/ifaces/ifaces.py", line 816, in _validate_over_booked_port
    f"Interface {iface.name} port {port_name} is "
libnmstate.error.NmstateValueError: Interface ovsbr0 port veth0 is already as port for interface br0

Actual results:
Failed at step 2 and 3

Expected results:
No failure

Additional info:

Comment 2 Gris Ge 2022-11-28 09:28:23 UTC
This is cosmetic issue. Will only fix in RHEL 9

Comment 3 Gris Ge 2022-12-09 04:43:42 UTC
Patch posted to upstream: https://github.com/nmstate/nmstate/pull/2150

Comment 6 Mingyu Shi 2022-12-21 05:45:38 UTC
Verified with:
nmstate-2.2.2-2.el9.x86_64
NetworkManager-1.41.6-1.el9.x86_64
openvswitch2.15-2.15.0-76.el9fdp.x86_64
DISTRO=RHEL-9.2.0-20221220.0

It fixed step 2 only, but it now makes sense to me, isn't a big issue.
If ovsbr0 is explicitly mentioned in the desired state(step 3), user needs to handle ovsbr0's port list.

Comment 8 errata-xmlrpc 2023-05-09 07:30:59 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-2023:2190