From 58157ec619b0963f18b48ae163a8b61cbf1f3cf1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 31 2020 18:51:00 +0000 Subject: import nmstate-0.3.4-7.el8 --- diff --git a/SOURCES/BZ_1862025-remove_existing_profiles.patch b/SOURCES/BZ_1862025-remove_existing_profiles.patch new file mode 100644 index 0000000..2a07082 --- /dev/null +++ b/SOURCES/BZ_1862025-remove_existing_profiles.patch @@ -0,0 +1,68 @@ +From 3c5337a22273717df6fb51818216816bbff77035 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 30 Jul 2020 16:54:40 +0800 +Subject: [PATCH] nm profile: Remove inactivate profile of desired interface + +For changed/desired interface, NM should remove all its inactive +profiles so that it could update and activate the same one. + +Integration test case included. + +Signed-off-by: Gris Ge +--- + libnmstate/nm/applier.py | 10 +++++++++- + libnmstate/nm/connection.py | 9 +++++++-- + 2 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/libnmstate/nm/applier.py b/libnmstate/nm/applier.py +index 9cd8f9a..4d40862 100644 +--- a/libnmstate/nm/applier.py ++++ b/libnmstate/nm/applier.py +@@ -105,6 +105,15 @@ def apply_changes(context, net_state, save_to_disk): + cur_con_profile = connection.ConnectionProfile( + context, profile=con_profile + ) ++ ++ if save_to_disk: ++ # TODO: Need handle save_to_disk=False ++ connection.delete_iface_profiles_except( ++ context, ++ ifname, ++ cur_con_profile.profile if cur_con_profile else None, ++ ) ++ + original_desired_iface_state = {} + if net_state.ifaces.get(ifname): + iface = net_state.ifaces[ifname] +@@ -137,7 +146,6 @@ def apply_changes(context, net_state, save_to_disk): + con_profiles.append(new_con_profile) + else: + # Missing connection, attempting to create a new one. +- connection.delete_iface_inactive_connections(context, ifname) + new_con_profile.add(save_to_disk) + con_profiles.append(new_con_profile) + context.wait_all_finish() +diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py +index 02890bc..5804f13 100644 +--- a/libnmstate/nm/connection.py ++++ b/libnmstate/nm/connection.py +@@ -496,9 +496,14 @@ def get_device_active_connection(nm_device): + return active_conn + + +-def delete_iface_inactive_connections(context, ifname): ++def delete_iface_profiles_except(context, ifname, excluded_profile): + for con in list_connections_by_ifname(context, ifname): +- con.delete() ++ if ( ++ not excluded_profile ++ or not con.profile ++ or con.profile.get_uuid() != excluded_profile.get_uuid() ++ ): ++ con.delete() + + + def list_connections_by_ifname(context, ifname): +-- +2.28.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 3286a37..c424a26 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 0.3.4 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -14,6 +14,7 @@ Source2: https://www.nmstate.io/nmstate.gpg 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 BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -84,6 +85,9 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Thu Jul 30 2020 Gris Ge - 0.3.4-7 +- Remove existing inactivate NM profiles. RHBZ#1862025 + * Wed Jul 29 2020 Gris Ge - 0.3.4-6 - New build to retrigger the CI gating.