From c2f40e20a975e02677270f11c12461a4d8282e76 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Thu, 11 Jan 2024 03:13:39 +0300 Subject: [PATCH] import nmstate-1.4.4-5.el8_9 --- ...-ovs-bridge-to-itself-when-creating-.patch | 44 +++++++++++ ...ting-string-as-int-for-prefix-length.patch | 73 +++++++++++++++++++ SPECS/nmstate.spec | 10 ++- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 SOURCES/BZ_2231843-nm-do-not-attach-ovs-bridge-to-itself-when-creating-.patch create mode 100644 SOURCES/RHEL_11660-ip-Support-treating-string-as-int-for-prefix-length.patch diff --git a/SOURCES/BZ_2231843-nm-do-not-attach-ovs-bridge-to-itself-when-creating-.patch b/SOURCES/BZ_2231843-nm-do-not-attach-ovs-bridge-to-itself-when-creating-.patch new file mode 100644 index 0000000..874a1cb --- /dev/null +++ b/SOURCES/BZ_2231843-nm-do-not-attach-ovs-bridge-to-itself-when-creating-.patch @@ -0,0 +1,44 @@ +From 88b785ee3424fb010da3e70c4337b3b5ebdf5f5e Mon Sep 17 00:00:00 2001 +From: Fernando Fernandez Mancera +Date: Thu, 24 Aug 2023 17:28:26 +0200 +Subject: [PATCH] nm: do not attach ovs-bridge to itself when creating a + profile + +If ovs-bridge and ovs-interface shares name and ovs-interface is +modified, during the creation of the ovs-bridge profile we are setting +itself as a controller. + +That is wrong and NetworkManager is reporting the following error: + +``` +libnmstate.error.NmstateLibnmError: Update profile +uuid:ba206f8f-2ed6-486d-a339-9d1f62c5cb84 iface:br1 type:ovs-bridge +failed with error=nm-connection-error-quark: connection.slave-type: +Cannot set 'master' without 'slave-type' (6) +``` + +In order to solve that, before setting the controller we check that it +is not itself. + +Signed-off-by: Fernando Fernandez Mancera +--- + libnmstate/nm/ovs.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libnmstate/nm/ovs.py b/libnmstate/nm/ovs.py +index f7c589b6..6f732207 100644 +--- a/libnmstate/nm/ovs.py ++++ b/libnmstate/nm/ovs.py +@@ -375,5 +375,8 @@ def set_ovs_iface_controller_info(iface_infos): + + for iface_info in iface_infos: + ctrl_name = pending_changes.get(iface_info[Interface.NAME]) +- if ctrl_name: ++ if ctrl_name and not ( ++ ctrl_name == iface_info[Interface.NAME] ++ and iface_info[Interface.TYPE] == InterfaceType.OVS_BRIDGE ++ ): + iface_info[Interface.CONTROLLER] = ctrl_name +-- +2.41.0 + diff --git a/SOURCES/RHEL_11660-ip-Support-treating-string-as-int-for-prefix-length.patch b/SOURCES/RHEL_11660-ip-Support-treating-string-as-int-for-prefix-length.patch new file mode 100644 index 0000000..dcd18c2 --- /dev/null +++ b/SOURCES/RHEL_11660-ip-Support-treating-string-as-int-for-prefix-length.patch @@ -0,0 +1,73 @@ +From 4c1c741d4dd4d68e12c6e27478f1c320820dd003 Mon Sep 17 00:00:00 2001 +From: Wen Liang +Date: Fri, 29 Sep 2023 14:31:34 -0400 +Subject: [PATCH 1/1] ip: Support treating string as int for `prefix-length` + +When the network role user is using the `network_state` variable to +configure the network, and if they are using Jinja2 template to +define the `prefix-length`, the type conversion +`prefix-length: "{{ __str_val | int }}"` does not work as expected, the +type for `prefix-length` in the end is still string. Therefore, nmstate +need to support treating string as int for `prefix-length` in order to +make the apply succeed. + +Signed-off-by: Wen Liang +--- + libnmstate/ifaces/base_iface.py | 7 +++++++ + libnmstate/schemas/operational-state.yaml | 8 ++++++-- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/libnmstate/ifaces/base_iface.py b/libnmstate/ifaces/base_iface.py +index c1a4c04b..b1e4c811 100644 +--- a/libnmstate/ifaces/base_iface.py ++++ b/libnmstate/ifaces/base_iface.py +@@ -48,6 +48,7 @@ class IPState: + self._info = info + self._remove_stack_if_disabled() + self._canonicalize_ip_addr() ++ self._canonicalize_ip_prefix() + self._canonicalize_dynamic() + + def _canonicalize_dynamic(self): +@@ -71,6 +72,12 @@ class IPState: + addr[InterfaceIP.ADDRESS_IP] + ) + ++ def _canonicalize_ip_prefix(self): ++ for addr in self.addresses: ++ addr[InterfaceIP.ADDRESS_PREFIX_LENGTH] = int( ++ addr[InterfaceIP.ADDRESS_PREFIX_LENGTH] ++ ) ++ + def sort_addresses(self): + self.addresses.sort(key=itemgetter(InterfaceIP.ADDRESS_IP)) + +diff --git a/libnmstate/schemas/operational-state.yaml b/libnmstate/schemas/operational-state.yaml +index 92bd6bd6..8526a0ab 100644 +--- a/libnmstate/schemas/operational-state.yaml ++++ b/libnmstate/schemas/operational-state.yaml +@@ -615,7 +615,9 @@ definitions: + ip: + type: string + prefix-length: +- type: integer ++ type: ++ - integer ++ - string + netmask: + type: string + neighbor: +@@ -654,7 +656,9 @@ definitions: + ip: + type: string + prefix-length: +- type: integer ++ type: ++ - integer ++ - string + neighbor: + type: array + items: +-- +2.41.0 + diff --git a/SPECS/nmstate.spec b/SPECS/nmstate.spec index 54eef4e..e87422e 100644 --- a/SPECS/nmstate.spec +++ b/SPECS/nmstate.spec @@ -4,7 +4,7 @@ Name: nmstate Version: 1.4.4 -Release: 3%{?dist} +Release: 5%{?dist} Summary: Declarative network manager API License: LGPLv2+ URL: https://github.com/%{srcname}/%{srcname} @@ -15,6 +15,8 @@ Source3: %{url}/releases/download/v%{version}/%{srcname}-vendor-%{version # Patches 0X are reserved to downstream only Patch0: BZ_2132570-nm-reverse-IPv6-order-before-adding-them-to-setting.patch Patch1: BZ_2203277-ip-Support-static-route-with-auto-ip.patch +Patch2: BZ_2231843-nm-do-not-attach-ovs-bridge-to-itself-when-creating-.patch +Patch3: RHEL_11660-ip-Support-treating-string-as-int-for-prefix-length.patch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: gnupg2 @@ -149,6 +151,12 @@ popd /sbin/ldconfig %changelog +* Wed Oct 06 2023 Wen Liang - 1.4.4-5 +- Support treating string as int for address prefix-length. RHEL-11660 + +* Wed Aug 30 2023 Fernando Fernandez Mancera - 1.4.4-4 +- Fix issue with ovs-bridge and ovs-interface with same name. RHBZ#2231843 + * Tue May 30 2023 Fernando Fernandez Mancera - 1.4.4-3 - Support static route with auto-ip. RHBZ#2203277