111 lines
3.9 KiB
Diff
111 lines
3.9 KiB
Diff
From cd41c2c0f6bef7b952648b358246fffa8ce3cf62 Mon Sep 17 00:00:00 2001
|
|
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
Date: Thu, 2 Sep 2021 17:39:59 +0200
|
|
Subject: [PATCH 1/2] nm.connection: add postfixes to OVS bridges and
|
|
interfaces connections
|
|
|
|
When configuring an OVS bridge and interface with the same using
|
|
Nmstate, it will generate two connection with the same name. If the user
|
|
is willing to use nmcli to manage this profiles, it is not user friendly
|
|
because they will need to use the connection UUID instead.
|
|
|
|
In order to solve this, Nmstate is adding a postfix on the connection
|
|
name. "-if" for OVS interface and "-br" for OVS bridge.
|
|
|
|
Please, note that this issue does not affect kernel interfaces because
|
|
it is not possible to have duplicated interfaces names in kernel.
|
|
|
|
Integration test case added.
|
|
|
|
Ref: https://bugzilla.redhat.com/1998218
|
|
|
|
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
---
|
|
libnmstate/nm/connection.py | 14 +++++++++++++-
|
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py
|
|
index 39eb2b5..afe3788 100644
|
|
--- a/libnmstate/nm/connection.py
|
|
+++ b/libnmstate/nm/connection.py
|
|
@@ -114,8 +114,20 @@ def create_new_nm_simple_conn(iface, nm_profile):
|
|
if nm_profile and not is_multiconnect_profile(nm_profile):
|
|
con_setting.import_by_profile(nm_profile, iface.is_controller)
|
|
else:
|
|
+ # OVS bridge and interfaces could sharing the same interface name, to
|
|
+ # distinguish them at NM connection level, instead of using interface
|
|
+ # name as connection name, we append a postfix.
|
|
+ con_name = iface.name
|
|
+ if iface.type == InterfaceType.OVS_BRIDGE:
|
|
+ con_name = con_name + "-br"
|
|
+ elif iface.type == InterfaceType.OVS_INTERFACE:
|
|
+ con_name = con_name + "-if"
|
|
+
|
|
con_setting.create(
|
|
- iface.name, iface.name, nm_iface_type, iface.is_controller
|
|
+ con_name,
|
|
+ iface.name,
|
|
+ nm_iface_type,
|
|
+ iface.is_controller,
|
|
)
|
|
|
|
apply_lldp_setting(con_setting, iface_info)
|
|
--
|
|
2.27.0
|
|
|
|
|
|
From cfdd5afb1ef136d613d5adb3f6f5f6d156962586 Mon Sep 17 00:00:00 2001
|
|
From: Radim Hrazdil <rhrazdil@redhat.com>
|
|
Date: Wed, 10 Nov 2021 16:57:08 +0100
|
|
Subject: [PATCH 2/2] ovs: remove ovs-port prefix
|
|
|
|
Prepending the prefix causes ovnkube-node pods to crash.
|
|
This change adds -port postfix to ovs-interface connection instead.
|
|
|
|
Signed-off-by: Radim Hrazdil <rhrazdil@redhat.com>
|
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
---
|
|
libnmstate/nm/connection.py | 2 ++
|
|
libnmstate/nm/ovs.py | 4 +---
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py
|
|
index afe3788..fb4ceba 100644
|
|
--- a/libnmstate/nm/connection.py
|
|
+++ b/libnmstate/nm/connection.py
|
|
@@ -122,6 +122,8 @@ def create_new_nm_simple_conn(iface, nm_profile):
|
|
con_name = con_name + "-br"
|
|
elif iface.type == InterfaceType.OVS_INTERFACE:
|
|
con_name = con_name + "-if"
|
|
+ elif iface.type == InterfaceType.OVS_PORT:
|
|
+ con_name = con_name + "-port"
|
|
|
|
con_setting.create(
|
|
con_name,
|
|
diff --git a/libnmstate/nm/ovs.py b/libnmstate/nm/ovs.py
|
|
index 424df36..9f2cba0 100644
|
|
--- a/libnmstate/nm/ovs.py
|
|
+++ b/libnmstate/nm/ovs.py
|
|
@@ -32,8 +32,6 @@ from libnmstate.schema import OvsDB
|
|
from .common import NM
|
|
|
|
|
|
-PORT_PROFILE_PREFIX = "ovs-port-"
|
|
-
|
|
CONTROLLER_TYPE_METADATA = "_controller_type"
|
|
CONTROLLER_METADATA = "_controller"
|
|
SETTING_OVS_EXTERNALIDS = "SettingOvsExternalIDs"
|
|
@@ -311,7 +309,7 @@ def create_iface_for_nm_ovs_port(iface):
|
|
if ovs.is_ovs_lag_port(port_options):
|
|
port_name = port_options[OB.Port.NAME]
|
|
else:
|
|
- port_name = PORT_PROFILE_PREFIX + iface_name
|
|
+ port_name = iface_name
|
|
return OvsPortIface(
|
|
{
|
|
Interface.NAME: port_name,
|
|
--
|
|
2.27.0
|
|
|