Skip to contentSkip to conversation

package/linux-tools: add hv_vss_daemon

PATCH New Pascal de Bruijn 2 participants 2 messages Dec 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/linux-tools: add hv_vss_daemon

hyperv integration services for snapshotting a running vm

hv_vss_daemon facilitates a FIFREEZE initiated from the hypervisor

---
 package/linux-tools/Config.in                      |  5 ++++
 package/linux-tools/linux-tool-hv_vss_daemon.mk.in | 34 ++++++++++++++++++++++
 .../linux-tools/linux-tool-hv_vss_daemon.service   | 11 +++++++
 3 files changed, 50 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-hv_vss_daemon.mk.in
 create mode 100644 package/linux-tools/linux-tool-hv_vss_daemon.service
package/linux-tools/Config.in +5 -0
index ab8cc38..4b750e2 100644
@@ -116,4 +116,9 @@ 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_VSS_DAEMON
+	bool "hv_vss_daemon"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  HyperV VSS snapshot daemon
 endmenu
package/linux-tools/linux-tool-hv_vss_daemon.mk.in new file +34 -0
new file mode 100644
index 0000000..2de13a7
@@ -0,0 +1,34 @@
+################################################################################
+#
+# hv_vss_daemon
+#
+################################################################################
+
+LINUX_TOOLS += hv_vss_daemon
+
+HV_VSS_DAEMON_MAKE_OPTS = CROSS=$(TARGET_CROSS)
+
+define HV_VSS_DAEMON_BUILD_CMDS
+	$(Q)if test ! -f $(LINUX_DIR)/tools/hv/hv_vss_daemon.c ; then \
+		echo "Your kernel version is too old and does not have the HyperV VSS daemon tool." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/hv \
+		$(HV_VSS_DAEMON_MAKE_OPTS) \
+		hv_vss_daemon
+endef
+
+define HV_VSS_DAEMON_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/hv/hv_vss_daemon \
+		$(TARGET_DIR)/usr/sbin/hv_vss_daemon
+endef
+
+define HV_VSS_DAEMON_INSTALL_INIT_SYSTEMD
+        mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+        $(INSTALL) -m 0644 -D package/linux-tools/linux-tool-hv_vss_daemon.service \
+                $(TARGET_DIR)/usr/lib/systemd/system/hv_vss_daemon.service
+	ln -sf ../../../../usr/lib/systemd/system/hv_vss_daemon.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/hv_vss_daemon.service
+endef
+
package/linux-tools/linux-tool-hv_vss_daemon.service new file +11 -0
new file mode 100644
index 0000000..f653f7b
@@ -0,0 +1,11 @@
+[Unit]
+Description=HyperV VSS daemon
+After=syslog.target
+ConditionVirtualization=microsoft
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/hv_vss_daemon --no-daemon
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/linux-tools: add hv_vss_daemon

Hello Pascal,

Quoted 5 lines · On Thu, 5 Dec 2019 16:44:28 +0100 Pascal de Bruijn <[email protected]>…

hyperv integration services for snapshotting a running vm

hv_vss_daemon facilitates a FIFREEZE initiated from the hypervisor

Thanks for the patch, but I believe it was insufficiently tested :-/

Quoted 6 lines
package/linux-tools/linux-tool-hv_vss_daemon.mk.in new file +0 -0
new file mode 100644
index 0000000..2de13a7

package/linux-tools/linux-tool-hv_vss_daemon.mk.in line 9

Quoted 9 lines
package/linux-tools/linux-tool-hv_vss_daemon.mk.in new file +9 -0
@@ -0,0 +1,34 @@
+################################################################################
+#
+# hv_vss_daemon
+#
+################################################################################
+
+LINUX_TOOLS += hv_vss_daemon
+
+HV_VSS_DAEMON_MAKE_OPTS = CROSS=$(TARGET_CROSS)

This is not sufficient, with just this, the user-space program is compiled with the host compiler, and therefore the build fails with:

ERROR: architecture for "/usr/sbin/hv_vss_daemon" is "Advanced Micro Devices X86-64", should be "ARM"

To fix this, don't pass CROSS=, but just pass $(LINUX_MAKE_FLAGS), just like most other linux-tools makefiles are doing.

package/linux-tools/linux-tool-hv_vss_daemon.mk.in line 27

Quoted 1 line
package/linux-tools/linux-tool-hv_vss_daemon.mk.in new file +1 -0
+define HV_VSS_DAEMON_INSTALL_INIT_SYSTEMD

This cannot work, as it will never be called: hv-vss-daemon is not a package from the point of view of Buildroot. What is a package is "linux-tools".

The reason why HV_VSS_DAEMON_INSTALL_TARGET_CMDS works is because we have some special logic in package/linux-tools/linux-tools.mk:

LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
        $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
                $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))

but there is nothing like this for _INSTALL_INIT_SYSTEMD, so I don't see how this variable could have ever been called.

Did you actually test this, and verified that the systemd unit was installed as expected ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com