diff --git a/SOURCES/BZ-2148394_nm-Fix-moving-bridge-port-to-bond.patch b/SOURCES/BZ-2148394_nm-Fix-moving-bridge-port-to-bond.patch new file mode 100644 index 0000000..c712429 --- /dev/null +++ b/SOURCES/BZ-2148394_nm-Fix-moving-bridge-port-to-bond.patch @@ -0,0 +1,49 @@ +From d10202dee84756acff0be7144bbf0dd3f415f57a Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 30 Aug 2022 22:54:44 +0800 +Subject: [PATCH] nm: Fix moving bridge port to bond + +When moving bridge port with VLAN filtering setting to bond, we got +failure: + A connection with a 'bridge-port' setting must have the slave-type + set to 'bridge'. Instead it is 'bond' + +The root cause is we forgot to remove `NmSettingBridgePort` when +detaching port away from bridge. + +The fix is remove `NmSettingBridgePort` and +`NmSettingOvsBridgeInterface` if not bridge port or OVS interface +anymore. + +Integration test cases for linux bridge and OVS bridge are included. + +Signed-off-by: Gris Ge +(cherry picked from commit d2c40c3aade1d7764b84f0aafe8d3d907bb1c4a6) +--- + rust/src/lib/nm/connection.rs | 8 ++++++++ + tests/integration/linux_bridge_test.py | 15 ++++++++++++++- + tests/integration/ovs_test.py | 20 +++++++++++++++++++- + 3 files changed, 41 insertions(+), 2 deletions(-) + +diff --git a/rust/src/lib/nm/connection.rs b/rust/src/lib/nm/connection.rs +index 7fbf2631..91bd9077 100644 +--- a/rust/src/lib/nm/connection.rs ++++ b/rust/src/lib/nm/connection.rs +@@ -279,6 +279,14 @@ pub(crate) fn iface_to_nm_connections( + _ => (), + }; + ++ if nm_conn.controller_type() != Some(NM_SETTING_BRIDGE_SETTING_NAME) { ++ nm_conn.bridge_port = None; ++ } ++ ++ if nm_conn.controller_type() != Some(NM_SETTING_OVS_PORT_SETTING_NAME) { ++ nm_conn.ovs_iface = None; ++ } ++ + if let Some(Interface::LinuxBridge(br_iface)) = ctrl_iface { + gen_nm_br_port_setting(br_iface, &mut nm_conn); + } +-- +2.38.1 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 2240bdb..b75c4b7 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 2.1.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -12,6 +12,7 @@ Source0: https://github.com/nmstate/nmstate/releases/download/v%{version} Source1: https://github.com/nmstate/nmstate/releases/download/v%{version}/nmstate-%{version}.tar.gz.asc Source2: https://nmstate.io/nmstate.gpg Source3: https://github.com/nmstate/nmstate/releases/download/v%{version}/nmstate-vendor-%{version}.tar.xz +Patch0: BZ-2148394_nm-Fix-moving-bridge-port-to-bond.patch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: gnupg2 @@ -78,6 +79,7 @@ This package contains the Python 3 library for Nmstate. gpg2 --import --import-options import-export,import-minimal %{SOURCE2} > ./gpgkey-mantainers.gpg gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %setup -q +%patch0 -p1 pushd rust # Source3 is vendored dependencies @@ -150,6 +152,9 @@ popd /sbin/ldconfig %changelog +* Sat Nov 26 2022 Fernando Fernandez Mancera - 2.1.4-2 +- Fix moving bridge port to bond. RHBZ#2148394 + * Mon Aug 15 2022 Gris Ge - 2.1.4-1 - Upgrade to 2.1.4