From 2fdd0090764bd411d1c199f4af0cb993d24567b4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Feb 28 2023 18:13:58 +0000 Subject: import nmstate-1.4.2-4.el8 --- diff --git a/SOURCES/BZ_2160416-Ignore-error-when-creating-profile-if-not-desired.patch b/SOURCES/BZ_2160416-Ignore-error-when-creating-profile-if-not-desired.patch new file mode 100644 index 0000000..f7aa1d6 --- /dev/null +++ b/SOURCES/BZ_2160416-Ignore-error-when-creating-profile-if-not-desired.patch @@ -0,0 +1,66 @@ +From d7d732332e486cd8969ff4b5ef95a24cb68b5441 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Mon, 27 Feb 2023 12:17:05 +0800 +Subject: [PATCH] nm: Ignore error when creating profile if not desired + +When a undesired interface holding `autoconf: true` and `dhcp: false` +for IPv6, nmstate will fail with error: + + Autoconf without DHCP is not supported yet + +This is caused by `nm/connection.py` try to create `NM.SimpleConnection` +for every interface even not desired. + +This patch changed to: + * Only create new `NM.SimpleConnection` when desired or changed. + * Use current profile if exists when not desired or changed. + * Ignore error if not desired/changed. + +Integration test case included. + +Signed-off-by: Gris Ge +--- + libnmstate/nm/profile.py | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/libnmstate/nm/profile.py b/libnmstate/nm/profile.py +index ad1ad19f..1119cd1a 100644 +--- a/libnmstate/nm/profile.py ++++ b/libnmstate/nm/profile.py +@@ -24,6 +24,7 @@ from distutils.version import StrictVersion + import logging + import time + ++from libnmstate.error import NmstateError + from libnmstate.error import NmstateInternalError + from libnmstate.error import NmstateLibnmError + from libnmstate.error import NmstateNotSupportedError +@@ -321,9 +322,22 @@ class NmProfile: + # TODO: Use applied config as base profile + # Or even better remove the base profile argument as top level + # of nmstate should provide full/merged configure. +- self._nm_simple_conn = create_new_nm_simple_conn( +- self._iface, self._nm_profile +- ) ++ if self._iface.is_changed or self._iface.is_desired: ++ self._nm_simple_conn = create_new_nm_simple_conn( ++ self._iface, self._nm_profile ++ ) ++ elif self._nm_profile: ++ self._nm_simple_conn = NM.SimpleConnection.new_clone( ++ self._nm_profile ++ ) ++ else: ++ try: ++ self._nm_simple_conn = create_new_nm_simple_conn( ++ self._iface, self._nm_profile ++ ) ++ # No error for undesired interface ++ except NmstateError: ++ pass + + def save_config(self, save_to_disk): + self._check_sriov_support() +-- +2.39.2 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 0ec0b15..3eb6f65 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 1.4.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -16,6 +16,7 @@ Source3: %{url}/releases/download/v%{version}/%{srcname}-vendor-%{version Patch0: BZ_2132570-nm-reverse-IPv6-order-before-adding-them-to-setting.patch Patch11: Enable_clib_yml_api.patch Patch12: BZ_2160416-fix-SRIOV.patch +Patch13: BZ_2160416-Ignore-error-when-creating-profile-if-not-desired.patch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: gnupg2 @@ -150,6 +151,9 @@ popd /sbin/ldconfig %changelog +* Mon Feb 27 2023 Gris Ge - 1.4.2-4 +- Ignore undesired iface config. RHBZ#2160416 + * Thu Feb 23 2023 Gris Ge - 1.4.2-3 - Additional patch for SR-IOV. RHBZ#2160416