Auto sync2gitlab import of nmstate-1.4.2-4.el8.src.rpm

This commit is contained in:
CentOS Sources 2023-02-28 18:14:13 +00:00
parent 4c49a0b3de
commit ed373ad793
3 changed files with 71 additions and 2 deletions

View File

@ -0,0 +1,66 @@
From d7d732332e486cd8969ff4b5ef95a24cb68b5441 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
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 <fge@redhat.com>
---
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

View File

@ -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 <fge@redhat.com> - 1.4.2-4
- Ignore undesired iface config. RHBZ#2160416
* Thu Feb 23 2023 Gris Ge <fge@redhat.com> - 1.4.2-3
- Additional patch for SR-IOV. RHBZ#2160416

View File

@ -1,3 +1,2 @@
SHA512 (nmstate-1.4.2.tar.gz) = e99d600d2c2921b614e8236d1ce651eee6a94a091a5a60946393bf84c7af2169b39cb8e2577dbfcf54ade9d0e527e73d52be4e356def19c99277870b1b853690
SHA512 (nmstate-vendor-1.4.2.tar.xz) = 1109d4a803313205d2a7e63eaee44f181c013b7dd3e5d698931e2f2a68ea3ef736dd3c16afc0960852c85a1db1918d1f2f6edb6ab917bca447f8f5ea48bc827e
SHA512 (nmstate.gpg) = 91c6b1d8aef4944520d4bdd4e90121bbbbaf772444f5eb6081cee81e17b21b66798437cdc09a117c6fc77c54d798aaa30400857aa090cb2102b47841f45cf6eb