* Wed Oct 30 2024 Miroslav Rezanina <mrezanin@redhat.com> - 23.4-20
- ci-Fix-metric-setting-for-ifcfg-network-connections-for.patch [RHEL-61224] - ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch [RHEL-61224] - Resolves: RHEL-61224 (Configuring metric for default gateway is not working)
This commit is contained in:
parent
cb65343382
commit
636f370494
147
ci-Fix-metric-setting-for-ifcfg-network-connections-for.patch
Normal file
147
ci-Fix-metric-setting-for-ifcfg-network-connections-for.patch
Normal file
@ -0,0 +1,147 @@
|
||||
From 395d0ee0f8f7a226cb04d0f4f2c587fb567275c6 Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Fri, 4 Oct 2024 02:38:23 +0530
|
||||
Subject: [PATCH 1/2] Fix metric setting for ifcfg network connections for rhel
|
||||
(#5777)
|
||||
|
||||
RH-Author: xiachen <xiachen@redhat.com>
|
||||
RH-MergeRequest: 111: Fix metric setting for ifcfg network connections for rhel (#5777)
|
||||
RH-Jira: RHEL-61224
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Commit: [1/2] b69558d0d021f102e6fbcd9639a455f63624184f (xiachen/cloud-init-centos)
|
||||
|
||||
Most RHEL systems use Network manager to bring up manage network connections.
|
||||
Network manager does not recognize "METRIC" option for network connections.
|
||||
It uses IPV4_ROUTE_METRIC and IPV6_ROUTE_METRIC options. Please see
|
||||
https://people.freedesktop.org/~lkundrak/nm-docs/nm-settings-ifcfg-rh.html
|
||||
|
||||
This change ensures that cloud-init generates ifcfg network connection files
|
||||
with IPV{4/6}_ROUTE_METRIC options that are compatible with RHEL and
|
||||
network manager.
|
||||
|
||||
Fixes GH-5776
|
||||
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
(cherry picked from commit a399f4b0815234e3fe11255178c737902b2d243d)
|
||||
|
||||
Signed-off-by: Amy Chen <xiachen@redhat.com>
|
||||
---
|
||||
cloudinit/net/sysconfig.py | 21 ++++++++++++++++++---
|
||||
tests/unittests/test_net.py | 37 ++++++++++++++++++++-----------------
|
||||
2 files changed, 38 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
|
||||
index 7eb430ed..b50a6a8a 100644
|
||||
--- a/cloudinit/net/sysconfig.py
|
||||
+++ b/cloudinit/net/sysconfig.py
|
||||
@@ -205,7 +205,7 @@ class Route(ConfigMap):
|
||||
)
|
||||
metric_key = "METRIC" + index
|
||||
if metric_key in self._conf:
|
||||
- metric_value = str(self._conf["METRIC" + index])
|
||||
+ metric_value = str(self._conf[metric_key])
|
||||
buf.write(
|
||||
"%s=%s\n"
|
||||
% ("METRIC" + str(reindex), _quote_value(metric_value))
|
||||
@@ -549,7 +549,12 @@ class Renderer(renderer.Renderer):
|
||||
subnet_type = subnet.get("type")
|
||||
# metric may apply to both dhcp and static config
|
||||
if "metric" in subnet:
|
||||
- if flavor != "suse":
|
||||
+ if flavor == "rhel":
|
||||
+ if subnet_is_ipv6(subnet):
|
||||
+ iface_cfg["IPV6_ROUTE_METRIC"] = subnet["metric"]
|
||||
+ else:
|
||||
+ iface_cfg["IPV4_ROUTE_METRIC"] = subnet["metric"]
|
||||
+ elif flavor != "suse":
|
||||
iface_cfg["METRIC"] = subnet["metric"]
|
||||
if subnet_type in ["dhcp", "dhcp4"]:
|
||||
# On SUSE distros 'DHCLIENT_SET_DEFAULT_ROUTE' is a global
|
||||
@@ -656,7 +661,17 @@ class Renderer(renderer.Renderer):
|
||||
iface_cfg["GATEWAY"] = route["gateway"]
|
||||
route_cfg.has_set_default_ipv4 = True
|
||||
if "metric" in route:
|
||||
- iface_cfg["METRIC"] = route["metric"]
|
||||
+ if flavor == "rhel":
|
||||
+ if subnet_is_ipv6(subnet):
|
||||
+ iface_cfg["IPV6_ROUTE_METRIC"] = route[
|
||||
+ "metric"
|
||||
+ ]
|
||||
+ else:
|
||||
+ iface_cfg["IPV4_ROUTE_METRIC"] = route[
|
||||
+ "metric"
|
||||
+ ]
|
||||
+ else:
|
||||
+ iface_cfg["METRIC"] = route["metric"]
|
||||
|
||||
else:
|
||||
# add default routes only to ifcfg files, not
|
||||
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
|
||||
index 2d716f4b..4673e4ea 100644
|
||||
--- a/tests/unittests/test_net.py
|
||||
+++ b/tests/unittests/test_net.py
|
||||
@@ -1345,7 +1345,7 @@ NETWORK_CONFIGS = {
|
||||
HWADDR=c0:d6:9f:2c:e8:80
|
||||
IPADDR=192.168.21.3
|
||||
NETMASK=255.255.255.0
|
||||
- METRIC=10000
|
||||
+ IPV4_ROUTE_METRIC=10000
|
||||
ONBOOT=yes
|
||||
TYPE=Ethernet
|
||||
USERCTL=no"""
|
||||
@@ -1521,7 +1521,7 @@ NETWORK_CONFIGS = {
|
||||
HWADDR=c0:d6:9f:2c:e8:80
|
||||
IPADDR=192.168.21.3
|
||||
NETMASK=255.255.255.0
|
||||
- METRIC=10000
|
||||
+ IPV4_ROUTE_METRIC=10000
|
||||
ONBOOT=yes
|
||||
TYPE=Ethernet
|
||||
USERCTL=no"""
|
||||
@@ -5725,24 +5725,27 @@ USERCTL=no
|
||||
}
|
||||
},
|
||||
}
|
||||
- expected = {
|
||||
- "ifcfg-eno1": textwrap.dedent(
|
||||
- """\
|
||||
- AUTOCONNECT_PRIORITY=120
|
||||
- BOOTPROTO=dhcp
|
||||
- DEVICE=eno1
|
||||
- HWADDR=07-1c-c6-75-a4-be
|
||||
- METRIC=100
|
||||
- ONBOOT=yes
|
||||
- TYPE=Ethernet
|
||||
- USERCTL=no
|
||||
- """
|
||||
- ),
|
||||
- }
|
||||
for dhcp_ver in ("dhcp4", "dhcp6"):
|
||||
+ expected = {
|
||||
+ "ifcfg-eno1": textwrap.dedent(
|
||||
+ """\
|
||||
+ AUTOCONNECT_PRIORITY=120
|
||||
+ BOOTPROTO=dhcp
|
||||
+ DEVICE=eno1
|
||||
+ HWADDR=07-1c-c6-75-a4-be
|
||||
+ ONBOOT=yes
|
||||
+ TYPE=Ethernet
|
||||
+ USERCTL=no
|
||||
+ """
|
||||
+ ),
|
||||
+ }
|
||||
v2data = copy.deepcopy(v2base)
|
||||
if dhcp_ver == "dhcp6":
|
||||
- expected["ifcfg-eno1"] += "IPV6INIT=yes\nDHCPV6C=yes\n"
|
||||
+ expected[
|
||||
+ "ifcfg-eno1"
|
||||
+ ] += "IPV6INIT=yes\nDHCPV6C=yes\nIPV6_ROUTE_METRIC=100\n"
|
||||
+ else:
|
||||
+ expected["ifcfg-eno1"] += "IPV4_ROUTE_METRIC=100\n"
|
||||
v2data["ethernets"]["eno1"].update(
|
||||
{dhcp_ver: True, "{0}-overrides".format(dhcp_ver): overrides}
|
||||
)
|
||||
--
|
||||
2.39.3
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 790caeb9a7ead41f5c2dbfc0968ac0fc08a7db70 Mon Sep 17 00:00:00 2001
|
||||
From: Brett Holman <brett.holman@canonical.com>
|
||||
Date: Tue, 5 Dec 2023 16:40:03 -0700
|
||||
Subject: [PATCH 2/2] fix(python3.13): Fix import error for passlib on Python
|
||||
3.13 (#4669)
|
||||
|
||||
RH-Author: xiachen <xiachen@redhat.com>
|
||||
RH-MergeRequest: 111: Fix metric setting for ifcfg network connections for rhel (#5777)
|
||||
RH-Jira: RHEL-61224
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Commit: [2/2] dc6114a60280bac272bb355f4ea4d4d5d3bc240a (xiachen/cloud-init-centos)
|
||||
|
||||
(cherry picked from commit 09b70436b3a0aae1fe24fdde6e8cdd7ee98d9c15)
|
||||
Signed-off-by: Amy Chen <xiachen@redhat.com>
|
||||
---
|
||||
cloudinit/sources/DataSourceAzure.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
|
||||
index eb0304c3..93921010 100644
|
||||
--- a/cloudinit/sources/DataSourceAzure.py
|
||||
+++ b/cloudinit/sources/DataSourceAzure.py
|
||||
@@ -58,7 +58,7 @@ try:
|
||||
)
|
||||
except (ImportError, AttributeError):
|
||||
try:
|
||||
- import passlib
|
||||
+ import passlib.hash
|
||||
|
||||
blowfish_hash = passlib.hash.sha512_crypt.hash
|
||||
except ImportError:
|
||||
--
|
||||
2.39.3
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: cloud-init
|
||||
Version: 23.4
|
||||
Release: 19%{?dist}
|
||||
Release: 20%{?dist}
|
||||
Summary: Cloud instance init scripts
|
||||
License: ASL 2.0 or GPLv3
|
||||
URL: http://launchpad.net/cloud-init
|
||||
@ -67,6 +67,10 @@ Patch32: ci-Support-setting-mirrorlist-in-yum-repository-config-.patch
|
||||
Patch33: ci-Revert-fix-vmware-Set-IPv6-to-dhcp-when-there-is-no-.patch
|
||||
# For RHEL-54686 - [RHEL-9.5] cloud-init schema validation fails.
|
||||
Patch34: ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch
|
||||
# For RHEL-61224 - Configuring metric for default gateway is not working
|
||||
Patch35: ci-Fix-metric-setting-for-ifcfg-network-connections-for.patch
|
||||
# For RHEL-61224 - Configuring metric for default gateway is not working
|
||||
Patch36: ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -281,6 +285,12 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||
|
||||
%changelog
|
||||
* Wed Oct 30 2024 Miroslav Rezanina <mrezanin@redhat.com> - 23.4-20
|
||||
- ci-Fix-metric-setting-for-ifcfg-network-connections-for.patch [RHEL-61224]
|
||||
- ci-fix-python3.13-Fix-import-error-for-passlib-on-Pytho.patch [RHEL-61224]
|
||||
- Resolves: RHEL-61224
|
||||
(Configuring metric for default gateway is not working)
|
||||
|
||||
* Mon Aug 26 2024 Miroslav Rezanina <mrezanin@redhat.com> - 23.4-19
|
||||
- ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch [RHEL-54686]
|
||||
- Resolves: RHEL-54686
|
||||
|
Loading…
Reference in New Issue
Block a user