From 32c40fa1cbce9e7a055a891628cc16dbfbb1fa54 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Thu, 12 Sep 2024 16:37:25 +0200 Subject: [PATCH] oem-azure: add hyperv daemons (#2309) * oem-azure: add hyperv daemons This change adds hyperv daemons hv_fcopy, hv_kvp, and hv_vss to the Azure and HyperV OEM sysexts. hv_kvp specifically is needed to submit OS version information to the Azure hypervisor. The daemons, tough userspace programs, are built from the kernel sources as they are included in the Linux kernel. As the ebuild is (somewhat) kernel specific, it should be updated when the kernel is updated. Respective additions have been made to the kernel update GitHub actions automation. Signed-off-by: Thilo Fromm Co-authored-by: Mathieu Tortuyaux --- .github/workflows/kernel-apply-patch.sh | 10 +++++- .../changes/2024-09-12-azure-hv-daemons.md | 1 + .../hv-daemons/files/hv_fcopy_daemon.service | 9 ++++++ .../hv-daemons/files/hv_kvp_daemon.service | 9 ++++++ .../hv-daemons/files/hv_vss_daemon.service | 9 ++++++ .../hv-daemons/hv-daemons-6.6.50.ebuild | 1 + .../hv-daemons/hv-daemons-9999.ebuild | 32 +++++++++++++++++++ .../app-emulation/hv-daemons/metadata.xml | 4 +++ ...-r2.ebuild => oem-azure-2.9.1.1-r3.ebuild} | 1 + .../oem-hyperv/oem-hyperv-0.1.0-r1.ebuild | 4 +++ 10 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 changelog/changes/2024-09-12-azure-hv-daemons.md create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_kvp_daemon.service create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_vss_daemon.service create mode 120000 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.6.50.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml rename sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/{oem-azure-2.9.1.1-r2.ebuild => oem-azure-2.9.1.1-r3.ebuild} (96%) diff --git a/.github/workflows/kernel-apply-patch.sh b/.github/workflows/kernel-apply-patch.sh index 560e8e7e98..14c2216624 100755 --- a/.github/workflows/kernel-apply-patch.sh +++ b/.github/workflows/kernel-apply-patch.sh @@ -11,6 +11,7 @@ if ! check_remote_branch "linux-${VERSION_NEW}-${TARGET_BRANCH}"; then exit 0 fi +# Dive into ebuild repo section of SDK pushd "${SDK_OUTER_OVERLAY}" # trim the 3rd part in the input semver, e.g. from 5.4.1 to 5.4 @@ -31,6 +32,12 @@ for pkg in sources modules kernel; do popd done +# Update hyperv daemons ebuild soft-link to reflect new kernel version +find -D exec app-emulation/hv-daemons/ -type l -exec rm '{}' \; +ln -s app-emulation/hv-daemons/hv-daemons-9999.ebuild \ + app-emulation/hv-daemons/hv-daemons-${VERSION_NEW}.ebuild + +# Leave ebuild repo section of SDK popd function get_lwn_link() { @@ -72,7 +79,8 @@ generate_update_changelog 'Linux' "${VERSION_NEW}" "${URL}" 'linux' "${OLD_VERSI commit_changes sys-kernel/coreos-sources "${VERSION_OLD}" "${VERSION_NEW}" \ sys-kernel/coreos-modules \ - sys-kernel/coreos-kernel + sys-kernel/coreos-kernel \ + app-emulation/hv-daemons cleanup_repo diff --git a/changelog/changes/2024-09-12-azure-hv-daemons.md b/changelog/changes/2024-09-12-azure-hv-daemons.md new file mode 100644 index 0000000000..50595b42b1 --- /dev/null +++ b/changelog/changes/2024-09-12-azure-hv-daemons.md @@ -0,0 +1 @@ +- Azure, HyperV: Added daemons `kvp`, `vss`, and `fcopy` for better HyperV hypervisor integration with Flatcar guests ([scripts#2309](https://github.com/flatcar/scripts/pull/2309)). diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service new file mode 100644 index 0000000000..c4d63d39ed --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service @@ -0,0 +1,9 @@ +[Unit] +Description=Hyper-V FCOPY daemon +ConditionPathExists=/dev/vmbus/hv_fcopy + +[Service] +ExecStart=/usr/bin/hv_fcopy_daemon --no-daemon + +[Install] +WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_kvp_daemon.service b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_kvp_daemon.service new file mode 100644 index 0000000000..40964cc02d --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_kvp_daemon.service @@ -0,0 +1,9 @@ +[Unit] +Description=Hyper-V KVP daemon +ConditionPathExists=/dev/vmbus/hv_kvp + +[Service] +ExecStart=/usr/bin/hv_kvp_daemon --no-daemon + +[Install] +WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_vss_daemon.service b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_vss_daemon.service new file mode 100644 index 0000000000..ffccc5cd46 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_vss_daemon.service @@ -0,0 +1,9 @@ +[Unit] +Description=Hyper-V VSS daemon +ConditionPathExists=/dev/vmbus/hv_vss + +[Service] +ExecStart=/usr/bin/hv_vss_daemon --no-daemon + +[Install] +WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.6.50.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.6.50.ebuild new file mode 120000 index 0000000000..95dcc24d68 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.6.50.ebuild @@ -0,0 +1 @@ +hv-daemons-9999.ebuild \ No newline at end of file diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild new file mode 100644 index 0000000000..9b6b44dba9 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild @@ -0,0 +1,32 @@ +# Copyright 2044-2016 The Flatcar Maintainers +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit coreos-kernel savedconfig systemd + +DESCRIPTION="HyperV guest support daemons." +KEYWORDS="amd64 arm64" + +if [[ "${PV}" == 9999 ]]; then + KEYWORDS="~amd64 ~arm64" +fi + +src_compile() { + # Build hv_vss_daemon, hv_kvp_daemon, hv_fcopy_daemon + kmake tools/hv +} + +src_install() { + dobin "${S}/build/tools/hv/hv_fcopy_daemon" + dobin "${S}/build/tools/hv/hv_kvp_daemon" + dobin "${S}/build/tools/hv/hv_vss_daemon" + + systemd_dounit "${FILESDIR}/hv_fcopy_daemon.service" + systemd_dounit "${FILESDIR}/hv_kvp_daemon.service" + systemd_dounit "${FILESDIR}/hv_vss_daemon.service" + + systemd_enable_service "multi-user.target" "hv_fcopy_daemon.service" + systemd_enable_service "multi-user.target" "hv_kvp_daemon.service" + systemd_enable_service "multi-user.target" "hv_vss_daemon.service" +} diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml new file mode 100644 index 0000000000..097975e3ad --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml @@ -0,0 +1,4 @@ + + + + diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r2.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r3.ebuild similarity index 96% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r2.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r3.ebuild index de93bdad65..5e04e16569 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r3.ebuild @@ -17,6 +17,7 @@ IUSE="" RDEPEND=" ~app-emulation/wa-linux-agent-${PV} net-misc/chrony + app-emulation/hv-daemons " # for coreos-base/common-oem-files diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-hyperv/oem-hyperv-0.1.0-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-hyperv/oem-hyperv-0.1.0-r1.ebuild index b7b9e3d1a8..079bcd7984 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-hyperv/oem-hyperv-0.1.0-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-hyperv/oem-hyperv-0.1.0-r1.ebuild @@ -15,6 +15,10 @@ IUSE="" # no source directory S="${WORKDIR}" +RDEPEND=" + app-emulation/hv-daemons +" + src_prepare() { default sed -e "s\\@@OEM_VERSION_ID@@\\${PVR}\\g" \