From f9a1e23a9226a92cdc62437f810b705c5d744174 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 5 Apr 2024 09:50:00 +0000 Subject: [PATCH 1/4] app-emulation/wa-linux-agent: Update Flatcar patch When CoreosCommonUtil was factored out, we missed updating the class name in a call to super(). This results in an error when executing `/usr/sbin/waagent -force -deprovision+user`. Fix the class name. Create a compatibility symlink at the old config file location (/usr/share/oem/waagent.conf) to handle the case of enabling auto-updates on the agent. The upstream version of the agent does not have our downstream patch so doesn't know about the updated config file location. We should upstream our changes. Signed-off-by: Jeremi Piotrowski --- .../wa-linux-agent/files/0001-flatcar-changes.patch | 5 +++-- ...nt-2.9.1.1-r1.ebuild => wa-linux-agent-2.9.1.1-r2.ebuild} | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/{wa-linux-agent-2.9.1.1-r1.ebuild => wa-linux-agent-2.9.1.1-r2.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch index 9eeb4d1246..04cccd5034 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch @@ -115,7 +115,7 @@ index 00000000..66eae16e + # User 'core' is not a sysuser. + if username == 'core': + return False -+ return super(CoreOSUtil, self).is_sys_user(username) ++ return super(CoreosCommonUtil, self).is_sys_user(username) + + def is_dhcp_enabled(self): + return True @@ -404,7 +404,7 @@ new file mode 100644 index 00000000..d0d6f7c8 --- /dev/null +++ b/init/flatcar/waagent.service -@@ -0,0 +1,30 @@ +@@ -0,0 +1,31 @@ +[Unit] +Description=Microsoft Azure Linux Agent +Wants=network-online.target sshd.service sshd-keygen.service @@ -419,6 +419,7 @@ index 00000000..d0d6f7c8 +# /usr/share/flatcar/etc. +# +ExecStartPre=/bin/bash -c 'if [[ ! -e /etc/waagent.conf ]]; then ln -sf ../usr/share/waagent/waagent.conf /etc/waagent.conf; fi' ++ExecStartPre=/bin/bash -c 'if [[ ! -e /oem/waagent.conf ]]; then ln -sf /etc/waagent.conf /oem/waagent.conf; fi' + +# This could be done also with: +# diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r2.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r1.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r2.ebuild From 9556c7f94b932ded3658738d616c2f666a364ba8 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Thu, 18 Apr 2024 15:28:50 +0000 Subject: [PATCH 2/4] app-emulation/wa-linux-agent: Disable interface restarting Flatcar prepares /etc/hostname from the initrd through afterburn. After switching root, systemd-networkd fetches a dhcp lease with the correct hostname already. This publishes the hostname to the vnet DNS server as well. When WALinuxAgent starts, it tries to do the same steps: configure the hostname, bounce the link to force dhcp lease renewal. This has caused issues in the past with multi-nic configurations but also with networked services that are trying to use the network (etcd/flanneld). The link bouncing by WALinuxAgent is not necessary because of Flatcars boot design, so return without bouncing the link. Tested that DNS from other VMs in the same vnet works. Signed-off-by: Jeremi Piotrowski --- .../wa-linux-agent/files/0001-flatcar-changes.patch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch index 04cccd5034..694ed8b937 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch @@ -172,7 +172,7 @@ new file mode 100644 index 00000000..e31b2923 --- /dev/null +++ b/azurelinuxagent/common/osutil/flatcar.py -@@ -0,0 +1,78 @@ +@@ -0,0 +1,80 @@ +# +# Copyright 2023 Microsoft Corporation +# @@ -240,6 +240,8 @@ index 00000000..e31b2923 + Restart an interface by bouncing the link. systemd-networkd observes + this event, and forces a renew of DHCP. + """ ++ logger.info("not restarting interface {}".format(ifname)) ++ return + retry_limit = retries + 1 + for attempt in range(1, retry_limit): + return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname)) From c7363daab5bb4229de041ec70fd96984c7ab78e3 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Thu, 18 Apr 2024 15:43:57 +0000 Subject: [PATCH 3/4] app-admin/azure-nvme-utils: Add to coreos This is a new package that is being developed to handle providing symlinks for nvme disks (os,data,temporary) on newer Azure instances. It needs to be part of the OS, and not oem-azure, because it carries udev rules. Signed-off-by: Jeremi Piotrowski --- .../app-admin/azure-nvme-utils/Manifest | 1 + .../azure-nvme-utils-0.0.0-r1.ebuild | 28 +++++++++++++++++++ ...1-r311.ebuild => coreos-0.0.1-r312.ebuild} | 0 .../coreos-base/coreos/coreos-0.0.1.ebuild | 1 + 4 files changed, 30 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/Manifest create mode 100644 sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/azure-nvme-utils-0.0.0-r1.ebuild rename sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/{coreos-0.0.1-r311.ebuild => coreos-0.0.1-r312.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/Manifest b/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/Manifest new file mode 100644 index 0000000000..73a85d9db0 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/Manifest @@ -0,0 +1 @@ +DIST azure-nvme-utils-0.0.0-1a1167d1d7780068d0af5afc3ad18a2601e951fe.zip 15473 BLAKE2B c57bc01b53bb52b0d958e6eac0d7df5b08023024dbf197f236229174fed2e8d295a4d66f123a2914f8ff11a70df83db7e7cafa56242a80c925bff53032b38b4e SHA512 48739a5da9e7fdba9c26df803354925ff508f4bb872f9dfde7461b6fec70648e1daaa7c1468960467d19243c6b3c871dd4bf060fa85e22f5576083d2a19385ed diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/azure-nvme-utils-0.0.0-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/azure-nvme-utils-0.0.0-r1.ebuild new file mode 100644 index 0000000000..4760df90c8 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/azure-nvme-utils/azure-nvme-utils-0.0.0-r1.ebuild @@ -0,0 +1,28 @@ +# Copyright 2024 Flatcar Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +GIT_COMMIT="1a1167d1d7780068d0af5afc3ad18a2601e951fe" +DESCRIPTION="Azure NVMe utilities" +HOMEPAGE="https://github.com/Azure/azure-nvme-utils" +SRC_URI="https://github.com/Azure/azure-nvme-utils/archive/${GIT_COMMIT}.zip -> ${P}-${GIT_COMMIT}.zip" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="amd64 arm64" + +DEPEND="" +RDEPEND="${DEPEND}" +BDEPEND="" + +S="${WORKDIR}/${PN}-${GIT_COMMIT}" + +src_configure() { + local mycmakeargs=( + -DVERSION="${PVR}-${GIT_COMMIT}" + ) + cmake_src_configure +} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r311.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r312.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r311.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r312.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild index 9a7bb239af..570d621413 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild @@ -81,6 +81,7 @@ RDEPEND="${RDEPEND} # sys-devel/gettext: it embeds 'envsubst' binary which is useful for simple file templating. RDEPEND="${RDEPEND} + app-admin/azure-nvme-utils app-admin/etcd-wrapper app-admin/flannel-wrapper app-admin/locksmith From 7a1a00470052e6de10706768cca1de4f39e53187 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Wed, 24 Apr 2024 15:59:51 +0000 Subject: [PATCH 4/4] changelog: Add entry for azure-nvme-utils --- changelog/changes/2024-04-24-azure-nvme-utils.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/changes/2024-04-24-azure-nvme-utils.md diff --git a/changelog/changes/2024-04-24-azure-nvme-utils.md b/changelog/changes/2024-04-24-azure-nvme-utils.md new file mode 100644 index 0000000000..58c46343ad --- /dev/null +++ b/changelog/changes/2024-04-24-azure-nvme-utils.md @@ -0,0 +1 @@ +- Added azure-nvme-utils to the image, which is used by udev to create symlinks for NVMe disks on Azure v6 instances under /dev/disk/azure/. ([scripts#1950](https://github.com/flatcar/scripts/pull/1950))