From 89ef9e596d6d2d1de1ef7990808b41128e82387a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 15 Mar 2022 05:11:48 -0400 Subject: [PATCH] import nmstate-1.1.0-6.el8_5 --- .../BZ_2054054-support-multipath-route.patch | 110 ++++++++++++++++++ SPECS/nmstate.spec | 6 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 SOURCES/BZ_2054054-support-multipath-route.patch diff --git a/SOURCES/BZ_2054054-support-multipath-route.patch b/SOURCES/BZ_2054054-support-multipath-route.patch new file mode 100644 index 0000000..48850d1 --- /dev/null +++ b/SOURCES/BZ_2054054-support-multipath-route.patch @@ -0,0 +1,110 @@ +From af6b1458f852dc164206dc2fc45467ade6a7f7ae Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 9 Feb 2022 23:33:40 +0800 +Subject: [PATCH] python route: Add support of multipath route + +Supporting the rout created by below command: + + sudo ip -6 route add 2001:db8:e::/64 proto static \ + nexthop via 2001:db8:f::254 dev eth1 weight 1 onlink \ + nexthop via 2001:db8:f::253 dev eth1 weight 256 onlink + +Integration test case included. + +Signed-off-by: Gris Ge +--- + libnmstate/nispor/route.py | 53 ++++++++++++++++++++++++++------------ + 1 file changed, 36 insertions(+), 17 deletions(-) + +diff --git a/libnmstate/nispor/route.py b/libnmstate/nispor/route.py +index 9852ba51..87543de2 100644 +--- a/libnmstate/nispor/route.py ++++ b/libnmstate/nispor/route.py +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2020 Red Hat, Inc. ++# Copyright (c) 2020-2022 Red Hat, Inc. + # + # This file is part of nmstate + # +@@ -17,6 +17,8 @@ + # along with this program. If not, see . + # + ++from copy import deepcopy ++ + from libnmstate.schema import Route + + +@@ -30,24 +32,24 @@ LOCAL_ROUTE_TABLE = 255 + + + def nispor_route_state_to_nmstate(np_routes): +- return [ +- _nispor_route_to_nmstate(rt) +- for rt in np_routes +- if rt.scope in ["universe", "link"] +- and rt.oif != "lo" +- and rt.table != LOCAL_ROUTE_TABLE +- ] ++ ret = [] ++ for np_route in np_routes: ++ if np_route.oif != "lo" and np_route.table != LOCAL_ROUTE_TABLE: ++ ret.extend(_nispor_route_to_nmstate(np_route)) ++ return ret + + + def nispor_route_state_to_nmstate_static(np_routes): +- return [ +- _nispor_route_to_nmstate(rt) +- for rt in np_routes +- if rt.scope in ["universe", "link"] +- and rt.protocol not in ["kernel", "ra", "dhcp"] +- and rt.oif != "lo" +- and rt.table != LOCAL_ROUTE_TABLE +- ] ++ ret = [] ++ for np_route in np_routes: ++ if ( ++ np_route.oif != "lo" ++ and np_route.table != LOCAL_ROUTE_TABLE ++ and np_route.scope in ["universe", "link"] ++ and np_route.protocol in ["static", "boot"] ++ ): ++ ret.extend(_nispor_route_to_nmstate(np_route)) ++ return ret + + + def _nispor_route_to_nmstate(np_rt): +@@ -71,10 +73,27 @@ def _nispor_route_to_nmstate(np_rt): + else IPV4_EMPTY_NEXT_HOP_ADDRESS + ) + +- return { ++ nm_route = { + Route.TABLE_ID: np_rt.table, + Route.DESTINATION: destination, + Route.NEXT_HOP_INTERFACE: np_rt.oif if np_rt.oif else "", + Route.NEXT_HOP_ADDRESS: next_hop, + Route.METRIC: np_rt.metric if np_rt.metric else 0, + } ++ np_mp_rts = get_multipath_routes(np_rt) ++ if np_mp_rts: ++ ret = [] ++ for np_mp_rt in np_mp_rts: ++ nm_route_clone = deepcopy(nm_route) ++ nm_route_clone[Route.NEXT_HOP_INTERFACE] = np_mp_rt["iface"] ++ nm_route_clone[Route.NEXT_HOP_ADDRESS] = np_mp_rt["via"] ++ ret.append(nm_route_clone) ++ return ret ++ else: ++ return [nm_route] ++ ++ ++# Instead of bumping nispor dependency version, we just use nispor private ++# property temporarily ++def get_multipath_routes(np_route): ++ return np_route._info.get("multipath") +-- +2.27.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 59cc1a3..b40dd97 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 1.1.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -18,6 +18,7 @@ Patch4: 0004-nispor-fix-show-of-empty-next_hop_address-and-destin.patch Patch5: BZ_2034139-do-not-rename-connection.patch Patch6: BZ_2034139-ovs-remove-ovs-port-prefix.patch Patch7: BZ_2039285-sriov-New-way-to-wait-VF-been-created.patch +Patch8: BZ_2054054-support-multipath-route.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -92,6 +93,9 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Thu Feb 10 2022 Gris Ge - 1.1.0-6 +- Workaround CNV issue by supporting multipath route. RHBZ#2054054 + * Wed Jan 12 2022 Gris Ge - 1.1.0-5 - Remove OVS interface postfix. RHBZ#2034139