RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2122522 - nmstate API was broken by changing veth type
Summary: nmstate API was broken by changing veth type
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: nmstate
Version: 9.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Gris Ge
QA Contact: Mingyu Shi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-30 08:25 UTC by Petr Horáček
Modified: 2023-12-06 08:30 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:31:48 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github nmstate nmstate pull 2025 0 None Merged veth: Show veth interface as `type: veth` 2022-09-13 09:25:09 UTC
Red Hat Issue Tracker NMT-203 0 None None None 2023-01-28 08:05:10 UTC
Red Hat Issue Tracker RHELPLAN-132673 0 None None None 2022-08-30 08:32:16 UTC
Red Hat Product Errata RHBA-2023:2190 0 None None None 2023-05-09 07:32:03 UTC

Description Petr Horáček 2022-08-30 08:25:27 UTC
Description of problem:
In older versions of nmstate, veth interfaces were clearly marked as `type: veth`. With new versions they are `type: ethernet`. This violated API compatibility, all the existing code depending on veths being marked as "veth" is now broken. Furthermore, it forces us to filter veths by looking at the `veth` key in the yaml. In OpenShift, the difference between veths and physical NICs is crucial, and we need a simple way to distinguish them.

Version-Release number of selected component (if applicable):
rust-based nmstate

How reproducible:
Always

Steps to Reproduce:
1. ip link add va type veth peer name vb
2. nmstatectl show

Actual results:
Veth interfaces are listed with `type: ethernet`.

Expected results:
Veth interfaces are listed with `type: veth`.

Additional info:

Comment 1 Gris Ge 2022-09-02 12:06:18 UTC
Patch sent to upstream: https://github.com/nmstate/nmstate/pull/2025


reviously, in order to simplify the code workflow, we are showing both
eth and normal ethernet as `type: ethernet`. This has break kubernetes
se case where they need it to identify the veth interfaces.

hanged to show veth interface as `type: veth`. When its peer is in
nother network namespace, hide the `veth` section.

xpand the integration test cases to cover these use cases:

* `test_eth_with_veth_conf`
  Desire state is desiring ethernet interface with veth configuration.
  Raise InvalidArgument error (NmstateValueError exception in python)

* `test_add_veth_with_ethernet_peer`
  Desire state contains both veth and veth peer interface. But veth
  peer interface is set as `type: ethernet`.

* `test_add_veth_with_veth_peer_in_desire`
  Desire state contains both veth and veth peer interface. Both veth
  and peer interfaces are set as `type: veth` with `veth` configure
  pointing to each other.

* `test_modify_veth_peer`
  Change veth peer. The old peer should be removed.

* `test_veth_without_peer_fails`
  When adding new veth(not exist) without veth peer defined in veth
  configure, raise InvalidArgument error (NmstateValueError exception
  in python).

* `test_change_veth_with_veth_type_without_veth_conf`
  With pre-exist veth, changing other configure with `type: veth` and
  no veth configure.

* `test_change_veth_with_eth_type_without_veth_conf`
  With pre-exist veth, changing other configure with `type: ethernet` and
  no veth configure.

* `test_veth_with_ignored_peer`
  With pre-exist veth and its peer marked as ignored (unmanaged by NM).
  Applying desire state with `type: veth` and veth configuration should
  not fail. And the veth configuration should be ignored.

* `test_veth_with_ignored_peer_changed_to_new_peer`
  With pre-exist veth and its peer marked as ignored (unmanaged by NM).
  Nmstate will raise InvalidArgument error (NmstateValueError exception
  in python) when user try to change its peer. Also have unit test case
  for this.

Comment 6 Mingyu Shi 2022-11-21 07:12:57 UTC
Verified with:
nmstate-2.2.1-1.el9.x86_64
NetworkManager-1.41.4-2.el9.x86_64
Linux dell-per740-80.rhts.eng.pek2.redhat.com 5.14.0-197.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 16 14:31:27 EST 2022 x86_64 x86_64 x86_64 GNU/Linux
DISTRO=RHEL-9.2.0-20221118.4

Now veth created by:
1. ip link add veth type veth peer veth_p
or
2. nmstate YAML:
interfaces:
- name: veth
  type: veth
  state: up
  veth:
    peer: veth_p

are both shown as "type: veth" in "nmstatectl show" output(rust).


Here's a summary:
In the python version, the veth created with:
1. `ip-link` is shown as "type: ethernet",
2. nmstate/NetworkManager is shows as "type: veth"
You can apply a state with the "type" value as "veth" or "ethernet" to change the result shown in `nmstatectl show`

In the older rust version, any veth is shown as "type: ethernet"

In the current rust version, any veth is shown as "type: veth". when applying a new state, using "type: ethernet" on a veth works, but nmstate only output "type: veth" in `nmstatectl show`

In all nmstate versions(including the current one), when you apply:
interfaces:
- name: veth
  type: veth
  state: absent

If the veth was created by `ip-link`, nmstate only removes its NM connection and keep itself there
If the veth was created by nmstate/NetworkManager, nmstate removes its NM connection and delete the veth from kernel too

Comment 7 Mingyu Shi 2022-11-21 07:16:41 UTC
Hi Petr,

Could you please review the comment above(#comment6) to see if everything's OK in openshift usage?

Comment 8 Petr Horáček 2022-11-25 08:34:46 UTC
Hello, this is exactly what I was looking for. Thank a lot for putting the effort into making the API fitting needs of OpenShift, much appreciated!

Comment 10 errata-xmlrpc 2023-05-09 07:31:48 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


Note You need to log in before you can comment on or make changes to this bug.