From e6c09453bea7c9a890f261b07155c05f5691bf7a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 28 2021 04:22:13 +0000 Subject: import nmstate-1.1.0-3.el8 --- diff --git a/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch b/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch index 5084811..4334857 100644 --- a/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch +++ b/SOURCES/0001-nmstatectl-fix-long-arguments-support.patch @@ -1,7 +1,7 @@ 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 +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: 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 index 4ea3020..5f5ebec 100644 --- a/SOURCES/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch +++ b/SOURCES/0002-nm-ethtool-Preserve-existing-ethtool-settings-when-u.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH 2/4] nm ethtool: Preserve existing ethtool settings when undesired When user does not define ethtool settings in desire state, 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/SPECS/nmstate.spec b/SPECS/nmstate.spec index 71e4d17..3d4e265 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 1.1.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -13,6 +13,8 @@ Source1: %{url}/releases/download/v%{version}/%{srcname}-%{version}.tar.g 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 @@ -87,6 +89,10 @@ 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