diff --git a/.gitignore b/.gitignore index 18b3d9b..54812f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/nmstate-1.0.2.tar.gz +SOURCES/nmstate-1.1.0.tar.gz SOURCES/nmstate.gpg diff --git a/.nmstate.metadata b/.nmstate.metadata index a6d3e02..f6d19a1 100644 --- a/.nmstate.metadata +++ b/.nmstate.metadata @@ -1,2 +1,2 @@ -eeda8a0238732e5dc37e2217ed6e316f76c93145 SOURCES/nmstate-1.0.2.tar.gz +0b7795853d1f7735cb05817389f188884d1f6f09 SOURCES/nmstate-1.1.0.tar.gz b5f872551d434e2c62b30d70471efaeede83ab44 SOURCES/nmstate.gpg 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..4334857 --- /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/4] 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..5f5ebec --- /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/4] 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/SOURCES/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch b/SOURCES/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch new file mode 100644 index 0000000..ba000ef --- /dev/null +++ b/SOURCES/0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch @@ -0,0 +1,87 @@ +From f4d190653c55d399b32afc956b2b4a1ff8d20101 Mon Sep 17 00:00:00 2001 +From: Fernando Fernandez Mancera +Date: Mon, 26 Jul 2021 09:58:23 +0200 +Subject: [PATCH 3/4] ovs: fix state=ignore for ovs port when removing them + +When removing an ovs port while the interface is marked as ignored, the +interface should not being removed from the ovs bridge as the user +specidied it should be ignored. + +Example: + +``` +interfaces: +- name: dummy0 + type: dummy + state: ignore +- name: ovsbr0 + type: ovs-bridge + state: up + bridge: + port: + - name: ovs0 +``` + +Integration test case added. + +Signed-off-by: Fernando Fernandez Mancera +Signed-off-by: Gris Ge +--- + libnmstate/nm/profiles.py | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/libnmstate/nm/profiles.py b/libnmstate/nm/profiles.py +index beda5c7..3b0b6be 100644 +--- a/libnmstate/nm/profiles.py ++++ b/libnmstate/nm/profiles.py +@@ -23,6 +23,8 @@ + import logging + from operator import attrgetter + ++from libnmstate.schema import Interface ++from libnmstate.schema import InterfaceState + from libnmstate.schema import InterfaceType + + from .common import NM +@@ -359,7 +361,7 @@ def _delete_orphan_nm_ovs_port_profiles( + continue + # When OVS port has no child, delete it + ovs_bridge_iface = ovs_bridge_profile.iface +- if not _nm_ovs_port_has_child( ++ if not _nm_ovs_port_has_child_or_is_ignored( + nm_profile, ovs_bridge_iface, net_state + ): + ProfileDelete( +@@ -404,7 +406,9 @@ def _use_uuid_as_controller_and_parent(nm_profiles): + nm_profile.update_parent(uuid) + + +-def _nm_ovs_port_has_child(nm_profile, ovs_bridge_iface, net_state): ++def _nm_ovs_port_has_child_or_is_ignored( ++ nm_profile, ovs_bridge_iface, net_state ++): + ovs_port_uuid = nm_profile.get_uuid() + ovs_port_name = nm_profile.get_interface_name() + for ovs_iface_name in ovs_bridge_iface.port: +@@ -415,4 +419,18 @@ def _nm_ovs_port_has_child(nm_profile, ovs_bridge_iface, net_state): + and ovs_iface.controller_type == InterfaceType.OVS_PORT + ): + return True ++ # Gather the ovs bridge interface from the current state in order to check ++ # if any port is ignored in the original desired state. ++ current_ovs_bridge = net_state.ifaces.get_cur_iface( ++ ovs_bridge_iface.name, InterfaceType.OVS_BRIDGE ++ ) ++ if current_ovs_bridge: ++ for port_name in current_ovs_bridge.port: ++ port_iface = net_state.ifaces.all_kernel_ifaces.get(port_name) ++ if ( ++ port_iface ++ and port_iface.original_desire_dict.get(Interface.STATE) ++ == InterfaceState.IGNORE ++ ): ++ return True + return False +-- +2.32.0 + diff --git a/SOURCES/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch b/SOURCES/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch new file mode 100644 index 0000000..40be31b --- /dev/null +++ b/SOURCES/0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch @@ -0,0 +1,86 @@ +From 369ed3210ecedfa1deda88a6eb7cacc19a47f89d Mon Sep 17 00:00:00 2001 +From: Fernando Fernandez Mancera +Date: Mon, 26 Jul 2021 16:13:15 +0200 +Subject: [PATCH 4/4] nispor: fix show of empty next_hop_address and + destination + +The correct way of representing an empty next_hop_address is using +"0.0.0.0" for IPv4 and "::" for IPv6. This configuration is valid +because an user should be able to specify the following routes: + +``` +--- +routes: + config: + - destination: 0.0.0.0/0 + next-hop-address: 0.0.0.0 + next-hop-interface: dummy + - destination: ::/0 + next-hop-address: "::" + next-hop-interface: dummy + +``` + +That means each of the hosts within the range of the route are +considered to be directly connected through that interface. + +For example, using iproute2 the user should introduce the following +command: + +`ip route 0.0.0.0 0.0.0.0 dummy` + +Integration test case added. + +Ref: https://bugzilla.redhat.com/1985879 + +Signed-off-by: Fernando Fernandez Mancera +Signed-off-by: Gris Ge +--- + libnmstate/nispor/route.py | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/libnmstate/nispor/route.py b/libnmstate/nispor/route.py +index 510ddc3..9852ba5 100644 +--- a/libnmstate/nispor/route.py ++++ b/libnmstate/nispor/route.py +@@ -23,6 +23,9 @@ from libnmstate.schema import Route + IPV4_DEFAULT_GATEWAY_DESTINATION = "0.0.0.0/0" + IPV6_DEFAULT_GATEWAY_DESTINATION = "::/0" + ++IPV4_EMPTY_NEXT_HOP_ADDRESS = "0.0.0.0" ++IPV6_EMPTY_NEXT_HOP_ADDRESS = "::" ++ + LOCAL_ROUTE_TABLE = 255 + + +@@ -50,21 +53,23 @@ def nispor_route_state_to_nmstate_static(np_routes): + def _nispor_route_to_nmstate(np_rt): + if np_rt.dst: + destination = np_rt.dst +- elif np_rt.gateway: ++ else: + destination = ( + IPV6_DEFAULT_GATEWAY_DESTINATION + if np_rt.address_family == "ipv6" + else IPV4_DEFAULT_GATEWAY_DESTINATION + ) +- else: +- destination = "" + + if np_rt.via: + next_hop = np_rt.via + elif np_rt.gateway: + next_hop = np_rt.gateway + else: +- next_hop = "" ++ next_hop = ( ++ IPV6_EMPTY_NEXT_HOP_ADDRESS ++ if np_rt.address_family == "ipv6" ++ else IPV4_EMPTY_NEXT_HOP_ADDRESS ++ ) + + return { + Route.TABLE_ID: np_rt.table, +-- +2.32.0 + diff --git a/SOURCES/nmstate-1.0.2.tar.gz.asc b/SOURCES/nmstate-1.0.2.tar.gz.asc deleted file mode 100644 index ef664a4..0000000 --- a/SOURCES/nmstate-1.0.2.tar.gz.asc +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEEfUQ+BAINyWGvqJXerIciWuEsPqMFAmAueEYACgkQrIciWuEs -PqPJxw//UmWdCJgoClFkEpWqWUkjMmfkGh70PoxtuOeNrAYwHv9zCHDBFjLtaDG1 -18+jakwrVIlTiFHZqfz1g3o0Te86w5rKiU2y0FBtBPZ1cdcJZk2Is5wb/JJo78n+ -9sWRfZmSN0SMiJ5HfzhTdZ2RsZYRSaDPSUxchRY03LzsBusxoK8swWu9oUHqmYKd -S3k4skP5ZQvpHtKzq9w1lfU4YAw42sRvXHW/++HqGgE0rypf+Wlcu9C+It9kVLCr -3rdp8iTGTg+LRg7LxFmEsRlmPpxhO25LaxjFvYSFnhE94xOt28KXeHBYs8hPPRwh -+z2w6zJ3hgIrLh10IPzePTWk//KNWDRaAJXQTCma1UE4jdL3+wbxb8H3vl5VCrBU -3fuj3JwfvFU1NuDf+yuJ0sCKzNXaAzpYYgfIaCaPdtBpg5jl2DTEfEF8QZKYuJDU -ueCo6reBAlwJzce433aSzBXshFbHG/RdD09duS3p84Dn6ljEN3GfJwUAC9s9TsAQ -U5+rWog6zMpVke/9yqwEf1KmqtLM3/+Ih30CHb3ZoPTf05KB14k0d1CLDdC9d9dy -gN0w8xjdTUXbUXW/XIvRVX9KWqyNI6lnZoL0MWzPwUmMxwPJkRpAVpLKpgyUrVpD -yjtLTFDZJNmfmbi2b0myFFcc2chaXmYlpLCP8vfRYJA3mCee6Xg= -=b/Mh ------END PGP SIGNATURE----- diff --git a/SOURCES/nmstate-1.1.0.tar.gz.asc b/SOURCES/nmstate-1.1.0.tar.gz.asc new file mode 100644 index 0000000..3c2d190 --- /dev/null +++ b/SOURCES/nmstate-1.1.0.tar.gz.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEE8f1XsqXpyNthgIbGbM3lj+QeKP8FAmDvw+4ACgkQbM3lj+Qe +KP+WjA/+Nky4rMOTNG16iwV8wc0hvWJdHL6XzDnHR2rrUHPGLMg4ia2B5MhYGKpl +/1eQk2UnA2rFTLC2P+TlKJbTFTUytxDvoCbR7ODCmneSJ65txG3XFDEd0soGayn4 +w5UchowGTqGEMu/P1ORihYtYC6b8Q1gHFUomqcvryOtdE6b6lzQAMyU/VrG3vEwG +dSsFWJh6PyMi2WTS5+CAHUYPbs3wZbNxTU74PyHch1Hcl3zwXa3bheqzHZojYh28 +GvvaPXBAHD6xwnCOWTMw3hBgLnjTZKsc62aFqgJ1Zz1VqN+Xlo8mlTZYDGhzwNU3 +m0UfRz2tSeqpbTFty3ObzTfDNYiXe4Y3J6ktD3pjt7Pf/uKY8NNbOKlZ4WhWrqPn +VGB67ci/pcMQjw/vCPVjOQwpjVMm/EaZ6GQw8TAxbsb9tB5w2NoTncMkNNiPNB4/ +5gquK2zZL8hsPqcE5yY/n+2/zgxhO7E7KuE20dbt1BCW+wmS4e77a7cx3EFgLc7f +oTGGuh3T+zdI/kxt5FAUBNnFiPWN9zJjQ8e080j7UIyL1Rhpvp+xG70ujwHvfL1I +qczeFT77eI2aMNU9iX/vbkVdgEKlxD6YDw626PxJR5WQz99zHiKwfDPUf9rJW72q +tAbGZ3DjfMk/VrerOMFDEGPA1V9Fs9kxGye1DIPAVw4IOwAbqE8= +=9EnL +-----END PGP SIGNATURE----- diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 3155799..3d4e265 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -3,14 +3,18 @@ %define libname libnmstate Name: nmstate -Version: 1.0.2 -Release: 1%{?dist} +Version: 1.1.0 +Release: 3%{?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 +Patch3: 0003-ovs-fix-state-ignore-for-ovs-port-when-removing-them.patch +Patch4: 0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -68,8 +72,10 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %doc README.md %doc examples/ %{_mandir}/man8/nmstatectl.8* +%{_mandir}/man8/nmstate-autoconf.8* %{python3_sitelib}/nmstatectl %{_bindir}/nmstatectl +%{_bindir}/nmstate-autoconf %files -n python3-%{libname} %license LICENSE @@ -83,6 +89,55 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Tue Jul 27 2021 Gris Ge - 1.1.0-3 +- Fix state=ignore for OVS interface. RHBZ#1944054 +- Fix verification for next hop address 0.0.0.0. RHBZ#1985879 + +* 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. + +* Fri Jul 09 2021 Gris Ge - 1.1.0-0.7.alpha7 +- Upgarde to 1.1.0 alpha7. + +* Thu Jul 01 2021 Gris Ge - 1.1.0-0.6.alpha6 +- Upgrade to 1.1.0 alpha6. + +* Mon Jun 21 2021 Fernando Fernandez Mancera - 1.1.0-0.5.alpha4 +- Upgrade to 1.1.0 alpha4. + +* Wed Jun 16 2021 Fernando Fernandez Mancera - 1.1.0-0.4.alpha3 +- Rebuild to introduce CI gating tier1 tests. RHBZ#1813357 + +* Tue Jun 08 2021 Gris Ge - 1.1.0-0.3.alpha3 +- Upgrade to 1.1.0 alpha3. + +* Mon Jun 07 2021 Fernando Fernandez Mancera - 1.1.0-0.2 +- Upgrade to 1.1.0 alpha2. + +* Wed May 19 2021 Wen Liang - 1.1.0-0.1 +- Upgrade to 1.1.0 alpha1. + +* Tue Apr 20 2021 Fernando Fernandez Mancera - 1.0.3-1 +- Upgrade to 1.0.3. RHBZ#1942458 + +* Fri Mar 26 2021 Fernando Fernandez Mancera - 1.0.2-6 +- Rebuild for RHEL 8.5. RHBZ#1935710 + +* Fri Mar 26 2021 Fernando Fernandez Mancera - 1.0.2-5 +- New patch for fixing unmanaged interfaces being managed. RHBZ#1935710 + +* Tue Feb 23 2021 Gris Ge - 1.0.2-4 +- New patch for SRIOV decrease VF amount. RHBZ#1931355 + +* Tue Feb 23 2021 Gris Ge - 1.0.2-3 +- Fix actiation failure when decrease VF mount on i40e. RHBZ#1931355 + +* Tue Feb 23 2021 Gris Ge - 1.0.2-2 +- Fix nmstatectl return code of `set` command. RHBZ#1931751 + * Fri Feb 19 2021 Gris Ge - 1.0.2-1 - Upgrade to 1.0.2.