From ca44bcff4d0b13ff82ffdf82eefdca29695f8fd4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 04 2020 00:59:18 +0000 Subject: import nmstate-0.3.4-13.el8_3 --- diff --git a/SOURCES/BZ_1887349-Allow-duplicate-iface-name-in-ovs.patch b/SOURCES/BZ_1887349-Allow-duplicate-iface-name-in-ovs.patch new file mode 100644 index 0000000..d47e0d8 --- /dev/null +++ b/SOURCES/BZ_1887349-Allow-duplicate-iface-name-in-ovs.patch @@ -0,0 +1,111 @@ +From 36ee761dd0d671439323077e4f77a89071fdcd9c Mon Sep 17 00:00:00 2001 +From: Edward Haas +Date: Wed, 7 Oct 2020 20:13:12 +0300 +Subject: [PATCH 1/2] nm, bridge, ovs: Collect only existing profiles + +During the reporting flow, connections that are in teardown process +no longer point to a valid profile. Avoid collecting such profiles (in +practice, these are actually `None` objects). + +Signed-off-by: Edward Haas +Signed-off-by: Gris Ge +--- + libnmstate/nm/bridge.py | 6 +++--- + libnmstate/nm/ovs.py | 4 +++- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/libnmstate/nm/bridge.py b/libnmstate/nm/bridge.py +index b885f7a..0ca6c2d 100644 +--- a/libnmstate/nm/bridge.py ++++ b/libnmstate/nm/bridge.py +@@ -260,9 +260,9 @@ def _get_slave_profiles_by_name(master_device): + for dev in master_device.get_slaves(): + active_con = connection.get_device_active_connection(dev) + if active_con: +- slaves_profiles_by_name[ +- dev.get_iface() +- ] = active_con.props.connection ++ profile = active_con.props.connection ++ if profile: ++ slaves_profiles_by_name[dev.get_iface()] = profile + return slaves_profiles_by_name + + +diff --git a/libnmstate/nm/ovs.py b/libnmstate/nm/ovs.py +index 2518773..eb373c3 100644 +--- a/libnmstate/nm/ovs.py ++++ b/libnmstate/nm/ovs.py +@@ -279,5 +279,7 @@ def _get_slave_profiles(master_device, devices_info): + if active_con: + master = active_con.props.master + if master and (master.get_iface() == master_device.get_iface()): +- slave_profiles.append(active_con.props.connection) ++ profile = active_con.props.connection ++ if profile: ++ slave_profiles.append(profile) + return slave_profiles +-- +2.28.0 + + +From caf638d75e57da8770cd884782475f1c5668fd6d Mon Sep 17 00:00:00 2001 +From: Edward Haas +Date: Wed, 7 Oct 2020 12:26:42 +0300 +Subject: [PATCH 2/2] nm, ovs: Fix report crash when OVS has dup iface names + +In case of an existing OVS deployment which uses an identical name for +the bridge, port and interface, libnmstate.show() exploded. + +It is now possible to report such deployments. + +Signed-off-by: Edward Haas +Signed-off-by: Gris Ge +--- + libnmstate/nm/ovs.py | 24 +++++++++++++++++++++--- + 1 file changed, 21 insertions(+), 3 deletions(-) + +diff --git a/libnmstate/nm/ovs.py b/libnmstate/nm/ovs.py +index eb373c3..d1f26ba 100644 +--- a/libnmstate/nm/ovs.py ++++ b/libnmstate/nm/ovs.py +@@ -140,7 +140,12 @@ def get_port_by_slave(nmdev): + + + def get_ovs_info(context, bridge_device, devices_info): +- port_profiles = _get_slave_profiles(bridge_device, devices_info) ++ ovs_ports_info = ( ++ info ++ for info in devices_info ++ if is_ovs_port_type_id(info[1]["type_id"]) ++ ) ++ port_profiles = _get_slave_profiles(bridge_device, ovs_ports_info) + ports = _get_bridge_ports_info(context, port_profiles, devices_info) + options = _get_bridge_options(context, bridge_device) + +@@ -203,8 +208,21 @@ def _get_bridge_port_info(context, port_profile, devices_info): + vlan_mode = port_setting.props.vlan_mode + + port_name = port_profile.get_interface_name() +- port_device = context.get_nm_dev(port_name) +- port_slave_profiles = _get_slave_profiles(port_device, devices_info) ++ port_device = next( ++ dev ++ for dev, devinfo in devices_info ++ if devinfo["name"] == port_name ++ and is_ovs_port_type_id(devinfo["type_id"]) ++ ) ++ devices_info_excluding_bridges_and_ports = ( ++ info ++ for info in devices_info ++ if not is_ovs_bridge_type_id(info[1]["type_id"]) ++ and not is_ovs_port_type_id(info[1]["type_id"]) ++ ) ++ port_slave_profiles = _get_slave_profiles( ++ port_device, devices_info_excluding_bridges_and_ports ++ ) + port_slave_names = [c.get_interface_name() for c in port_slave_profiles] + + if port_slave_names: +-- +2.28.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 98f1636..1f60f2d 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 0.3.4 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -19,6 +19,7 @@ Patch5: BZ_1858758-fix_ovs_bond.patch Patch6: BZ_1859844-fix_converting_memory_only.patch Patch7: BZ_1866269-preserve_nm_uuid_in_ovsdb.patch Patch8: BZ_1869345_ovsdb_remove_all_ports.patch +Patch9: BZ_1887349-Allow-duplicate-iface-name-in-ovs.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -89,6 +90,9 @@ gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0} %{python3_sitelib}/%{libname}/plugins/__pycache__/nmstate_plugin_ovsdb* %changelog +* Wed Oct 14 2020 Gris Ge - 0.3.4-13 +- Allowing duplicate interface name of ovs. RHBZ#1887349 + * Tue Aug 18 2020 Gris Ge - 0.3.4-12 - New patch: OVSDB: Allowing remove all OVS ports. RHBZ#1869345