diff --git a/SOURCES/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch b/SOURCES/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch new file mode 100644 index 0000000..ff42b2e --- /dev/null +++ b/SOURCES/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch @@ -0,0 +1,92 @@ +From c85c5aa1c09bc4b78a015a2eb338a7fcb48ad4a3 Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Mon, 13 Dec 2021 12:08:18 +0100 +Subject: [PATCH] cloudinit/net: handle two different routes for the same ip + (#1124) + +RH-Author: Emanuele Giuseppe Esposito +RH-MergeRequest: 40: cloudinit/net: handle two different routes for the same ip (#1124) +RH-Commit: [1/1] 5f1b03b15e7828a2bac80850ca70a72f981cdaa7 +RH-Bugzilla: 2003231 +RH-Acked-by: Eduardo Otubo +RH-Acked-by: Vitaly Kuznetsov +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Mohamed Gamal Morsy + +commit 0e25076b34fa995161b83996e866c0974cee431f +Author: Emanuele Giuseppe Esposito +Date: Mon Dec 6 18:34:26 2021 +0100 + + cloudinit/net: handle two different routes for the same ip (#1124) + + If we set a dhcp server side like this: + $ cat /var/tmp/cloud-init/cloud-init-dhcp-f0rie5tm/dhcp.leases + lease { + ... + option classless-static-routes 31.169.254.169.254 0.0.0.0,31.169.254.169.254 + 10.112.143.127,22.10.112.140 0.0.0.0,0 10.112.140.1; + ... + } + cloud-init fails to configure the routes via 'ip route add' because to there are + two different routes for 169.254.169.254: + + $ ip -4 route add 192.168.1.1/32 via 0.0.0.0 dev eth0 + $ ip -4 route add 192.168.1.1/32 via 10.112.140.248 dev eth0 + + But NetworkManager can handle such scenario successfully as it uses "ip route append". + So change cloud-init to also use "ip route append" to fix the issue: + + $ ip -4 route append 192.168.1.1/32 via 0.0.0.0 dev eth0 + $ ip -4 route append 192.168.1.1/32 via 10.112.140.248 dev eth0 + + Signed-off-by: Emanuele Giuseppe Esposito + + RHBZ: #2003231 + +Conflicts: + cloudinit/net/tests/test_init.py: a mock call in + test_ephemeral_ipv4_network_with_rfc3442_static_routes is not + present downstream. + + cloudinit/net/__init__.py: subp() method is implemented in util, + while in newer version it is implemented in subp file. + +Signed-off-by: Emanuele Giuseppe Esposito +--- + cloudinit/net/__init__.py | 2 +- + cloudinit/net/tests/test_init.py | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py +index bd806378..3d3f7108 100644 +--- a/cloudinit/net/__init__.py ++++ b/cloudinit/net/__init__.py +@@ -970,7 +970,7 @@ class EphemeralIPv4Network(object): + if gateway != "0.0.0.0/0": + via_arg = ['via', gateway] + util.subp( +- ['ip', '-4', 'route', 'add', net_address] + via_arg + ++ ['ip', '-4', 'route', 'append', net_address] + via_arg + + ['dev', self.interface], capture=True) + self.cleanup_cmds.insert( + 0, ['ip', '-4', 'route', 'del', net_address] + via_arg + +diff --git a/cloudinit/net/tests/test_init.py b/cloudinit/net/tests/test_init.py +index 6db93e26..a0db549b 100644 +--- a/cloudinit/net/tests/test_init.py ++++ b/cloudinit/net/tests/test_init.py +@@ -711,10 +711,10 @@ class TestEphemeralIPV4Network(CiTestCase): + ['ip', '-family', 'inet', 'link', 'set', 'dev', 'eth0', 'up'], + capture=True), + mock.call( +- ['ip', '-4', 'route', 'add', '169.254.169.254/32', ++ ['ip', '-4', 'route', 'append', '169.254.169.254/32', + 'via', '192.168.2.1', 'dev', 'eth0'], capture=True), + mock.call( +- ['ip', '-4', 'route', 'add', '0.0.0.0/0', ++ ['ip', '-4', 'route', 'append', '0.0.0.0/0', + 'via', '192.168.2.1', 'dev', 'eth0'], capture=True)] + expected_teardown_calls = [ + mock.call( +-- +2.27.0 + diff --git a/SOURCES/cloud-init-centos-user.patch b/SOURCES/cloud-init-centos-user.patch deleted file mode 100644 index 2f8118b..0000000 --- a/SOURCES/cloud-init-centos-user.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uNrp cloud-init-19.4.orig/rhel/cloud.cfg cloud-init-19.4/rhel/cloud.cfg ---- cloud-init-19.4.orig/rhel/cloud.cfg 2020-10-13 14:40:36.353779891 +0000 -+++ cloud-init-19.4/rhel/cloud.cfg 2020-10-13 14:42:10.121982459 +0000 -@@ -54,7 +54,7 @@ cloud_final_modules: - - system_info: - default_user: -- name: cloud-user -+ name: centos - lock_passwd: true - gecos: Cloud User - groups: [adm, systemd-journal] diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index 865b2f2..b686448 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -13,7 +13,7 @@ Name: cloud-init Version: 19.4 -Release: 7%{?dist}.5 +Release: 7%{?dist}.6 Summary: Cloud instance init scripts Group: System Environment/Base @@ -66,8 +66,8 @@ Patch24: ci-network-Fix-type-and-respect-name-when-rendering-vla.patch Patch25: ci-DataSourceAzure-update-password-for-defuser-if-exist.patch # For bz#1897616 - [rhel-7]cloud-final.service fails if NetworkManager not installed. Patch26: ci-Fix-unit-failure-of-cloud-final.service-if-NetworkMa.patch - -Patch9999: cloud-init-centos-user.patch +# For bz#2003231 - anything above 19.2 of cloud init it fails to assign default route and connect to the meta data service +Patch27: ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch # Deal with noarch -> arch # https://bugzilla.redhat.com/show_bug.cgi?id=1067089 @@ -238,6 +238,11 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Mon Jan 24 2022 Jon Maloy - 19.4-7.el7_9.6 +- ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch [bz#2003231] +- Resolves: bz#2003231 + (anything above 19.2 of cloud init it fails to assign default route and connect to the meta data service) + * Tue Jun 29 2021 Miroslav Rezanina - 19.4-7.el7_9.5 - ci-Fix-unit-failure-of-cloud-final.service-if-NetworkMa.patch [bz#1897616] - Resolves: bz#1897616