nmstate/SOURCES/BZ_2139698-nm-sriov-Do-not-touch-SR-IOV-if-not-desired.patch
2023-01-12 09:27:40 +00:00

55 lines
1.7 KiB
Diff

From 2786e426173ed4a930dca23e18756123fc9b0e3a Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Mon, 26 Sep 2022 14:42:28 +0800
Subject: [PATCH 1/2] nm sriov: Do not touch SR-IOV if not desired
We should not create SRIOV settings in NetworkManager if that is not
desired.
Integration test case included.
Manual test been done on Mellanox MT27710(mlx5).
Signed-off-by: Gris Ge <fge@redhat.com>
---
libnmstate/nm/connection.py | 2 +-
libnmstate/nm/sriov.py | 8 ++--
tests/integration/nm/sriov_test.py | 62 ++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py
index 9beb7d18..535179ef 100644
--- a/libnmstate/nm/connection.py
+++ b/libnmstate/nm/connection.py
@@ -210,7 +210,7 @@ def create_new_nm_simple_conn(iface, nm_profile):
if vxlan_setting:
settings.append(vxlan_setting)
- sriov_setting = create_sriov_setting(iface_info, nm_profile)
+ sriov_setting = create_sriov_setting(iface, nm_profile)
if sriov_setting:
settings.append(sriov_setting)
diff --git a/libnmstate/nm/sriov.py b/libnmstate/nm/sriov.py
index 4aa73e86..74513cb7 100644
--- a/libnmstate/nm/sriov.py
+++ b/libnmstate/nm/sriov.py
@@ -47,11 +47,11 @@ SRIOV_NMSTATE_TO_NM_MAP = {
}
-def create_setting(iface_state, base_con_profile):
+def create_setting(iface, base_con_profile):
sriov_setting = None
- sriov_config = iface_state.get(Ethernet.CONFIG_SUBTREE, {}).get(
- Ethernet.SRIOV_SUBTREE
- )
+ sriov_config = iface.original_desire_dict.get(
+ Ethernet.CONFIG_SUBTREE, {}
+ ).get(Ethernet.SRIOV_SUBTREE)
if base_con_profile:
sriov_setting = base_con_profile.get_setting_by_name(
--
2.37.3