Browse Source

Make KillMode configurable for service units

Libvirt container is a special beast that needs custom
killmode value for its tripleo-manager service unit.
Add kill_mode for the container values that defaults to
control-group.

Related: rhbz#2010135
Change-Id: I17222ebd53fd39ee751fc8a2db83848111be99dd
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit e89f88036be54c5fd69a9703afb5c8ba7c66056d)
changes/69/817169/1
Bogdan Dobrelya 7 months ago
parent
commit
5a12a07b1a
  1. 3
      paunch/utils/systemd.py

3
paunch/utils/systemd.py

@ -53,6 +53,7 @@ def service_create(container, cconfig, sysdir=constants.SYSTEMD_DIR, log=None):
restart = cconfig.get('restart', 'always')
stop_grace_period = cconfig.get('stop_grace_period', '10')
kill_mode = cconfig.get('kill_mode', 'control-group')
# Please refer to systemd.exec documentation for those entries
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
@ -84,6 +85,7 @@ def service_create(container, cconfig, sysdir=constants.SYSTEMD_DIR, log=None):
'restart': restart,
'stop_grace_period': stop_grace_period,
'kill_cgroup_period': 2 * stop_grace_period,
'kill_mode': kill_mode,
'sys_exec': '\n'.join(['%s=%s' % (x, y) for x, y in sys_exec.items()]),
}
# Ensure we don't have some trailing .requires directory and content for
@ -105,6 +107,7 @@ ExecStop=/usr/bin/podman stop -t %(stop_grace_period)s %(name)s
ExecStopPost=/usr/bin/podman stop -t %(stop_grace_period)s %(name)s
SuccessExitStatus=137 142 143
TimeoutStopSec=%(kill_cgroup_period)s
KillMode=%(kill_mode)s
Type=forking
PIDFile=/var/run/%(name)s.pid
%(sys_exec)s

Loading…
Cancel
Save