diff --git a/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch b/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch new file mode 100644 index 0000000000000000000000000000000000000000..ff42b2ea4d74c3ed1834eb1406c7dd8cf394aca4 --- /dev/null +++ b/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/cloud-init.spec b/cloud-init.spec index f9f5fa9f9893bb1c475777a68878233bfcafa628..76e5c53479cd339a0119297099a072cd8f7a6e88 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -15,7 +15,7 @@ Name: cloud-init Version: 19.4 -Release: 7%{anolis_release}%{?dist}.5 +Release: 7%{anolis_release}%{?dist}.6 Summary: Cloud instance init scripts Group: System Environment/Base @@ -68,6 +68,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 +# 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 #Add by Anolis Patch9999: 0001-cloud-init-anolis-user.patch @@ -242,9 +244,13 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog -* Thu Jan 06 2022 Jacob Wang - 19.4-7.0.1.5 +* Wed Feb 06 2022 Jacob Wang - 19.4-7.0.1.5 - Rebrand to Anolis OS -- Cherry-pick [6b3f611] + +* 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]