[pve-devel] [PATCH qemu-server v13 1/5] query-machine-capabilities: add systemd service file
Markus Frank
m.frank at proxmox.com
Mon Nov 18 12:16:56 CET 2024
Add a systemd service that runs the query-machine-capabilities binary
at boot time to ensure that the machine capabilities are stored in the
host-hw-capabilities.json file.
Signed-off-by: Markus Frank <m.frank at proxmox.com>
---
query-machine-capabilities/Makefile | 2 ++
.../query-machine-capabilities.service | 13 +++++++++++++
2 files changed, 15 insertions(+)
create mode 100644 query-machine-capabilities/query-machine-capabilities.service
diff --git a/query-machine-capabilities/Makefile b/query-machine-capabilities/Makefile
index 469c69ff..42372370 100644
--- a/query-machine-capabilities/Makefile
+++ b/query-machine-capabilities/Makefile
@@ -1,6 +1,7 @@
DESTDIR=
PREFIX=/usr
BINDIR=${PREFIX}/libexec/qemu-server
+SERVICEDIR=/lib/systemd/system
CC ?= gcc
CFLAGS += -O2 -fanalyzer -Werror -Wall -Wextra -Wpedantic -Wtype-limits -Wl,-z,relro -std=gnu11
@@ -12,6 +13,7 @@ query-machine-capabilities: query-machine-capabilities.c
install: query-machine-capabilities
install -d ${DESTDIR}/${BINDIR}
install -m 0755 query-machine-capabilities ${DESTDIR}${BINDIR}
+ install -m 0644 query-machine-capabilities.service ${DESTDIR}${SERVICEDIR}
.PHONY: clean
clean:
diff --git a/query-machine-capabilities/query-machine-capabilities.service b/query-machine-capabilities/query-machine-capabilities.service
new file mode 100644
index 00000000..d9830a9d
--- /dev/null
+++ b/query-machine-capabilities/query-machine-capabilities.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=PVE Query Machine Capabilities
+RequiresMountsFor=/run
+Before=pve-ha-lrm.service
+Before=pve-guests.service
+
+[Service]
+ExecStart=/usr/libexec/qemu-server/query-machine-capabilities
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
--
2.39.5
More information about the pve-devel
mailing list