diff --git a/.packit.yaml b/.packit.yaml deleted file mode 100644 index 8559094..0000000 --- a/.packit.yaml +++ /dev/null @@ -1,12 +0,0 @@ -upstream_package_name: cloud-init -downstream_package_name: cloud-init - -upstream_project_url: https://github.com/canonical/cloud-init - -specfile_path: cloud-init.spec - -jobs: - - job: pull_from_upstream - trigger: release - dist_git_branches: - - fedora-rawhide diff --git a/0001-Add-initial-redhat-changes.patch b/0001-Add-initial-redhat-changes.patch new file mode 100644 index 0000000..6575d1e --- /dev/null +++ b/0001-Add-initial-redhat-changes.patch @@ -0,0 +1,110 @@ +From 479f1646e251e7c72c9d57589d6c72568f054fef Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 13 Dec 2023 11:54:55 +0530 +Subject: [PATCH] Add initial redhat changes + +Adding minimal set of changes necessary for successful build of the package +on RHEL/CentOS 10 Stream koji. + +Changes for 24.1.3 release: + - Updated version in spec file in .dist. + - Updated source tarball name in spec file in .dist/ + - Removed reference to Patch0 coming from Fedora in spec file in .dist. + - Removed reference to clean.d/README from spec file in .dist/ + - Updated VERSION, MARKER etc in Makefile.common in .dist. + - Updated sha512 in sources.sha512 under .dist/ + - Updated TargetRelease to point to RHEL 10.0 in .dist/ + +Additional changes for 23.4 rebase: + - Updated VERSION, TARSHA512, MARKER and BUILD_TARGET_RHEL parameters in + Makefile.common in .dist/ + - Squashed unit test fixes for the downstream changes in cloudinit/settings.py. + +Changes from 23.1.1 rebase follows: + +Merged patches (23.1.1): +724a80ac Add TargetRelease +967a4405b rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set in cloud.cfg +^ Merged since it removes hunks added in this commit itself + +Discarded because not needed anymore (packit): +e3fd7ce12 Configure Packit to ignore the .gitignore file +e18654e9 Fixes for packit support + +Discarded because file does not exist anymore and templates are aligned with upstream: +3576b12460bf18557857ee25df6bf530dab66612 Adding _netdev to the default mount configuration +8092b57ab245856ff1fdde1469960608a489c95e Remove rhel specific files + +Added the following entry to %files to keep track of the new README file in config/clean.d/README +%doc %{_sysconfdir}/cloud/clean.d/README + +ignored +c75e509b0 Revert "Revert "Setting highest autoconnect priority for network-scripts"" +0eba5c619 Revert "Setting highest autoconnect priority for network-scripts" + +ignored +ba19343c0d9807d0c68a2d8e4ab274f3ca884247 Add Gitlab CI +fe09305a5479a4814d6c46df07a906bafa29d637 Delete .gitlab-ci.yml + +Conflicts: +missing rhel/ static files and "" instead of '' in setup.py + +X-downstram-only: true +Signed-off-by: Emanuele Giuseppe Esposito +Signed-off-by: Ani Sinha +(cherry picked from commit 03345a88b8b0008a4a81e010d46290f5ba643ebc) +Signed-off-by: Ani Sinha +--- + cloudinit/settings.py | 5 +++-- + tests/unittests/cmd/test_main.py | 15 +++++++++------ + 2 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/cloudinit/settings.py b/cloudinit/settings.py +index b075682f..f749c509 100644 +--- a/cloudinit/settings.py ++++ b/cloudinit/settings.py +@@ -55,13 +55,14 @@ CFG_BUILTIN = { + ], + "def_log_file": "/var/log/cloud-init.log", + "log_cfgs": [], +- "syslog_fix_perms": ["syslog:adm", "root:adm", "root:wheel", "root:root"], ++ "mount_default_fields": [None, None, "auto", "defaults,nofail", "0", "2"], ++ "syslog_fix_perms": [], + "system_info": { + "paths": { + "cloud_dir": "/var/lib/cloud", + "templates_dir": "/etc/cloud/templates/", + }, +- "distro": "ubuntu", ++ "distro": "rhel", + "network": {"renderers": None}, + }, + "vendor_data": {"enabled": True, "prefix": []}, +diff --git a/tests/unittests/cmd/test_main.py b/tests/unittests/cmd/test_main.py +index 7f580203..19316be3 100644 +--- a/tests/unittests/cmd/test_main.py ++++ b/tests/unittests/cmd/test_main.py +@@ -131,14 +131,17 @@ class TestMain(FilesystemMockingTestCase): + { + "def_log_file": "/var/log/cloud-init.log", + "log_cfgs": [], +- "syslog_fix_perms": [ +- "syslog:adm", +- "root:adm", +- "root:wheel", +- "root:root", +- ], + "vendor_data": {"enabled": True, "prefix": []}, + "vendor_data2": {"enabled": True, "prefix": []}, ++ "syslog_fix_perms": [], ++ "mount_default_fields": [ ++ None, ++ None, ++ "auto", ++ "defaults,nofail", ++ "0", ++ "2", ++ ], + } + ) + updated_cfg.pop("system_info") diff --git a/0002-fix-rhel-Fix-network-ordering-in-sysconfig.patch b/0002-fix-rhel-Fix-network-ordering-in-sysconfig.patch new file mode 100644 index 0000000..2a4471c --- /dev/null +++ b/0002-fix-rhel-Fix-network-ordering-in-sysconfig.patch @@ -0,0 +1,268 @@ +From 8effa259c803f265553b8bfc629835d88815e2dd Mon Sep 17 00:00:00 2001 +From: Brett Holman +Date: Tue, 26 Mar 2024 15:02:39 -0500 +Subject: [PATCH] fix(rhel): Fix network ordering in sysconfig + +NM_CONTROLLED=true allows cloud-init to wait until network devices are online. + +See upstream PR: https://github.com/canonical/cloud-init/pull/5089 + +Conflicts: + tests/unittests/net/network_configs.py + This file was added in commit a576d11ef93d ("Cleanup test_net.py (#4840)") + This commit is not part of 24.1.2 release. + +(cherry picked from commit 9a7674af70026ba77612c8f53a82573bdc350ff7) +Signed-off-by: Ani Sinha +--- + cloudinit/net/sysconfig.py | 1 - + doc/rtd/reference/network-config.rst | 2 -- + tests/unittests/cmd/devel/test_net_convert.py | 1 - + tests/unittests/distros/test_netconfig.py | 8 -------- + tests/unittests/test_net.py | 16 ---------------- + 5 files changed, 28 deletions(-) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index 622b8faf..3be35126 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -317,7 +317,6 @@ class Renderer(renderer.Renderer): + "rhel": { + "ONBOOT": True, + "USERCTL": False, +- "NM_CONTROLLED": False, + "BOOTPROTO": "none", + }, + "suse": {"BOOTPROTO": "static", "STARTMODE": "auto"}, +diff --git a/doc/rtd/reference/network-config.rst b/doc/rtd/reference/network-config.rst +index d9e67cf7..130b665e 100644 +--- a/doc/rtd/reference/network-config.rst ++++ b/doc/rtd/reference/network-config.rst +@@ -308,7 +308,6 @@ Example output: + BOOTPROTO=static + DEVICE=eth7 + IPADDR=192.168.1.5/255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -316,7 +315,6 @@ Example output: + # + BOOTPROTO=dhcp + DEVICE=eth9 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +diff --git a/tests/unittests/cmd/devel/test_net_convert.py b/tests/unittests/cmd/devel/test_net_convert.py +index be2fcdd6..3e9a4f90 100644 +--- a/tests/unittests/cmd/devel/test_net_convert.py ++++ b/tests/unittests/cmd/devel/test_net_convert.py +@@ -62,7 +62,6 @@ SAMPLE_SYSCONFIG_CONTENT = """\ + # + BOOTPROTO=dhcp + DEVICE=eth0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +diff --git a/tests/unittests/distros/test_netconfig.py b/tests/unittests/distros/test_netconfig.py +index d1e251b6..f35e5b0a 100644 +--- a/tests/unittests/distros/test_netconfig.py ++++ b/tests/unittests/distros/test_netconfig.py +@@ -723,7 +723,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + GATEWAY=192.168.1.254 + IPADDR=192.168.1.5 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -733,7 +732,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + """\ + BOOTPROTO=dhcp + DEVICE=eth1 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -764,7 +762,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + IPV6_AUTOCONF=no + IPV6_DEFAULTGW=2607:f0d0:1002:0011::1 + IPV6_FORCE_ACCEPT_RA=no +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -774,7 +771,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + """\ + BOOTPROTO=dhcp + DEVICE=eth1 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -821,7 +817,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + HWADDR=00:16:3e:60:7c:df + IPADDR=192.10.1.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -833,7 +828,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + DEVICE=infra0 + IPADDR=10.0.1.2 + NETMASK=255.255.0.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=eth0 + USERCTL=no +@@ -869,7 +863,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + DEVICE=eth0 + IPADDR=192.10.1.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -881,7 +874,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + DEVICE=eth0.1001 + IPADDR=10.0.1.2 + NETMASK=255.255.0.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=eth0 + USERCTL=no +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index cb991938..f898543c 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -585,7 +585,6 @@ GATEWAY=172.19.3.254 + HWADDR=fa:16:3e:ed:9a:59 + IPADDR=172.19.1.34 + NETMASK=255.255.252.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -751,7 +750,6 @@ IPADDR=172.19.1.34 + IPADDR1=10.0.0.10 + NETMASK=255.255.252.0 + NETMASK1=255.255.255.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -913,7 +911,6 @@ IPV6_AUTOCONF=no + IPV6_DEFAULTGW=2001:DB8::1 + IPV6_FORCE_ACCEPT_RA=no + NETMASK=255.255.252.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5232,7 +5229,6 @@ DEVICE=eth1000 + DHCPV6C=yes + HWADDR=07-1c-c6-75-a4-be + IPV6INIT=yes +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5444,7 +5440,6 @@ GATEWAY=10.0.2.2 + HWADDR=52:54:00:12:34:00 + IPADDR=10.0.2.15 + NETMASK=255.255.255.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5475,7 +5470,6 @@ HWADDR=fa:16:3e:25:b4:59 + IPADDR=51.68.89.122 + MTU=1500 + NETMASK=255.255.240.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5489,7 +5483,6 @@ DEVICE=eth1 + DHCLIENT_SET_DEFAULT_ROUTE=no + HWADDR=fa:16:3e:b1:ca:29 + MTU=9000 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5514,7 +5507,6 @@ USERCTL=no + # + BOOTPROTO=dhcp + DEVICE=eth0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5761,7 +5753,6 @@ USERCTL=no + IPV6_FORCE_ACCEPT_RA=no + IPV6_DEFAULTGW=2001:db8::1 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5793,7 +5784,6 @@ USERCTL=no + """\ + BOOTPROTO=none + DEVICE=eno1 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5806,7 +5796,6 @@ USERCTL=no + IPADDR=192.6.1.9 + MTU=1495 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=eno1 + USERCTL=no +@@ -5842,7 +5831,6 @@ USERCTL=no + IPADDR=10.101.8.65 + MTU=1334 + NETMASK=255.255.255.192 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Bond + USERCTL=no +@@ -5854,7 +5842,6 @@ USERCTL=no + BOOTPROTO=none + DEVICE=enp0s0 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Bond +@@ -5867,7 +5854,6 @@ USERCTL=no + BOOTPROTO=none + DEVICE=enp0s1 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Bond +@@ -5898,7 +5884,6 @@ USERCTL=no + DEVICE=eno1 + HWADDR=07-1c-c6-75-a4-be + METRIC=100 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -5989,7 +5974,6 @@ USERCTL=no + IPV6_FORCE_ACCEPT_RA=no + MTU=1400 + NETMASK=255.255.248.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no diff --git a/0003-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch b/0003-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch new file mode 100644 index 0000000..1e0a890 --- /dev/null +++ b/0003-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch @@ -0,0 +1,372 @@ +From 2d18b8b02f9de3a8ddf894241be2489de479a767 Mon Sep 17 00:00:00 2001 +From: Eduardo Otubo +Date: Fri, 7 May 2021 13:36:06 +0200 +Subject: [PATCH] Do not write NM_CONTROLLED=no in generated interface config + files + +Changes for 24.1.2: + - Renamed load_file() to load_text_file(). Please see + d27eab110 ("refactor: Replace load_file with load_binary_file to simplify typing (#4823)") + - Removed changes that are already covered by backport of the upstream commit: + 9a7674af70 (" fix(rhel): Fix network ordering in sysconfig") + This change was backported with c10s commit 40f9ba8e3805e52be4 . + +Conflicts 20.3: + - Not appplying patch on cloudinit/net/sysconfig.py since it now has a +mechanism to identify if cloud-init is running on RHEL, having the +correct settings for NM_CONTROLLED. + +Merged patches (21.1): +- ecbace48 sysconfig: Don't write BOOTPROTO=dhcp for ipv6 dhcp +- a1a00383 include 'NOZEROCONF=yes' in /etc/sysconfig/network +X-downstream-only: true +Signed-off-by: Eduardo Otubo +Signed-off-by: Ryan McCabe + +Signed-off-by: Ani Sinha +(cherry picked from commit 5129908caa1867c7f584ec8d38607cf56b20521a) +--- + cloudinit/net/sysconfig.py | 13 ++++++++++++- + tests/unittests/test_net.py | 39 ------------------------------------- + 2 files changed, 12 insertions(+), 40 deletions(-) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index 3be35126..b9e9593b 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -1031,7 +1031,18 @@ class Renderer(renderer.Renderer): + # Distros configuring /etc/sysconfig/network as a file e.g. Centos + if sysconfig_path.endswith("network"): + util.ensure_dir(os.path.dirname(sysconfig_path)) +- netcfg = [_make_header(), "NETWORKING=yes"] ++ netcfg = [] ++ for line in util.load_text_file(sysconfig_path, quiet=True).split( ++ "\n" ++ ): ++ if "cloud-init" in line: ++ break ++ if not line.startswith( ++ ("NETWORKING=", "IPV6_AUTOCONF=", "NETWORKING_IPV6=") ++ ): ++ netcfg.append(line) ++ # Now generate the cloud-init portion of sysconfig/network ++ netcfg.extend([_make_header(), "NETWORKING=yes"]) + if network_state.use_ipv6: + netcfg.append("NETWORKING_IPV6=yes") + netcfg.append("IPV6_AUTOCONF=no") +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index f898543c..d83c52f0 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -1141,7 +1141,6 @@ NETWORK_CONFIGS = { + BOOTPROTO=none + DEVICE=eth1 + HWADDR=cf:d6:af:48:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -1160,7 +1159,6 @@ NETWORK_CONFIGS = { + IPADDR=192.168.21.3 + NETMASK=255.255.255.0 + METRIC=10000 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -1315,7 +1313,6 @@ NETWORK_CONFIGS = { + BOOTPROTO=none + DEVICE=eth1 + HWADDR=cf:d6:af:48:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -1334,7 +1331,6 @@ NETWORK_CONFIGS = { + IPADDR=192.168.21.3 + NETMASK=255.255.255.0 + METRIC=10000 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -1577,7 +1573,6 @@ NETWORK_CONFIGS = { + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -1721,7 +1716,6 @@ NETWORK_CONFIGS = { + DHCPV6C=yes + IPV6INIT=yes + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -1812,7 +1806,6 @@ NETWORK_CONFIGS = { + IPV6INIT=yes + IPV6_FORCE_ACCEPT_RA=yes + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -1888,7 +1881,6 @@ NETWORK_CONFIGS = { + IPV6INIT=yes + IPV6_FORCE_ACCEPT_RA=no + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -1952,7 +1944,6 @@ NETWORK_CONFIGS = { + IPV6_AUTOCONF=yes + IPV6INIT=yes + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2010,7 +2001,6 @@ NETWORK_CONFIGS = { + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2067,7 +2057,6 @@ NETWORK_CONFIGS = { + IPV6_AUTOCONF=yes + IPV6INIT=yes + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2153,7 +2142,6 @@ NETWORK_CONFIGS = { + IPV6_FAILURE_FATAL=yes + IPV6_FORCE_ACCEPT_RA=yes + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2194,7 +2182,6 @@ NETWORK_CONFIGS = { + """\ + BOOTPROTO=dhcp + DEVICE=iface0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2271,7 +2258,6 @@ NETWORK_CONFIGS = { + BOOTPROTO=dhcp + DEVICE=iface0 + ETHTOOL_OPTS="wol g" +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2615,7 +2601,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DHCPV6C=yes + IPV6INIT=yes + MACADDR=aa:bb:cc:dd:ee:ff +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Bond + USERCTL=no""" +@@ -2625,7 +2610,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BOOTPROTO=dhcp + DEVICE=bond0.200 + DHCLIENT_SET_DEFAULT_ROUTE=no +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=bond0 + USERCTL=no +@@ -2645,7 +2629,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + IPV6_DEFAULTGW=2001:4800:78ff:1b::1 + MACADDR=bb:bb:bb:bb:bb:aa + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PRIO=22 + STP=no +@@ -2657,7 +2640,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BOOTPROTO=none + DEVICE=eth0 + HWADDR=c0:d6:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -2676,7 +2658,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + MTU=1500 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=eth0 + USERCTL=no +@@ -2688,7 +2669,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth1 + HWADDR=aa:d6:9f:2c:e8:80 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -2700,7 +2680,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth2 + HWADDR=c0:bb:9f:2c:e8:80 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -2712,7 +2691,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BRIDGE=br0 + DEVICE=eth3 + HWADDR=66:bb:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -2723,7 +2701,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BRIDGE=br0 + DEVICE=eth4 + HWADDR=98:bb:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -2734,7 +2711,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth5 + DHCLIENT_SET_DEFAULT_ROUTE=no + HWADDR=98:bb:9f:2c:e8:8a +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no""" +@@ -2747,7 +2723,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + IPADDR=192.168.200.7 + MTU=9000 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=InfiniBand + USERCTL=no""" +@@ -3479,7 +3454,6 @@ iface bond0 inet6 static + MTU=9000 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Bond + USERCTL=no +@@ -3491,7 +3465,6 @@ iface bond0 inet6 static + DEVICE=bond0s0 + HWADDR=aa:bb:cc:dd:e8:00 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -3519,7 +3492,6 @@ iface bond0 inet6 static + DEVICE=bond0s1 + HWADDR=aa:bb:cc:dd:e8:01 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -3668,7 +3640,6 @@ iface bond0 inet6 static + BOOTPROTO=none + DEVICE=en0 + HWADDR=aa:bb:cc:dd:e8:00 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -3689,7 +3660,6 @@ iface bond0 inet6 static + MTU=2222 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=en0 + USERCTL=no +@@ -3817,7 +3787,6 @@ iface bond0 inet6 static + DEVICE=br0 + IPADDR=192.168.2.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PRIO=22 + STP=no +@@ -3835,7 +3804,6 @@ iface bond0 inet6 static + IPV6INIT=yes + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -3851,7 +3819,6 @@ iface bond0 inet6 static + IPV6INIT=yes + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -4036,7 +4003,6 @@ iface bond0 inet6 static + HWADDR=52:54:00:12:34:00 + IPADDR=192.168.1.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no +@@ -4048,7 +4014,6 @@ iface bond0 inet6 static + DEVICE=eth1 + HWADDR=52:54:00:12:34:aa + MTU=1480 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -4059,7 +4024,6 @@ iface bond0 inet6 static + BOOTPROTO=none + DEVICE=eth2 + HWADDR=52:54:00:12:34:ff +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no +@@ -4236,7 +4200,6 @@ iface bond0 inet6 static + HWADDR=11:22:33:44:55:66 + IPADDR=192.168.1.20 + NETMASK=255.255.0.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -4308,7 +4271,6 @@ iface bond0 inet6 static + BOOTPROTO=none + DEVICE=eth0 + HWADDR=cf:d6:af:48:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no""" +@@ -4468,7 +4430,6 @@ iface bond0 inet6 static + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no + NETMASK=255.255.0.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no diff --git a/0004-Setting-autoconnect-priority-setting-for-network-scr.patch b/0004-Setting-autoconnect-priority-setting-for-network-scr.patch new file mode 100644 index 0000000..ff32cc4 --- /dev/null +++ b/0004-Setting-autoconnect-priority-setting-for-network-scr.patch @@ -0,0 +1,596 @@ +From 4e24e6f9e786437d94ba5e2d3e084ef2a2fc534f Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 13 Dec 2023 11:55:16 +0530 +Subject: [PATCH] Setting autoconnect priority setting for network-scripts + +Changes for 24.1.2 (c10s): + - Fixed additional unit tests. + +Changes for 23.4 (c9s): + +Squashed the following three downstream only commits from RHEL 9.3: + +Commit 1: + +Setting highest autoconnect priority for network-scripts + +RH-Author: Eduardo Otubo +RH-MergeRequest: 22: Setting highest autoconnect priority for network-scripts +RH-Commit: [1/1] 34f1d62f8934a983a124df95b861a1e448681d3b (otubo/cloud-init-src) +RH-Bugzilla: 2036060 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Emanuele Giuseppe Esposito + +Set the highest autoconnect priority for network-scripts which is +loaded by NetworkManager ifcfg-rh plugin. Note that keyfile is the only +and default existing plugin on RHEL9, by setting the highest autoconnect +priority for network-scripts, NetworkManager will activate +network-scripts but keyfile. Network-scripts path: + +Since this is a blocking issue, we decided to have this one-liner +downstream-only patch so we can move forward and have a better +NetworkManager support later on the release. + +rhbz: 2036060 +x-downstream-only: yes + +Commit 2: + +net/sysconfig: do not use the highest autoconnect priority + +Using the highest priority is a very big hammer that we may not want to use. We +may want users to override the cloud init generated ifcfg files for custom +configuration of interfaces. If cloud init uses the highest priority, nothing +can beat it. Hence lower the priority to 120 allowing values from 121 to 999 +to be used by users if they want to use a custom interface nm keyfile. + +X-downstream-only: true + +Suggested-by: thaller@redhat.com +fixes: c589da20eb92231 ("Setting highest autoconnect priority for network-scripts") + +Commit 3: + +test fixes: update tests to reflect AUTOCONNECT_PRIORITY setting + +X-downstream-only: true +fixes: 0a2c6b6118ff ("net/sysconfig: do not use the highest autoconnect priority") +fixes: c589da20eb92 ("Setting highest autoconnect priority for network-scripts") + +Signed-off-by: Ani Sinha +(cherry picked from commit 8a2fcbbcfdfc1df6f6c18f96588154f40083a239) +--- + cloudinit/net/sysconfig.py | 1 + + tests/unittests/cmd/devel/test_net_convert.py | 1 + + tests/unittests/distros/test_netconfig.py | 8 +++ + tests/unittests/test_net.py | 54 +++++++++++++++++++ + 4 files changed, 64 insertions(+) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index b9e9593b..1678fcde 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -318,6 +318,7 @@ class Renderer(renderer.Renderer): + "ONBOOT": True, + "USERCTL": False, + "BOOTPROTO": "none", ++ "AUTOCONNECT_PRIORITY": 120, + }, + "suse": {"BOOTPROTO": "static", "STARTMODE": "auto"}, + } +diff --git a/tests/unittests/cmd/devel/test_net_convert.py b/tests/unittests/cmd/devel/test_net_convert.py +index 3e9a4f90..b6da87ca 100644 +--- a/tests/unittests/cmd/devel/test_net_convert.py ++++ b/tests/unittests/cmd/devel/test_net_convert.py +@@ -60,6 +60,7 @@ DHCP=ipv4 + SAMPLE_SYSCONFIG_CONTENT = """\ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth0 + ONBOOT=yes +diff --git a/tests/unittests/distros/test_netconfig.py b/tests/unittests/distros/test_netconfig.py +index f35e5b0a..6b4fc666 100644 +--- a/tests/unittests/distros/test_netconfig.py ++++ b/tests/unittests/distros/test_netconfig.py +@@ -717,6 +717,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + expected_cfgs = { + self.ifcfg_path("eth0"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -730,6 +731,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + ), + self.ifcfg_path("eth1"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth1 + ONBOOT=yes +@@ -754,6 +756,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + expected_cfgs = { + self.ifcfg_path("eth0"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -769,6 +772,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + ), + self.ifcfg_path("eth1"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth1 + ONBOOT=yes +@@ -812,6 +816,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + expected_cfgs = { + self.ifcfg_path("eth0"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + HWADDR=00:16:3e:60:7c:df +@@ -824,6 +829,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + ), + self.ifcfg_path("infra0"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=infra0 + IPADDR=10.0.1.2 +@@ -859,6 +865,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + expected_cfgs = { + self.ifcfg_path("eth0"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + IPADDR=192.10.1.2 +@@ -870,6 +877,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): + ), + self.ifcfg_path("eth0.1001"): dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0.1001 + IPADDR=10.0.1.2 +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index d83c52f0..fee8e035 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -578,6 +578,7 @@ dns = none + """ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -741,6 +742,7 @@ dns = none + """ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -898,6 +900,7 @@ dns = none + """ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -1138,6 +1141,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-eth1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth1 + HWADDR=cf:d6:af:48:e8:80 +@@ -1147,6 +1151,7 @@ NETWORK_CONFIGS = { + ), + "ifcfg-eth99": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEFROUTE=yes + DEVICE=eth99 +@@ -1310,6 +1315,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-eth1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth1 + HWADDR=cf:d6:af:48:e8:80 +@@ -1319,6 +1325,7 @@ NETWORK_CONFIGS = { + ), + "ifcfg-eth99": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEFROUTE=yes + DEVICE=eth99 +@@ -1565,6 +1572,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + IPADDR=192.168.14.2 +@@ -1711,6 +1719,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + DHCPV6C=yes +@@ -1800,6 +1809,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + DHCPV6C=yes +@@ -1875,6 +1885,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + DHCPV6C=yes +@@ -1939,6 +1950,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + IPV6_AUTOCONF=yes +@@ -1994,6 +2006,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + IPV6ADDR=2001:1::1/64 +@@ -2050,6 +2063,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + DHCPV6C=yes +@@ -2134,6 +2148,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=iface0 + DHCPV6C=yes +@@ -2180,6 +2195,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=iface0 + ONBOOT=yes +@@ -2255,6 +2271,7 @@ NETWORK_CONFIGS = { + "expected_sysconfig_rhel": { + "ifcfg-iface0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=iface0 + ETHTOOL_OPTS="wol g" +@@ -2590,6 +2607,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + "expected_sysconfig_rhel": { + "ifcfg-bond0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BONDING_MASTER=yes + BONDING_OPTS="mode=active-backup """ + """xmit_hash_policy=layer3+4 """ +@@ -2607,6 +2625,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-bond0.200": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=bond0.200 + DHCLIENT_SET_DEFAULT_ROUTE=no +@@ -2618,6 +2637,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + "ifcfg-br0": textwrap.dedent( + """\ + AGEING=250 ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=br0 +@@ -2637,6 +2657,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + HWADDR=c0:d6:9f:2c:e8:80 +@@ -2646,6 +2667,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth0.101": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0.101 +@@ -2665,6 +2687,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth1 + HWADDR=aa:d6:9f:2c:e8:80 +@@ -2676,6 +2699,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth2": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth2 + HWADDR=c0:bb:9f:2c:e8:80 +@@ -2687,6 +2711,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth3": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + BRIDGE=br0 + DEVICE=eth3 +@@ -2697,6 +2722,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth4": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + BRIDGE=br0 + DEVICE=eth4 +@@ -2707,6 +2733,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-eth5": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth5 + DHCLIENT_SET_DEFAULT_ROUTE=no +@@ -2717,6 +2744,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + ), + "ifcfg-ib0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=ib0 + HWADDR=a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1 +@@ -3431,6 +3459,7 @@ iface bond0 inet6 static + "expected_sysconfig_rhel": { + "ifcfg-bond0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BONDING_MASTER=yes + BONDING_OPTS="mode=active-backup xmit_hash_policy=layer3+4 """ + """miimon=100 num_grat_arp=5 """ +@@ -3461,6 +3490,7 @@ iface bond0 inet6 static + ), + "ifcfg-bond0s0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=bond0s0 + HWADDR=aa:bb:cc:dd:e8:00 +@@ -3488,6 +3518,7 @@ iface bond0 inet6 static + ), + "ifcfg-bond0s1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=bond0s1 + HWADDR=aa:bb:cc:dd:e8:01 +@@ -3637,6 +3668,7 @@ iface bond0 inet6 static + "expected_sysconfig_rhel": { + "ifcfg-en0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=en0 + HWADDR=aa:bb:cc:dd:e8:00 +@@ -3646,6 +3678,7 @@ iface bond0 inet6 static + ), + "ifcfg-en0.99": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=en0.99 +@@ -3783,6 +3816,7 @@ iface bond0 inet6 static + "expected_sysconfig_rhel": { + "ifcfg-br0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=br0 + IPADDR=192.168.2.2 +@@ -3796,6 +3830,7 @@ iface bond0 inet6 static + ), + "ifcfg-eth0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + BRIDGE=br0 + DEVICE=eth0 +@@ -3811,6 +3846,7 @@ iface bond0 inet6 static + ), + "ifcfg-eth1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + BRIDGE=br0 + DEVICE=eth1 +@@ -3998,6 +4034,7 @@ iface bond0 inet6 static + "expected_sysconfig_rhel": { + "ifcfg-eth0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + HWADDR=52:54:00:12:34:00 +@@ -4010,6 +4047,7 @@ iface bond0 inet6 static + ), + "ifcfg-eth1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth1 + HWADDR=52:54:00:12:34:aa +@@ -4021,6 +4059,7 @@ iface bond0 inet6 static + ), + "ifcfg-eth2": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth2 + HWADDR=52:54:00:12:34:ff +@@ -4268,6 +4307,7 @@ iface bond0 inet6 static + "expected_sysconfig_rhel": { + "ifcfg-eth0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + HWADDR=cf:d6:af:48:e8:80 +@@ -4419,6 +4459,7 @@ iface bond0 inet6 static + """\ + # Created by cloud-init automatically, do not edit. + # ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eth0 + DNS1=8.8.8.8 +@@ -5185,6 +5226,7 @@ class TestRhelSysConfigRendering(CiTestCase): + expected_content = """ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth1000 + DHCPV6C=yes +@@ -5394,6 +5436,7 @@ USERCTL=no + expected = """\ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=interface0 +@@ -5423,6 +5466,7 @@ USERCTL=no + expected_i1 = """\ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 +@@ -5439,6 +5483,7 @@ USERCTL=no + expected_i2 = """\ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth1 + DHCLIENT_SET_DEFAULT_ROUTE=no +@@ -5466,6 +5511,7 @@ USERCTL=no + expected = """\ + # Created by cloud-init automatically, do not edit. + # ++AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eth0 + ONBOOT=yes +@@ -5699,6 +5745,7 @@ USERCTL=no + "expected_sysconfig": { + "ifcfg-ens3": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=ens3 +@@ -5743,6 +5790,7 @@ USERCTL=no + expected = { + "ifcfg-eno1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eno1 + ONBOOT=yes +@@ -5752,6 +5800,7 @@ USERCTL=no + ), + "ifcfg-eno1.1000": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEVICE=eno1.1000 + IPADDR=192.6.1.9 +@@ -5784,6 +5833,7 @@ USERCTL=no + expected = { + "ifcfg-bond0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BONDING_MASTER=yes + BONDING_SLAVE0=enp0s0 + BONDING_SLAVE1=enp0s1 +@@ -5799,6 +5849,7 @@ USERCTL=no + ), + "ifcfg-enp0s0": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BONDING_MASTER=yes + BOOTPROTO=none + DEVICE=enp0s0 +@@ -5811,6 +5862,7 @@ USERCTL=no + ), + "ifcfg-enp0s1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BONDING_MASTER=yes + BOOTPROTO=none + DEVICE=enp0s1 +@@ -5841,6 +5893,7 @@ USERCTL=no + expected = { + "ifcfg-eno1": textwrap.dedent( + """\ ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=dhcp + DEVICE=eno1 + HWADDR=07-1c-c6-75-a4-be +@@ -5919,6 +5972,7 @@ USERCTL=no + """\ + # Created by cloud-init automatically, do not edit. + # ++ AUTOCONNECT_PRIORITY=120 + BOOTPROTO=none + DEFROUTE=yes + DEVICE=eth0 diff --git a/0005-feat-Use-NetworkManager-renderer-by-default-in-RHEL-.patch b/0005-feat-Use-NetworkManager-renderer-by-default-in-RHEL-.patch new file mode 100644 index 0000000..ed61cd6 --- /dev/null +++ b/0005-feat-Use-NetworkManager-renderer-by-default-in-RHEL-.patch @@ -0,0 +1,26 @@ +From 5745b21c9e9e47478b8920e3ccf5e82afffefcdf Mon Sep 17 00:00:00 2001 +From: Brett Holman +Date: Tue, 26 Mar 2024 15:00:41 -0500 +Subject: [PATCH] feat: Use NetworkManager renderer by default in RHEL family + +See upstream GH: https://github.com/canonical/cloud-init/pull/5089 + +(cherry picked from commit 97537494d95f733fce260beb5a2d465cccf9f6c7) +Signed-off-by: Ani Sinha +--- + config/cloud.cfg.tmpl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl +index 0e785dbe..a4701209 100644 +--- a/config/cloud.cfg.tmpl ++++ b/config/cloud.cfg.tmpl +@@ -306,7 +306,7 @@ system_info: + activators: ['netplan', 'eni', 'network-manager', 'networkd'] + {% elif is_rhel %} + network: +- renderers: ['sysconfig', 'eni', 'netplan', 'network-manager', 'networkd'] ++ renderers: ['eni', 'netplan', 'network-manager', 'sysconfig', 'networkd'] + {% endif %} + {% if variant == "photon" %} + # If set to true, cloud-init will not use fallback network config. diff --git a/Do-not-enable-dhcp6-on-EC2.patch b/Do-not-enable-dhcp6-on-EC2.patch deleted file mode 100644 index 898aa81..0000000 --- a/Do-not-enable-dhcp6-on-EC2.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 02d0c4852feddb0715cb515e5e552351df3d9e5f Mon Sep 17 00:00:00 2001 -From: Major Hayden -Date: Tue, 28 Mar 2023 17:16:41 -0500 -Subject: [PATCH] ec2: Do not enable dhcp6 on EC2 - -When cloud-init finds any ipv6 information in the instance metadata, it -automatically enables dhcp6 for the network interface. However, this -brings up the instance with a broken IPv6 configuration because SLAAC -should be used for almost all situations on EC2. - -Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459 -Fedora Pagure: https://pagure.io/cloud-sig/issue/382 -Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526 - -Signed-off-by: Major Hayden ---- - cloudinit/sources/DataSourceEc2.py | 5 ----- - tests/unittests/sources/test_ec2.py | 15 +++++++-------- - 2 files changed, 7 insertions(+), 13 deletions(-) - -diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py -index 44665b26..b78b3e99 100644 ---- a/cloudinit/sources/DataSourceEc2.py -+++ b/cloudinit/sources/DataSourceEc2.py -@@ -921,8 +921,6 @@ def convert_ec2_metadata_network_config( - "set-name": nic_name, - } - nic_metadata = macs_metadata.get(mac) -- if nic_metadata.get("ipv6s"): # Any IPv6 addresses configured -- dev_config["dhcp6"] = True - netcfg["ethernets"][nic_name] = dev_config - return netcfg - # Apply network config for all nics and any secondary IPv4/v6 addresses -@@ -942,9 +940,6 @@ def convert_ec2_metadata_network_config( - "match": {"macaddress": mac.lower()}, - "set-name": nic_name, - } -- if nic_metadata.get("ipv6s"): # Any IPv6 addresses configured -- dev_config["dhcp6"] = True -- dev_config["dhcp6-overrides"] = dhcp_override - dev_config["addresses"] = get_secondary_addresses(nic_metadata, mac) - if not dev_config["addresses"]: - dev_config.pop("addresses") # Since we found none configured -diff --git a/tests/unittests/sources/test_ec2.py b/tests/unittests/sources/test_ec2.py -index 3fe525e3..9721cab2 100644 ---- a/tests/unittests/sources/test_ec2.py -+++ b/tests/unittests/sources/test_ec2.py -@@ -432,7 +432,7 @@ class TestEc2(test_helpers.ResponsesTestCase): - "match": {"macaddress": "06:17:04:d7:26:09"}, - "set-name": "eth9", - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } -@@ -513,7 +513,7 @@ class TestEc2(test_helpers.ResponsesTestCase): - "2600:1f16:292:100:f153:12a3:c37c:11f9/128", - ], - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } -@@ -593,7 +593,7 @@ class TestEc2(test_helpers.ResponsesTestCase): - "match": {"macaddress": mac1}, - "set-name": "eth9", - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } -@@ -1000,7 +1000,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase): - "match": {"macaddress": self.mac1}, - "set-name": "eth9", - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } -@@ -1077,7 +1077,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase): - "match": {"macaddress": self.mac1}, - "set-name": "eth9", - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } -@@ -1107,8 +1107,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase): - "set-name": "eth9", - "dhcp4": True, - "dhcp4-overrides": {"route-metric": 100}, -- "dhcp6": True, -- "dhcp6-overrides": {"route-metric": 100}, -+ "dhcp6": False, - }, - "eth10": { - "match": {"macaddress": mac2}, -@@ -1139,7 +1138,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase): - "match": {"macaddress": self.mac1}, - "set-name": "eth9", - "dhcp4": True, -- "dhcp6": True, -+ "dhcp6": False, - } - }, - } --- -2.39.2 - diff --git a/cloud-init.spec b/cloud-init.spec index 998cf5e..66757b8 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -5,18 +5,19 @@ %endif Name: cloud-init -Version: 23.4.1 -Release: %autorelease +Version: 24.1.4 +Release: 1%{?dist} Summary: Cloud instance init scripts License: Apache-2.0 OR GPL-3.0-only URL: https://github.com/canonical/cloud-init -Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Source0: %{url}/archive/%{version}/%{version}.tar.gz Source1: cloud-init-tmpfiles.conf - -# Enabling dhcp6 on EC2 causes a broken IPv6 configuration. -# See RHBZ 2092459. -Patch0: Do-not-enable-dhcp6-on-EC2.patch +Patch1: 0001-Add-initial-redhat-changes.patch +Patch2: 0002-fix-rhel-Fix-network-ordering-in-sysconfig.patch +Patch3: 0003-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch +Patch4: 0004-Setting-autoconnect-priority-setting-for-network-scr.patch +Patch5: 0005-feat-Use-NetworkManager-renderer-by-default-in-RHEL-.patch BuildArch: noarch @@ -129,7 +130,39 @@ python3 -m pytest tests/unittests %post %systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service - +if [ $1 -eq 1 ] ; then + # Initial installation + # Enabled by default per "runs once then goes away" exception + /bin/systemctl enable cloud-config.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-final.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init.target >/dev/null 2>&1 || : +elif [ $1 -eq 2 ]; then + # Upgrade + # RHBZ 2210012 - check for null ssh_genkeytypes value in cloud.cfg that + # breaks ssh connectivity after upgrade to a newer version of cloud-init. + if [ -f %{_sysconfdir}/cloud/cloud.cfg.rpmnew ] && grep -q '^\s*ssh_genkeytypes:\s*~\s*$' %{_sysconfdir}/cloud/cloud.cfg ; then + echo "***********************************************" + echo "*** WARNING!!!! ***" + echo "" + echo "ssh_genkeytypes set to null in /etc/cloud/cloud.cfg!" + echo "SSH access might be broken after reboot. Please check the following KCS" + echo "for more detailed information:" + echo "" + echo "https://access.redhat.com/solutions/6988034" + echo "" + echo "Please reconcile the differences between /etc/cloud/cloud.cfg and " + echo "/etc/cloud/cloud.cfg.rpmnew and update ssh_genkeytypes configuration in " + echo "/etc/cloud/cloud.cfg to a list of keytype values, something like:" + echo "ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']" + echo "" + echo "************************************************" + fi + # If the upgrade is from a version older than 0.7.9-8, + # there will be stale systemd config + /bin/systemctl is-enabled cloud-config.service >/dev/null 2>&1 && + /bin/systemctl reenable cloud-config.service >/dev/null 2>&1 || : %preun %systemd_preun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service @@ -137,12 +170,25 @@ python3 -m pytest tests/unittests %postun %systemd_postun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service +if [ $1 -eq 0 ] ; then + # warn during package removal not upgrade + if [ -f /etc/ssh/sshd_config.d/50-cloud-init.conf ] ; then + echo "/etc/ssh/sshd_config.d/50-cloud-init.conf not removed" + fi + + if [ -f /etc/NetworkManager/conf.d/99-cloud-init.conf ] ; then + echo "/etc/NetworkManager/conf.d/99-cloud-init.conf not removed" + fi + + if [ -f /etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf ] ; then + echo "/etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf not removed" + fi +fi %files %license LICENSE LICENSE-Apache2.0 LICENSE-GPLv3 %doc ChangeLog %doc doc/* -%doc %{_sysconfdir}/cloud/clean.d/README %{_mandir}/man1/* %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg %dir %{_sysconfdir}/cloud/cloud.cfg.d @@ -174,4 +220,103 @@ python3 -m pytest tests/unittests %changelog -%autochangelog +* Mon Apr 22 2024 Miroslav Rezanina - 24.1.4-1 +- Rebase to 24.1.4 [RHEL-33439] +- Resolves: RHEL-33439 + (Update cloud-init on 24.1.4 for RHEL 10) + +* Thu Feb 01 2024 Major Hayden - 23.4.1-5 +- Switch back to dhcp-client temporarily + +* Tue Jan 30 2024 Major Hayden - 23.4.1-4 +- Replace dhcp-client with udhcpc + +* Wed Jan 24 2024 Fedora Release Engineering - 23.4.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 23.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Dec 22 2023 František Zatloukal - 23.4.1-1 +- Update to 23.4.1 + +* Fri Aug 11 2023 Miroslav Suchý - 23.2.1-2 +- correct SPDX formula + +* Thu Jul 20 2023 Major Hayden - 23.2.1-1 +- Update to 23.2.1 + +* Thu Jul 20 2023 Major Hayden - 23.2-4 +- Add packit config + +* Wed Jul 19 2023 Fedora Release Engineering - 23.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jun 29 2023 Python Maint - 23.2-2 +- Rebuilt for Python 3.12 + +* Thu Jun 22 2023 Major Hayden - 23.2-1 +- Update to 23.2 rhbz#2196523 + +* Wed May 17 2023 Major Hayden - 23.1.2-10 +- Migrate to pyproject-rpm-macros for build requirements + +* Tue May 16 2023 Major Hayden - 23.1.2-9 +- ec2: Do not enable DHCPv6 on EC2 + +* Tue May 16 2023 Yaakov Selkowitz - 23.1.2-8 +- Disable tests by default in RHEL builds + +* Thu May 11 2023 Major Hayden - 23.1.2-7 +- Update changelog for rhbz#2068529 + +* Thu May 11 2023 Major Hayden - 23.1.2-6 +- Allow > 3 nameservers to be used rhbz#2068529 + +* Sun Apr 30 2023 Neal Gompa - 23.1.2-5 +- Use the correct SourceURL format for the upstream sources +- Switch to SPDX identifiers for the license field + +* Fri Apr 28 2023 Major Hayden - 23.1.2-4 +- Switch to GitHub for upstream source + +* Fri Apr 28 2023 Major Hayden - 23.1.2-3 +- Revert "Use forge source" + +* Fri Apr 28 2023 Major Hayden - 23.1.2-2 +- Use forge source + +* Thu Apr 27 2023 Major Hayden - 23.1.2-1 +- Update to 23.1.2 + +* Thu Mar 23 2023 František Zatloukal - 23.1.1-1 +- Rebase to 23.1.1 + +* Thu Jan 19 2023 Fedora Release Engineering - 22.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Jul 20 2022 Fedora Release Engineering - 22.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jun 16 2022 Python Maint - 22.2-3 +- Rebuilt for Python 3.11 + +* Thu Jun 16 2022 Neal Gompa - 22.2-2 +- Add dhcp-client dependency for Azure and OCI network bootstrap + +* Thu May 19 2022 Neal Gompa - 22.2-1 +- Rebase to 22.2 + +* Thu Mar 10 2022 Dusty Mabe - 22.1-3 +- Don't require NetworkManager-config-server + +* Tue Feb 22 2022 Neal Gompa - 22.1-2 +- Drop extra tests search in prep + +* Tue Feb 22 2022 Neal Gompa - 22.1-1 +- Rebase to 22.1 +- Backport cloud-init PR to add proper NetworkManager support +- Add patch to prefer NetworkManager + +* Wed Feb 16 2022 Charalampos Stratakis - 21.3-6 +- Remove redundant dependencies on nose and mock diff --git a/sources b/sources index ed2de6a..d19e14e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cloud-init-23.4.1.tar.gz) = 4ac62a4ab49726de692e3671365da5acdfc018e2c9fb93d7e0acbdae5752ef12970497957358c59b58362ec741ef806173a7affc456d30ff8adebfca2c29251a +SHA512 (24.1.4.tar.gz) = 374a5a10895f4f850457f3015687fb2c5b605841658b819244139fadf0075cd818cfdec5aeb8d0ca9ddbfa40de3b5070d2c4ffd0f6bcc306349b0db70edee2c7