diff --git a/SOURCES/BZ_1858758-fix_ovs_bond.patch b/SOURCES/BZ_1858758-fix_ovs_bond.patch new file mode 100644 index 0000000..d71cfcd --- /dev/null +++ b/SOURCES/BZ_1858758-fix_ovs_bond.patch @@ -0,0 +1,40 @@ +From 862e669fcfe02b49c0e24af210d6466197962b97 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Mon, 3 Aug 2020 11:34:44 +0800 +Subject: [PATCH] ovs: Fix bug when adding bond to existing bridge + +When adding OVS bond/link aggregation interface to existing OVS bridge, +nmstate will fail with error: + + > self._ifaces[slave_name].mark_as_changed() + E KeyError: 'bond1' + +This is because ovs bond interface does not require a interface entry in +desire state. + +Fixed by check before adding dict. + +Integration test case added. + +Signed-off-by: Gris Ge +--- + libnmstate/ifaces/ifaces.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libnmstate/ifaces/ifaces.py b/libnmstate/ifaces/ifaces.py +index a400712..1c2ffd5 100644 +--- a/libnmstate/ifaces/ifaces.py ++++ b/libnmstate/ifaces/ifaces.py +@@ -217,7 +217,8 @@ class Ifaces: + self._ifaces[iface_name].mark_as_changed() + if cur_iface: + for slave_name in iface.config_changed_slaves(cur_iface): +- self._ifaces[slave_name].mark_as_changed() ++ if slave_name in self._ifaces: ++ self._ifaces[slave_name].mark_as_changed() + + def _match_child_iface_state_with_parent(self): + """ +-- +2.28.0 + diff --git a/SOURCES/BZ_1859844-fix_converting_memory_only.patch b/SOURCES/BZ_1859844-fix_converting_memory_only.patch new file mode 100644 index 0000000..ef80e65 --- /dev/null +++ b/SOURCES/BZ_1859844-fix_converting_memory_only.patch @@ -0,0 +1,59 @@ +From fc7e6b2329409b95ab1726b7b65f14c284bf67ab Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Mon, 3 Aug 2020 12:07:56 +0800 +Subject: [PATCH] nm: Fix converting memory-only profile to persistent + +When converting memory-only profile to persistent using simple desire +state with `state: up` only, the memory only profile will not be +converted to persistent. + +This is caused by `nm/applier.py` skip profile creation if desire state +is only `state: up`. + +The fix is checking whether current profile's persistent state is equal +to desired. + +Integration test case added. + +Signed-off-by: Gris Ge +--- + libnmstate/nm/applier.py | 1 + + libnmstate/nm/connection.py | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/libnmstate/nm/applier.py b/libnmstate/nm/applier.py +index 4d40862..26a057f 100644 +--- a/libnmstate/nm/applier.py ++++ b/libnmstate/nm/applier.py +@@ -125,6 +125,7 @@ def apply_changes(context, net_state, save_to_disk): + and cur_con_profile + and cur_con_profile.profile + and not net_state.ifaces[ifname].is_changed ++ and cur_con_profile.is_memory_only != save_to_disk + ): + # Don't create new profile if original desire does not ask + # anything besides state:up and not been marked as changed. +diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py +index 5804f13..1f6c734 100644 +--- a/libnmstate/nm/connection.py ++++ b/libnmstate/nm/connection.py +@@ -162,6 +162,16 @@ class ConnectionProfile: + assert self._con_profile is None + self._con_profile = con_profile + ++ @property ++ def is_memory_only(self): ++ if self._con_profile: ++ profile_flags = self._con_profile.get_flags() ++ return ( ++ NM.SettingsConnectionFlags.UNSAVED & profile_flags ++ or NM.SettingsConnectionFlags.VOLATILE & profile_flags ++ ) ++ return False ++ + @property + def devname(self): + if self._con_profile: +-- +2.28.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index c424a26..02137e4 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 0.3.4 -Release: 7%{?dist} +Release: 9%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -15,6 +15,8 @@ Patch1: BZ_1858762-hide_ovs_patch_port_mtu.patch Patch2: BZ_1861263-handle-external-managed-interface.patch Patch3: BZ_1861668_ignore_unknown_iface.patch Patch4: BZ_1862025-remove_existing_profiles.patch +Patch5: BZ_1858758-fix_ovs_bond.patch +Patch6: BZ_1859844-fix_converting_memory_only.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -85,6 +87,12 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Tue Aug 04 2020 Gris Ge - 0.3.4-9 +- Fix converting memory only profile to persistent. RHBZ#1859844 + +* Mon Aug 03 2020 Gris Ge - 0.3.4-8 +- Fix failure when adding ovs bond to existing bridge. RHBZ#1858758 + * Thu Jul 30 2020 Gris Ge - 0.3.4-7 - Remove existing inactivate NM profiles. RHBZ#1862025