From 858bf7ac97dd0b64b636bc4fad6fccd981e83148 Mon Sep 17 00:00:00 2001 From: Jan Baier Date: Fri, 6 Oct 2023 12:34:00 +0200 Subject: [PATCH] Apply memory limit for openqa-worker services All workers are already part of openqa-worker.slice, apply memory limit to that slice to ensure that memory cannot be exhausted exclusively by workers. Reference: https://progress.opensuse.org/issues/133511 --- Makefile | 2 +- dist/rpm/openQA.spec | 1 + systemd/openqa-worker.slice | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 systemd/openqa-worker.slice diff --git a/Makefile b/Makefile index f9f29299c1b..d2aef3b023f 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ install-generic: install -d -m 755 "$(DESTDIR)"/usr/lib/systemd/system install -d -m 755 "$(DESTDIR)"/usr/lib/systemd/system-generators install -d -m 755 "$(DESTDIR)"/usr/lib/tmpfiles.d - for i in systemd/*.{service,target,timer,path}; do \ + for i in systemd/*.{service,slice,target,timer,path}; do \ install -m 644 $$i "$(DESTDIR)"/usr/lib/systemd/system ;\ done ln -s openqa-worker-plain@.service "$(DESTDIR)"/usr/lib/systemd/system/openqa-worker@.service diff --git a/dist/rpm/openQA.spec b/dist/rpm/openQA.spec index 52e9822bbd5..1ec1d27d815 100644 --- a/dist/rpm/openQA.spec +++ b/dist/rpm/openQA.spec @@ -693,6 +693,7 @@ fi %dir %{_unitdir} %{_systemdgeneratordir} %{_unitdir}/openqa-worker.target +%{_unitdir}/openqa-worker.slice %{_unitdir}/openqa-worker@.service %{_unitdir}/openqa-worker-plain@.service %{_unitdir}/openqa-worker-cacheservice-minion.service diff --git a/systemd/openqa-worker.slice b/systemd/openqa-worker.slice new file mode 100644 index 00000000000..01e7de677da --- /dev/null +++ b/systemd/openqa-worker.slice @@ -0,0 +1,7 @@ +[Unit] +Description=Slice for openqa-worker units + +[Slice] +# Apply memory limit to this slice to ensure that memory cannot be exhausted +# exclusively by openqa-worker services. +MemoryMax=90%