From e3e53c470a6963797c4460d5b6c2f033cf6eb2bd Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 26 2021 12:37:32 +0000 Subject: import nmstate-1.1.0-2.el8 --- diff --git a/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch b/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch new file mode 100644 index 0000000..5084811 --- /dev/null +++ b/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch @@ -0,0 +1,53 @@ +From 99c7f643bab33a26c317e1b72ca3b8490cb1ea60 Mon Sep 17 00:00:00 2001 +From: Fernando Fernandez Mancera +Date: Fri, 16 Jul 2021 08:57:27 +0200 +Subject: [PATCH 1/2] nmstatectl: fix long arguments support + +The support for long arguments is broken. This patch is fixing it and +solving the following errors: + +``` +[root@d0b4a6a0f7a5 nmstate-workspace]# nmstatectl show --running-config +usage: nmstatectl [-h] [--version] + {commit,edit,rollback,set,apply,show,version,gc} ... +nmstatectl: error: unrecognized arguments: --running-config +[root@d0b4a6a0f7a5 nmstate-workspace]# nmstatectl show --show-secrets +usage: nmstatectl [-h] [--version] + {commit,edit,rollback,set,apply,show,version,gc} ... +nmstatectl: error: unrecognized arguments: --show-secrets +``` + +Integration test case added. + +Signed-off-by: Fernando Fernandez Mancera +Signed-off-by: Gris Ge +--- + nmstatectl/nmstatectl.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/nmstatectl/nmstatectl.py b/nmstatectl/nmstatectl.py +index a9f4cb6..6f83069 100644 +--- a/nmstatectl/nmstatectl.py ++++ b/nmstatectl/nmstatectl.py +@@ -223,14 +223,16 @@ def setup_subcommand_show(subparsers): + dest="yaml", + ) + parser_show.add_argument( +- "-r, --running-config", ++ "-r", ++ "--running-config", + help="Show running configurations", + default=False, + action="store_true", + dest="running_config", + ) + parser_show.add_argument( +- "-s, --show-secrets", ++ "-s", ++ "--show-secrets", + help="Show secrets also", + default=False, + action="store_true", +-- +2.32.0 + diff --git a/SOURCES/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch b/SOURCES/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch new file mode 100644 index 0000000..4ea3020 --- /dev/null +++ b/SOURCES/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch @@ -0,0 +1,105 @@ +From b1cb57d1dc4bba6592ba5cfc5c810a2ad19ac941 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 22 Jul 2021 18:40:50 +0800 +Subject: [PATCH 2/2] nm ethtool: Preserve existing ethtool settings when + undesired + +When user does not define ethtool settings in desire state, +we should preserve existing ethtool setting. + +Integration test case included. + +Signed-off-by: Gris Ge +Signed-off-by: Fernando Fernandez Mancera +--- + libnmstate/nm/connection.py | 18 +++--------------- + libnmstate/nm/ethtool.py | 26 +++++++++++++++++++++++++- + 2 files changed, 28 insertions(+), 16 deletions(-) + +diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py +index 5d60f6d..5a79c6f 100644 +--- a/libnmstate/nm/connection.py ++++ b/libnmstate/nm/connection.py +@@ -22,8 +22,6 @@ + import uuid + + from libnmstate.error import NmstatePluginError +-from libnmstate.ifaces import IfaceEthtool +-from libnmstate.schema import Ethtool + from libnmstate.schema import Interface + from libnmstate.schema import InterfaceType + from libnmstate.schema import LinuxBridge as LB +@@ -240,19 +238,9 @@ def create_new_nm_simple_conn(iface, nm_profile): + if iface.ieee_802_1x_conf: + settings.append(create_802_1x_setting(iface.ieee_802_1x_conf)) + +- if Ethtool.CONFIG_SUBTREE in iface.original_desire_dict: +- iface_ethtool = IfaceEthtool( +- iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] +- ) +- iface_ethtool.canonicalize( +- iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] +- ) +- setting = create_ethtool_setting( +- iface_ethtool, +- nm_profile, +- ) +- if setting: +- settings.append(setting) ++ ethtool_setting = create_ethtool_setting(iface, nm_profile) ++ if ethtool_setting: ++ settings.append(ethtool_setting) + + nm_simple_conn = NM.SimpleConnection.new() + for setting in settings: +diff --git a/libnmstate/nm/ethtool.py b/libnmstate/nm/ethtool.py +index 466f4f9..3cad1bf 100644 +--- a/libnmstate/nm/ethtool.py ++++ b/libnmstate/nm/ethtool.py +@@ -22,6 +22,7 @@ import logging + from .common import NM + from .common import GLib + ++from libnmstate.ifaces import IfaceEthtool + from libnmstate.schema import Ethtool + + +@@ -59,7 +60,7 @@ _NM_COALESCE_OPT_NAME_MAP = { + } + + +-def create_ethtool_setting(iface_ethtool, base_con_profile): ++def _create_ethtool_setting(iface_ethtool, base_con_profile): + nm_setting = None + + if base_con_profile: +@@ -159,3 +160,26 @@ def nm_set_pause(nm_setting, autoneg, rx, tx): + tx_value, + ) + # pylint: enable=no-member ++ ++ ++def create_ethtool_setting(iface, base_con_profile): ++ if Ethtool.CONFIG_SUBTREE in iface.original_desire_dict: ++ iface_ethtool = IfaceEthtool( ++ iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] ++ ) ++ iface_ethtool.canonicalize( ++ iface.original_desire_dict[Ethtool.CONFIG_SUBTREE] ++ ) ++ return _create_ethtool_setting( ++ iface_ethtool, ++ base_con_profile, ++ ) ++ else: ++ # Preserve existing setting but not create new ++ if base_con_profile: ++ ethtool_setting = base_con_profile.get_setting_by_name( ++ NM.SETTING_ETHTOOL_SETTING_NAME ++ ) ++ if ethtool_setting: ++ return ethtool_setting.duplicate() ++ return None +-- +2.32.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 4fd6fdc..71e4d17 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,13 +4,15 @@ Name: nmstate Version: 1.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} Source0: %{url}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz Source1: %{url}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz.asc Source2: https://www.nmstate.io/nmstate.gpg +Patch1: 0001-nmstatectl-fix-long-arguments-support.patch +Patch2: 0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -85,6 +87,9 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Fri Jul 23 2021 Gris Ge - 1.1.0-2 +- Preserving existing ethtool settings. RHBZ#1984764 + * Thu Jul 15 2021 Gris Ge - 1.1.0-1 - Upgrade to 1.1.0.