summaryrefslogtreecommitdiffstats
path: root/recipes-sota
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-03-11 17:39:57 +0100
committerLaurent Bonnans <laurent.bonnans@here.com>2019-03-13 15:36:37 +0100
commit8e3886a8ae5c292d0c0ac8245f72ec55ef27bf6c (patch)
treebba8e43bc5fdfaf417082cdd06c8bf57a24f3c5d /recipes-sota
parent3e6b8deed49d0e82f26a939e7b1dd4186b335759 (diff)
downloadmeta-updater-8e3886a8ae5c292d0c0ac8245f72ec55ef27bf6c.tar.gz
Add aktualizr-resource-control
For controlling systemd cgroups configuration of the aktualizr daemon Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Diffstat (limited to 'recipes-sota')
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb26
-rw-r--r--recipes-sota/aktualizr/files/10-resource-control.conf6
2 files changed, 31 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 49c4e5e..f2f62b5 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -25,6 +25,7 @@ SRC_URI = " \
25 file://aktualizr-secondary.service \ 25 file://aktualizr-secondary.service \
26 file://aktualizr-secondary.socket \ 26 file://aktualizr-secondary.socket \
27 file://aktualizr-serialcan.service \ 27 file://aktualizr-serialcan.service \
28 file://10-resource-control.conf \
28 ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ 29 ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \
29 " 30 "
30 31
@@ -62,6 +63,15 @@ PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF,"
62PACKAGECONFIG[serialcan] = ",,,slcand-start" 63PACKAGECONFIG[serialcan] = ",,,slcand-start"
63PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" 64PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback"
64 65
66# can be overriden in configuration with `RESOURCE_xxx_pn-aktualizr`
67# see `man systemd.resource-control` for details
68
69# can be used to lower aktualizr priority, default is 100
70RESOURCE_CPU_WEIGHT = "100"
71# will be slowed down when it reaches 'high', killed when it reaches 'max'
72RESOURCE_MEMORY_HIGH = "100M"
73RESOURCE_MEMORY_MAX = "80%"
74
65do_compile_ptest() { 75do_compile_ptest() {
66 cmake_runcmake_build --target build_tests 76 cmake_runcmake_build --target build_tests
67} 77}
@@ -118,6 +128,15 @@ do_install_append () {
118 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} 128 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir}
119 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} 129 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir}
120 fi 130 fi
131
132 # resource control
133 install -d ${D}/${systemd_system_unitdir}/aktualizr.service.d
134 install -m 0644 ${WORKDIR}/10-resource-control.conf ${D}/${systemd_system_unitdir}/aktualizr.service.d
135
136 sed -i -e 's|@CPU_WEIGHT@|${RESOURCE_CPU_WEIGHT}|g' \
137 -e 's|@MEMORY_HIGH@|${RESOURCE_MEMORY_HIGH}|g' \
138 -e 's|@MEMORY_MAX@|${RESOURCE_MEMORY_MAX}|g' \
139 ${D}${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf
121} 140}
122 141
123PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " 142PACKAGESPLITFUNCS_prepend = "split_hosttools_packages "
@@ -132,7 +151,7 @@ python split_hosttools_packages () {
132 151
133PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" 152PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*"
134 153
135PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" 154PACKAGES =+ "${PN}-resource-control ${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools"
136 155
137ALLOW_EMPTY_${PN}-host-tools = "1" 156ALLOW_EMPTY_${PN}-host-tools = "1"
138 157
@@ -142,6 +161,10 @@ FILES_${PN} = " \
142 ${systemd_unitdir}/system/aktualizr.service \ 161 ${systemd_unitdir}/system/aktualizr.service \
143 " 162 "
144 163
164FILES_${PN}-resource-control = " \
165 ${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf \
166 "
167
145FILES_${PN}-configs = " \ 168FILES_${PN}-configs = " \
146 ${sysconfdir}/sota/* \ 169 ${sysconfdir}/sota/* \
147 ${libdir}/sota/* \ 170 ${libdir}/sota/* \
@@ -157,6 +180,7 @@ FILES_${PN}-secondary = " \
157 ${systemd_unitdir}/system/aktualizr-secondary.socket \ 180 ${systemd_unitdir}/system/aktualizr-secondary.socket \
158 ${systemd_unitdir}/system/aktualizr-secondary.service \ 181 ${systemd_unitdir}/system/aktualizr-secondary.service \
159 " 182 "
183
160BBCLASSEXTEND = "native" 184BBCLASSEXTEND = "native"
161 185
162# vim:set ts=4 sw=4 sts=4 expandtab: 186# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/files/10-resource-control.conf b/recipes-sota/aktualizr/files/10-resource-control.conf
new file mode 100644
index 0000000..254713c
--- /dev/null
+++ b/recipes-sota/aktualizr/files/10-resource-control.conf
@@ -0,0 +1,6 @@
1[Service]
2CPUAccounting=true
3CPUWeight=@CPU_WEIGHT@
4MemoryAccounting=true
5MemoryHigh=@MEMORY_HIGH@
6MemoryMax=@MEMORY_MAX@