package/linux-tools: add microsoft HyperV integration services (branch yem/hyperv)
cover package/linux-tools: add microsoft HyperV integration services (branch yem/hyperv)
Hello All!
This small series introduces the Microsoft HyperV (HV) integration services daemons, as options to the linux-tools package.
The guts of the changes were done by Pascal, and Pascal deserve the most kudos for their initial work. ;-)
However, I (Yann) have done quite some deep changes.
Where Pascal provided three init scripts, one for each daemon, all identical save for the name of the daemon itself, I did gather the three into a single one, which is responsible for starting all three daemons; see the details in patch 2. On IRC, Pascal said they were not totally very happy with this change. We need to come to a conclusion on this (initial patch: https://patchwork.ozlabs.org/patch/1217243/).
Additionally, the initial work used three independent sub-packages, one for each program. Again, they were mostly identical, save for the name of the program, and a very trivial deviation for one of them. There again, I aggregated the three into a single sub-package, and removed the sub-menu in favour of three sub-options (like we already had for perf).
Finally, after discussions on IRC, Pascal and I concluded that we did not need to install the helper scripts for one of the program, because they do not make sense for Pascal's use-case (they would not be able to test them), and the ones installed by the kernel are just templates that would not even work in Buildroot's case anyway.
What I did not change, however, was the renaming of the programs. Pascal's initial work did a rename of the programs upon installation, and names them as RedHat/Ubuntu do. However, I checked that Ubuntu does in fact not rename the tools, but Pascal has a good case that the names are better, and at least matches the name of the runtime helpers location directory. I kept the renaming, but still think this is up for debate...
Now, I'd like to thank Pascal for their initial work, and for their precious help and comments on IRC. Thanks! :-)
Regards,
Yann E. MORIN.
The following changes since commit 198bdaadd03f75fe959c21089c354d36c90069bc
.gitlab-ci.yml: add missing python-avro test (2020-01-02 21:55:22 +0100)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 07a3e4666570e40666cc8dd518ffce582bbf7f38
package/linux-tools: add hyperv integration services (2020-01-03 20:50:02 +0100)
----------------------------------------------------------------
Pascal de Bruijn (2):
package/linux-tools: add support for installing init system files package/linux-tools: add hyperv integration services
DEVELOPERS | 3 ++ package/linux-tools/Config.in | 37 ++++++++++++++++++ package/linux-tools/S10hyperv | 66 ++++++++++++++++++++++++++++++++ package/linux-tools/hypervfcopyd.service | 11 ++++++ package/linux-tools/hypervkvpd.service | 11 ++++++ package/linux-tools/hypervvssd.service | 11 ++++++ package/linux-tools/linux-tool-hv.mk.in | 61 +++++++++++++++++++++++++++++ package/linux-tools/linux-tools.mk | 22 +++++++++++ 8 files changed, 222 insertions(+) create mode 100644 package/linux-tools/S10hyperv create mode 100644 package/linux-tools/hypervfcopyd.service create mode 100644 package/linux-tools/hypervkvpd.service create mode 100644 package/linux-tools/hypervvssd.service create mode 100644 package/linux-tools/linux-tool-hv.mk.in
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 package/linux-tools: add support for installing init system files
From: Pascal de Bruijn <[email protected]>
Some linux tools (e.g. the Microsoft HyperV convenience utilities) will install programs tostart at boot time, so they need to be able to install init files (systemd units, sysv init script, or openrc units).
Unlike the other commands, we are redefining the real _INSTALL_INIT_* macros, rather than use hooks, to let the infra call those at the right moment.
We must be careful about the openrc support, though: if two tools are enabled, one which provides sysv scripts but no openrc config, and the other which provides openrc config, and we are using openrc as init system, then we want to use the sysv scripts from the former as well as the openrc config of the latter. Thus we need to duplicate a bit the openrc logic here.
[yann.morin.1998 at free.fr:
- define macros, not hooks
- introduce support for openrc too
- expand commit log
]
--- package/linux-tools/linux-tools.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
package/linux-tools/linux-tools.mk +22 -0
@@ -42,4 +42,26 @@ LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\ $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\ $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS)) +define LINUX_TOOLS_INSTALL_INIT_SYSTEMD + $(foreach tool,$(LINUX_TOOLS),\ + $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\ + $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSTEMD)) + ) +endef + +define LINUX_TOOLS_INSTALL_INIT_SYSV + $(foreach tool,$(LINUX_TOOLS),\ + $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\ + $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV)) + ) +endef + +define LINUX_TOOLS_INSTALL_INIT_OPENRC + $(foreach tool,$(LINUX_TOOLS),\ + $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\ + $(or $($(call UPPERCASE,$(tool))_INSTALL_INIT_OPENRC),\ + $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV))) + ) +endef + $(eval $(generic-package))
Signature · 1 line
2.20.1
Thomas Petazzoni
AppliedPATCH 1/2 package/linux-tools: add support for installing init system files
Quoted 23 lines · On Fri, 3 Jan 2020 20:57:04 +0100 "Yann E. MORIN" <[email protected]>…
From: Pascal de Bruijn <[email protected]>
Some linux tools (e.g. the Microsoft HyperV convenience utilities) will install programs tostart at boot time, so they need to be able to install init files (systemd units, sysv init script, or openrc units).
Unlike the other commands, we are redefining the real _INSTALL_INIT_* macros, rather than use hooks, to let the infra call those at the right moment.
We must be careful about the openrc support, though: if two tools are enabled, one which provides sysv scripts but no openrc config, and the other which provides openrc config, and we are using openrc as init system, then we want to use the sysv scripts from the former as well as the openrc config of the latter. Thus we need to duplicate a bit the openrc logic here.
Signed-off-by Pascal de Bruijn <[email protected]>[yann.morin.1998 at free.fr:
- define macros, not hooks
- introduce support for openrc too
- expand commit log
]
Quoted 4 lines
Signed-off-by Yann E. MORIN <[email protected]>--- package/linux-tools/linux-tools.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/2 package/linux-tools: add hyperv integration services
In reply to Yann E. MORINFrom: Pascal de Bruijn <[email protected]>
The hyperv integration services offer convenience features for guest operating systems running on the microsoft hyperv virtualization platform. They roughly are for HyperV what openvmtools are for VMWare.
The installed binary names are derived from what seems common in large distros like RedHat:
linux kernel source name -> installed binary name
hv_vss_daemon -> hypervvssd
hv_kvp_daemon -> hypervkvpd
hv_fcopy_daemon -> hypervfcopydEach tool was introduced at different points in the kernel history, so we need to check each of them.
We provide a single init script that is responsible for starting all enabled programs. The global status will be the status of the last program to fail to start, or empty (i.e. success) if they all started successfuly.
However, we provide one systemd unit per program, because it is not easy to use a single unit to start (and monitor) more than one executable. Additionally, we do not provide a template that is filled at tinstall time either, because it does not gain much (three simple units vs. a template and some replacement code in the .mk).
Finally, the key-value daemon uses a few helper scripts to get/set the network config. All are optional (their presence is checked before running them), but one, hv_set_ifconfig. However, it is not strictly speaking required either, so we just symlink it to /bin/true to avoid any warning at runtime. Providing actual helpers is left to the end user, to adapt to their own environment.
[yann.morin.1998 at free.fr:
- aggregate all three tools in a single sub-package
- introduce the main HV option, use a sub-option for each tool
- aggregate the three init scripts into one
- don't install the helpers; symlink the mandatory one
- don't create symlinks for systemd units (systemctl preset-all does it for us now)
- expand commit log
]
--- DEVELOPERS | 3 ++ package/linux-tools/Config.in | 37 +++++++++++++ package/linux-tools/S10hyperv | 66 ++++++++++++++++++++++++ package/linux-tools/hypervfcopyd.service | 11 ++++ package/linux-tools/hypervkvpd.service | 11 ++++ package/linux-tools/hypervvssd.service | 11 ++++ package/linux-tools/linux-tool-hv.mk.in | 61 ++++++++++++++++++++++ 7 files changed, 200 insertions(+) create mode 100644 package/linux-tools/S10hyperv create mode 100644 package/linux-tools/hypervfcopyd.service create mode 100644 package/linux-tools/hypervkvpd.service create mode 100644 package/linux-tools/hypervvssd.service create mode 100644 package/linux-tools/linux-tool-hv.mk.in
DEVELOPERS +3 -0
@@ -1861,6 +1861,9 @@ F: package/scrypt/ N: Pascal de Bruijn <[email protected]> F: package/libargon2/ +F: package/linux-tools/S10hyperv +F: package/linux-tools/hyperv*.service +F: package/linux-tools/linux-tool-hv.mk.in N: Pascal Huerst <[email protected]> F: package/google-breakpad/
package/linux-tools/Config.in +37 -0
@@ -116,4 +116,41 @@ config BR2_PACKAGE_LINUX_TOOLS_TMON tmon is a terminal-based tool (using curses) that allows the user to access thermal information about the system. +config BR2_PACKAGE_LINUX_TOOLS_HV + bool "hv" + depends on BR2_i386 || BR2_x86_64 + select BR2_PACKAGE_LINUX_TOOLS + select BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON if !BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE + help + Microsoft HyperV integration services + + Relevant kernel configuration options: HYPERV, HYPERV_UTILS + +if BR2_PACKAGE_LINUX_TOOLS_HV + +config BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE + bool + +config BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON + bool "hypervkvpd (hv_kvp_daemon)" + help + HyperV uses hypervkvpd (Key/Value Pair daemon) to retrieve + status information from your virtualized guest OS + +config BR2_PACKAGE_LINUX_TOOLS_HV_FCOPY_DAEMON + bool "hypervfcopyd (hv_fcopy_daemon)" + select BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE + help + HyperV uses hypervfcopyd (File Copy daemon) to easily transfer + files to and from your virtualized guest OS + +config BR2_PACKAGE_LINUX_TOOLS_HV_VSS_DAEMON + bool "hypervvssd (hv_vss_daemon)" + select BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE + help + HyperV uses hypervvssd (Volume Snapshot Service daemon) to + freeze your filesystems during snapshots and backups + +endif # BR2_PACKAGE_LINUX_TOOLS_HV + endmenu
package/linux-tools/S10hyperv new file +66 -0
66 lines not on this page · raw message
package/linux-tools/hypervfcopyd.service new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=HyperV FCopy daemon +After=syslog.target +ConditionVirtualization=microsoft + +[Service] +Type=simple +ExecStart=/usr/sbin/hypervfcopyd -n + +[Install] +WantedBy=multi-user.target
package/linux-tools/hypervkvpd.service new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=HyperV KVP daemon +After=syslog.target +ConditionVirtualization=microsoft + +[Service] +Type=simple +ExecStart=/usr/sbin/hypervkvpd -n + +[Install] +WantedBy=multi-user.target
package/linux-tools/hypervvssd.service new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=HyperV VSS daemon +After=syslog.target +ConditionVirtualization=microsoft + +[Service] +Type=simple +ExecStart=/usr/sbin/hypervvssd -n + +[Install] +WantedBy=multi-user.target
package/linux-tools/linux-tool-hv.mk.in new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.20.1
Thomas Petazzoni
AppliedPATCH 2/2 package/linux-tools: add hyperv integration services
Quoted 45 lines · On Fri, 3 Jan 2020 20:57:05 +0100 "Yann E. MORIN" <[email protected]>…
From: Pascal de Bruijn <[email protected]>
The hyperv integration services offer convenience features for guest operating systems running on the microsoft hyperv virtualization platform. They roughly are for HyperV what openvmtools are for VMWare.
The installed binary names are derived from what seems common in large distros like RedHat:
linux kernel source name -> installed binary name
hv_vss_daemon -> hypervvssd hv_kvp_daemon -> hypervkvpd hv_fcopy_daemon -> hypervfcopydEach tool was introduced at different points in the kernel history, so we need to check each of them.
We provide a single init script that is responsible for starting all enabled programs. The global status will be the status of the last program to fail to start, or empty (i.e. success) if they all started successfuly.
However, we provide one systemd unit per program, because it is not easy to use a single unit to start (and monitor) more than one executable. Additionally, we do not provide a template that is filled at tinstall time either, because it does not gain much (three simple units vs. a template and some replacement code in the .mk).
Finally, the key-value daemon uses a few helper scripts to get/set the network config. All are optional (their presence is checked before running them), but one,
hv_set_ifconfig. However, it is not strictly speaking required either, so we just symlink it to/bin/trueto avoid any warning at runtime. Providing actual helpers is left to the end user, to adapt to their own environment.Signed-off-by Pascal de Bruijn <[email protected]>[yann.morin.1998 at free.fr:
- aggregate all three tools in a single sub-package
- introduce the main HV option, use a sub-option for each tool
- aggregate the three init scripts into one
- don't install the helpers; symlink the mandatory one
- don't create symlinks for systemd units (systemctl preset-all does it for us now)
- expand commit log
]
Quoted 1 line
Signed-off-by Yann E. MORIN <[email protected]>
Thanks applied to master, with just one very minor change.
package/linux-tools/Config.in config BR2_PACKAGE_LINUX_TOOLS_TMON · line 127
Quoted 9 lines
package/linux-tools/Config.in +9
-0+config BR2_PACKAGE_LINUX_TOOLS_HV + bool "hv" + depends on BR2_i386 || BR2_x86_64 + select BR2_PACKAGE_LINUX_TOOLS + select BR2_PACKAGE_LINUX_TOOLS_HV_KVP_DAEMON if !BR2_PACKAGE_LINUX_TOOLS_HV_HAS_ONE + help + Microsoft HyperV integration services + + Relevant kernel configuration options: HYPERV, HYPERV_UTILS
Changed to CONFIG_HYPERV and CONFIG_HYPERV_UTILS, as we generally point to kernel options including their CONFIG_ prefix.
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com