You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.3 KiB
67 lines
2.3 KiB
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
|
|
|