From 641d2e5f486721e4f22ddf5e3063cbc9b4b420a6 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Mon, 11 Jan 2021 17:01:04 +0100 Subject: [PATCH] WIP: Add service files to restart worker after config changes without interrupting running jobs * Not tested at all; just to see how such a change would look like * See https://progress.opensuse.org/issues/80910 --- * We could actually also watch for a packaged file so it would also apply to package updates. * Then we could also get rid of `OPENQA_WORKER_TERMINATE_AFTER_JOBS_DONE=1` in the auto-restart service file. --- Makefile | 2 +- dist/rpm/openQA.spec | 2 ++ systemd/openqa-soft-restart-worker@.path | 4 ++++ systemd/openqa-soft-restart-worker@.service | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 systemd/openqa-soft-restart-worker@.path create mode 100644 systemd/openqa-soft-restart-worker@.service diff --git a/Makefile b/Makefile index 2d487bef01ea..b288d902c6d0 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,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}; do \ + for i in systemd/*.{service,target,timer,path}; do \ install -m 644 $$i "$(DESTDIR)"/usr/lib/systemd/system ;\ done sed \ diff --git a/dist/rpm/openQA.spec b/dist/rpm/openQA.spec index 3e3b35c8c839..ff9cfd04630d 100644 --- a/dist/rpm/openQA.spec +++ b/dist/rpm/openQA.spec @@ -566,6 +566,8 @@ fi %{_unitdir}/openqa-worker-cacheservice.service %{_unitdir}/openqa-worker-no-cleanup@.service %{_unitdir}/openqa-worker-auto-restart@.service +%{_unitdir}/openqa-soft-restart-worker@.service +%{_unitdir}/openqa-soft-restart-worker@.path %{_unitdir}/openqa-slirpvde.service %{_unitdir}/openqa-vde_switch.service %{_datadir}/openqa/script/openqa-slirpvde diff --git a/systemd/openqa-soft-restart-worker@.path b/systemd/openqa-soft-restart-worker@.path new file mode 100644 index 000000000000..4dcc4cef708b --- /dev/null +++ b/systemd/openqa-soft-restart-worker@.path @@ -0,0 +1,4 @@ +# see https://www.freedesktop.org/software/systemd/man/systemd.path.html#PathExists= + +[Path] +PathChanged=/etc/openqa/workers.ini diff --git a/systemd/openqa-soft-restart-worker@.service b/systemd/openqa-soft-restart-worker@.service new file mode 100644 index 000000000000..807dff25e8d9 --- /dev/null +++ b/systemd/openqa-soft-restart-worker@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Restarts openQA Worker #%i as soon as possible without interrupting jobs + +[Service] +Type=oneshot +User=_openqa-worker +ExecStart=systemctl kill --signal SIGHUP openqa-worker-auto-restart@%i.service +Slice=openqa-worker.slice